Asit Dhal via llvm-dev
2016-Aug-02 08:24 UTC
[llvm-dev] Make certain local variables available to LLVM pass
Hi, I have the following situation. I need to insert certain CallInst in my code. The prototype of my function is void __llvmFooBar(int data, int loc); The parameter loc is generated by the pass. I don't need any external data to generate that. But, the parameter data is basically calculated by using some variable declared inside my C-code. //test.c int main() { int k = 0; happyEnding(k); } void happyEnding(int k) { int __data = seed(time()) + k%2; //callInst to be inserted here, it should be //__llvmFooBar(__data, 23); myAlgorithim(); } //pass.cpp ...... std::vector<Value *> args(2); args[0] = ??? //need help here args[1] = ConstantInt::get(IntegerTy, getLoc()); m_builder->CreateCall(hook, args); In generic sense, how to make all variable with specific naming convention(like starts with __) make available to llvm pass ? Can someone tell me how to proceed here ? -- Warm Regards, Asit Dhal http://asit-dhal.github.io/