Branch profiling in older llvm revision

Hi All,

My apologies for the long winded post in advance.

I need to obtain branch data(execution count of each block would work as well) for my machine function pass. The catch is I am using LLVM 3.1(can’t update to later revision due to external factors) with DragonEGG and cross compiling it with GCC 32 bit arm tool chain.

The only option I see is using “-insert-edge-profiling” with “–profile-loader”. Because of complications with my toolchain, I am not really sure I can use it as it. If any of you have worked with this, can you point me to some/any documentation showing what happens in the backend when using these?

The only useful information I can find on these are from previous questions people have asked(https://groups.google.com/forum/#!topic/llvm-dev/vJ2wDsQY6a4 being one of them). The steps from what I can understand are:

opt -insert-edge-profiling -O3 foo.bc -o foo.2.bc
run the compiled binary using llvm-prof after linking with lprofile_rt
opt -profile-loader -O3 foo.bc -o foo.opt.bc //the required info can be obtained using this pass.

Because I cross compile the binary, I am using gem5 to run it. This means, I have a problem since I have an arm binary I need to execute and x86 llvm tool(llvm-prof in this case).Theoretically, I should be able to

a)Compile the binary for host with the first pass(one with opt -insert-edge-profiling) and run it using llvm-prof

b) Compile again with arm backend with only the second pass(-profile-loader)

Since the llvm bit code should be architecture independent. Is this an option? Has anyone tried this?

Regards,
Deepak