On 7 March 2017 at 19:41, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote: > On 7 March 2017 at 15:33, Christopher Li <sparse@xxxxxxxxxxx> wrote: >> On Sun, Mar 5, 2017 at 7:20 PM, Luc Van Oostenryck >> <luc.vanoostenryck@xxxxxxxxx> 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. > I have also hit a problem when calling a function via function pointer. In this case the instruction->func appears to be PSEUDO_REG rather than PSEUDO_SYM, so trying to get the function prototype doesn't work. If the call is a via a function pointer then where should one look for what the argument type should be when a constant is encountered? Regards Dibyendu -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html