Reputation: 2347
I'd like to insert a function call (printf) in the first basic block of every function, which prints the function name. Please be specific how can I do that. The difficult part is that I don't know how to pass the function name as a parameter to printf.
Upvotes: 2
Views: 1499
Reputation: 9324
This is pretty straightforward: you will need to grab the name of the function, create ConstantArray in your module (check ConstantArray::get() method described e.g. in http://llvm.org/docs/doxygen/html/classllvm_1_1ConstantArray.html) containing the name of your function and pass this array to printf() call.
Upvotes: 2