Mos Moh
2014-Mar-12 14:45 UTC
[LLVMdev] How can i insert an add instruction in IR file llvm?
i want to insert add instruction in IR llvm format, instruction like x = x + 1 , where x is global variable , i try to use: GlobalVariable* x = new GlobalVariable(mod,Type::getInt32Ty(Context),false,GlobalValue::CommonLinkage,0,"xCounter"); Value one = ConstantInt::get(Type::getInt32Ty(Context),1); newInst = BinaryOperator::Create(Instruction::Add, , one ,"counter", insertPos); but an error occur, it is not accept type GlobalVariable, How can i define a global variable and set its value , and final i print its value on screen ? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140312/43fd639f/attachment.html>