[LLVMdev] casting Constant * to value *?

Alexander Poddey alexander.poddey at gmx.net
Tue Mar 17 11:40:47 PDT 2015


Hi all,

extracting datafields of globals, the API code ends up in a Constant * 


Constant* const_ptr_103 = ConstantExpr::getGetElementPtr(gvar_struct_foo, 
const_ptr_103_indices);

it can be used to initialize e.g. a new instruction like:

StoreInst* void_119 = new StoreInst(const_float_102, const_ptr_103, false, 
label_entry_113);


But how about replacing the operand of an already existing instruction using 
a Constant *?

Instruction->setOperand(1,__needs_a_value*_here__);


Thx
Alex




 






More information about the llvm-dev mailing list