From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dibyendu Majumdar Subject: Re: [PATCH 06/13] llvm: fix type of literal integer passed as arguments Date: Tue, 7 Mar 2017 19:41:39 +0000 Message-ID: References: <20170305112047.3411-1-luc.vanoostenryck@gmail.com> <20170305112047.3411-7-luc.vanoostenryck@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from mail-it0-f51.google.com ([209.85.214.51]:36127 "EHLO mail-it0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756091AbdCGTmG (ORCPT ); Tue, 7 Mar 2017 14:42:06 -0500 Received: by mail-it0-f51.google.com with SMTP id h10so77806855ith.1 for ; Tue, 07 Mar 2017 11:41:40 -0800 (PST) In-Reply-To: Sender: linux-sparse-owner@vger.kernel.org List-Id: linux-sparse@vger.kernel.org To: Christopher Li Cc: Luc Van Oostenryck , Linux-Sparse On 7 March 2017 at 15:33, Christopher Li wrote: > On Sun, Mar 5, 2017 at 7:20 PM, Luc Van Oostenryck > wrote: >> Like for all others instructions, LLVM needs the type >> of each operands. However this information is not always >> available via the pseudo, like here when passing a integer >> constant as argument since for sparse constants are typeless. >> >> Fix this by getting the type via the function prototype. >> >> + LLVMValueRef value; >> + if (arg->type == PSEUDO_VAL) { >> + /* Value pseudos do not have type information. */ >> + /* Use the function prototype to get the type. */ >> + struct symbol *ctype = get_nth1_arg(insn->func->sym, i + 1); > > I try to come up with an example to use the PREPARE_PTR_LIST() in this patch. I suppose that the function prototype may not have the same number of declared parameters as the actual call arguments - e.g. if the function is variadic. In that case there may not be corresponding parameter definition available. I think that in this case default argument promotion rules will need to be applied for trailing arguments. Regards Dibyendu