[LLVMdev] printing constants
Chris Lattner
sabre at nondot.org
Fri Mar 3 14:06:55 PST 2006
On Fri, 3 Mar 2006, anubham suresh wrote:
> for (User::op_iterator
> operand=j->op_begin(),operand_end=j->op_end();operand!=operand_end;++operand){
> Value *v=operand->get();
> const Type *t=v->getType();
> cerr<<endl<<" operand: "<<"[ "<<v->hasName()<<"
> ]"<<v->getName()<<" Type:"<<*t<< " it has: "<<
> v->getNumUses()<<"--uses";
> }
>
> but by using this i am able to print the variables
> but not the constants .I am also able to print the
> type of the constant but not the constant value.i am
> getting a empty space for the constant.What should I
> do for getting the constant printed out?
v->getName() is always "" for a constant. "v" *is* the constant though.
Try "<< *v" instead of "<< v->getName()".
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list