[LLVMdev] Figuring out the parameters of the Call Instruction
baldrick at free.fr
Thu Jul 15 00:07:19 PDT 2010
> 24 p_ptr ((unsigned long)&abc);
> call void @p_ptr(i64 ptrtoint (%struct.my_struct* @abc to i64))
> nounwind, !dbg !31
> Q.1 At line no 24 I try to read the address of global variable abc.
> The address is type casted
> from struct * to int * for which ptrtoint.
I guess you mean "is type casted from struct * to unsigned long".
I read the
> operands of the call instruction and there
> descriptions. I do not see among the fields of the call
> instruction the ptrtoint instruction.
In your case, this is not the ptrtoint instruction, it is the ptrtoint
constant expression. Constants are written in the assembler at the
point where they are used, as you see in your example.
> How can I reach the ptrtoint instruction from the call
> instruction ? What fields I need to access.
It is the first argument to the call instruction CI, thus you can get it with
> 26 p_ptr ((unsigned long)&stack_abc);
> %stack_abc1 = ptrtoint %struct.my_struct* %stack_abc to i64, !dbg
> !33 ;<i64> [#uses=1]
> call void @p_ptr(i64 %stack_abc1) nounwind, !dbg !33
> Q.2 stack_abc1 is a alias for the operation performed by the
> ptrtoint instruction.
> Which fields from the instruction class will help me read if I may say
> the "output" of the instruction ?
I didn't understand the question, sorry.
More information about the llvm-dev