[LLVMdev] printing constants

anubham suresh bobby_anubham at yahoo.co.in
Fri Mar 3 00:54:20 PST 2006


Sir,

Given code like:
> 
>    X = add int Y, 1
>    Z = mul int X, 17

while I iterate over the  operands of the first
instruction i want to print the variable x ,as well as
the constant 1 and while i iterate over the second
instruction i want to print variable x and constant
17. 
what should I do?

thanking you,

yours sincerely,
anubham suresh
TU-Darmstadt


--- llvmdev-request at cs.uiuc.edu wrote:

> Send LLVMdev mailing list submissions to
> 	llvmdev at cs.uiuc.edu
> 
> To subscribe or unsubscribe via the World Wide Web,
> visit
> 	http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> or, via email, send a message with subject or body
> 'help' to
> 	llvmdev-request at cs.uiuc.edu
> 
> You can reach the person managing the list at
> 	llvmdev-owner at cs.uiuc.edu
> 
> When replying, please edit your Subject line so it
> is more specific
> than "Re: Contents of LLVMdev digest..."
> 
> 
> Today's Topics:
> 
>    1. RE: printing constants (Chris Lattner)
> 
> 
>
----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 2 Mar 2006 11:53:23 -0600 (CST)
> From: Chris Lattner <sabre at nondot.org>
> Subject: [LLVMdev] RE: printing constants
> To: LLVM Developers Mailing List
> <llvmdev at cs.uiuc.edu>
> Message-ID:
> <Pine.LNX.4.61.0603021150460.513 at nondot.org>
> Content-Type: TEXT/PLAIN; charset=US-ASCII;
> format=flowed
> 
> On Thu, 2 Mar 2006, anubham suresh wrote:
> > 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.,).
> 
> 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
> 
> -- 
> http://nondot.org/sabre/
> http://llvm.org/
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> LLVMdev mailing list
> LLVMdev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 
> End of LLVMdev Digest, Vol 21, Issue 4
> **************************************
> 


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


		
__________________________________________________________ 
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com




More information about the llvm-dev mailing list