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 *val want store. in case you'd need create constant represent "10" integer , pass there.
  • value *ptr want put value. guess, ai in case.
  • nullptr instruction *insertbefore, because inserting manually.

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -