c++ - How to insert an LLVM StoreInst in a Basic Block -
i going through instructions in basic block. after allocation instruction want make store variable , insert right after allocation instruction. right able find allocation instruction
if(allocainst *ai=dyn_cast<allocainst>(&i)) but not know how create storeinst. want store number 10 in regardless of type variable is.
i tried this
storeinst* stinst = new storeinst(value *val, value *ptr, instruction *insertbefore); but not know put in place of val, ptr, , how adress of next instruction if needs pointer insertbefore
to insert after instruction can use insertafter() method. in case:
ai->insertafter(stinst) and create storeinst need provide with
value *valwant store. in case you'd need createconstantrepresent "10" integer , pass there.value *ptrwant put value. guess,aiin case.nullptrinstruction *insertbefore, because inserting manually.
Comments
Post a Comment