[LLVMdev] Question About inserting Instruction?

Chris Lattner sabre at nondot.org
Wed May 11 08:33:12 PDT 2005


On Wed, 11 May 2005, Qiuyu Zhang wrote:
>    what I tried is to make *NewInst point to random memory(cast to Instuction pointer) and push_back to instList. But I failed to do it.
>
>            Instruction *NewInst  =  ;
>            NewBB->getInstList().push_back(NewInst);
>
> So I was wondering if it is allowed in LLVM or not, if so, how to do that?
>
> Let me know if my question is not clear.

This isn't going to work.  The LLVM code always has to be well-defined. 
The way to get the machine code to contain garbage like this is to add an 
intrinsic, then have the code generator expand it to the garbage you want.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list