Help on LLVM Instrumentation

Hi ,

I am using LLVM for my Post Graduate course project on Optimization. I am trying to do some insrtumentation to the bytecode.I 've been going through your Instrumentation code for the past few days in /llvm/lib/Transforms/Instrumentation folder and finally found two ways of instrumentation :

  1. injecting LLVM bytecode instructions

  2. calling an external C function.

I am trying both and I am comfortable with the 2).
My goal is to insert a global variable , which will count the total number of functions executed.At each method entry the global variable should be incremented and at the last method exit , it should print the count. The code compiled successfully, but when I used in the opt tool, I get an error in the getElementPtr(…) statement and finally a segmentation fault error. Please help me regarding this.

I am sending the code as an attachment.

I 've written a pass which will do instrumentation using the opt tool and then execute with lli JIT enabled.

Thank you ,

Sandra Johnson , M.E. (C.S.E.)

Anna University,

Chennai , India.

Sample.cpp (4.73 KB)