LLVMdev Digest, Vol 21, Issue 2

hello everybody,
here I have a question regarding printing of the
constants( like 2 .63 etc.,) present in the
instruction while iterating over the instructions
within a basic block .
I am able to print the vaiables but not the
constants.
Can you please tell me how to get the constants
printed out while iterating over the instructions
because the constants do not have names as the
variables do( like temp12,temp131 etc.,).

thanking you,

yours sincerely
anubham suresh
TU-Darmstadt
Germany

Anubham Suresh
Measurement and Instrumentation
Electrical Department
IIT Roorkee
Current location:Darmstadt, Germany
mobile: +49-1762-3924878

I'm not really sure what you want to do. If you're trying to print out all of the literal constants in instructions in a function, you can use the llvm/Analysis/ConstantsScanner.h interface to do this. Something like this:

   Function *F = ...
   for (constant_iterator I = constant_begin(F), E = constant_end(F);
        I != E; ++I)
     std::cerr << *I;

Given code like:

   X = add int Y, 1
   Z = mul int X, 17

It will print out 1 and 17.

Is this what you mean?

-Chris