[LLVMdev] Get the loop trip count variable

Zheng Wang jason.wangz at gmail.com
Mon Apr 5 13:19:11 PDT 2010


Hello,

I am wondering whether I can get the variable name of loop trip count in LLVM?

For example,

int NUM;

NUM=atoi(argv[i]);

for (int i=0; i<NUM; i++)
{
    ...
}

How can I get the corresponding variable name for "NUM"? Then, I can
instrument something in the source code to record the loop trip count
for a given input data set.

BasicBlock* b = L->getHeader();

returns the basicblock of the loop header, but I don't know how to
extract "NUM" from basicblock b.

Cheers,
Zheng



More information about the llvm-dev mailing list