marwayusuf at feng.bu.edu.eg
2013-Nov-10 10:51 UTC
[LLVMdev] about creating the first value of the storeinst
Dear All I'm trying to create storeInst using StoreInst *SI = new StoreInst(val, AI, BB); AI is an alloca instruction previously created, BB is the basicBlock I want to put instructionsi in. Val is the value to store. I've created val from a genericValue like this: Value* val = ConstantInt::get(getGlobalContext(), Result.IntVal); Result is the genericValue However I keep getting this error: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed. What is wrong about my code? Thanks a million in advance. Regards, Marwa Yusuf Teaching Assistant - Computer Engineering Department Faculty of Engineering - Benha University E-JUST MSc Student Computer Science & Engineering Dept. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131110/c3153537/attachment.html>
marwayusuf at feng.bu.edu.eg
2013-Nov-10 14:04 UTC
[LLVMdev] about creating the first value of the storeinst
It worked. I managed finally to create the StoreInst. The problem was in AllocaInst from the start. I was passing a wrong type for CreateAlloca function so it was generating a wrong pointer. Regards, Marwa Yusuf Teaching Assistant - Computer Engineering Department Faculty of Engineering - Benha University E-JUST MSc Student Computer Science & Engineering Dept. ________________________________ From: llvmdev-bounces at cs.uiuc.edu <llvmdev-bounces at cs.uiuc.edu> on behalf of marwayusuf at feng.bu.edu.eg <marwayusuf at feng.bu.edu.eg> Sent: Sunday, November 10, 2013 12:51 PM To: llvmdev at cs.uiuc.edu Subject: [LLVMdev] about creating the first value of the storeinst Dear All I'm trying to create storeInst using StoreInst *SI = new StoreInst(val, AI, BB); AI is an alloca instruction previously created, BB is the basicBlock I want to put instructionsi in. Val is the value to store. I've created val from a genericValue like this: Value* val = ConstantInt::get(getGlobalContext(), Result.IntVal); Result is the genericValue However I keep getting this error: void llvm::StoreInst::AssertOK(): Assertion `getOperand(0)->getType() == cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr must be a pointer to Val type!"' failed. What is wrong about my code? Thanks a million in advance. Regards, Marwa Yusuf Teaching Assistant - Computer Engineering Department Faculty of Engineering - Benha University E-JUST MSc Student Computer Science & Engineering Dept. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131110/3c63c504/attachment.html>