LLVM Pass for Instructions in Function (error

Hi,

Hi Sandeep,

Thanks.

One question about:

Value* AddrPointer = Inst->getIperand(0);

So this works for LVALUE(S) i.e. in my case pointer on LHS of ‘=’. I cannot find anything online about getloperand online.

For reference this is the instruction:

%ptrA = getelementptr float, float addrspace(1)* %A, i32 %id

I thought if I just get the return value of the instruction then I can get %ptrA.

Can you please elaborate on that?

Thanks again.

-Gurunath

%ptrA is not the return value of the instruction, it is the instruction itself.

Hi Sandeep,

Thanks.

One question about:

Value* AddrPointer = Inst->getIperand(0);

So this works for LVALUE(S) i.e. in my case pointer on LHS of '='. I
cannot find anything online about getloperand online.

For reference this is the instruction:

%ptrA = getelementptr float, float addrspace(1)* %A, i32 %id

I thought if I just get the return value of the instruction then I can get
%ptrA.

%ptrA is not the return value of the instruction, it *is* the instruction
itself.

http://llvm.org/docs/FAQ.html#what-api-do-i-use-to-store-a-value-to-one-of-the-virtual-registers-in-llvm-ir-s-ssa-representation

-- Sean Silva

Thanks Sean.

This actually complicates the things for me.

So, I have

%ptrA = getelementptr float, float addrspace(1)* %A, i32 %id

Then I have in same IR these lines after few instructions:

%valA = load float, float addrspace(1)* %ptrA, align 4