Arpita Dutta
Arpita Dutta

Reputation: 49

How to retrive the arguments passed during function call in LLVM?

I have a call instruction 'call void @calculate_output(i32 %14), !dbg !141' in llvm. I want to retrieve the value object %14 from this. Whenever, I am trying, I am getting the formal parameters for this instead of the actual parameter.

Upvotes: 1

Views: 778

Answers (1)

arrowd
arrowd

Reputation: 34401

If you are getting formal parameters, it means you are working with Function*, not CallInst*. Did you call call->getFunction()?

What you need is just call->getArgOperand(0), see https://llvm.org/doxygen/classllvm_1_1CallBase.html#ab2caa29167597390ab2fc3cf30d70389

Upvotes: 3

Related Questions