[LLVMdev] Question About inserting Instruction?
Qiuyu Zhang
qiuyu at ucla.edu
Wed May 11 03:21:30 PDT 2005
Hi,
I am working on a project with LLVM. What I need to do is to generate/insert some dummy/dead basic blocls which never have chance to be executed and put some instructions in those dummy/dead basic blocks.
So far, the dummy/dead BB insertion is done. I am trying insert instructions in those dummy/dead BB. Actually, I can insert the legal instructions to dummy/dead BB, however, I really want to insert some illegal instructions/any thing into those BB since those instructions have no chance to be executed. I am not sure if it could be done or not.
For example,
Correct way:
Instruction *NewInst = new LoadInst(...);
NewBB->getInstList().push_back(NewInst);
what I need just put some junk data in the BB, not instructions. From assemble code level, it looks like the following,
a piece of code from correct instructions by disassemble object code.
:00000009 0533709283 add eax, 83927033
:0000000E 05A2B78135 add eax, 3581B7A2
:00000013 C1C819 ror eax, 19
:00000016 05E5167711 add eax, 117716E5
:0000001B 0542F7A8DC add eax, DCA8F742
:00000009 0533709283 add eax, 83927033
:0000000E 7878787878 ??? <<<<<< here is the illegal instruction.
:00000013 23232 ??? <<<<<<
:00000016 05E5167711 add eax, 117716E5
:0000001B 0542F7A8DC add eax, DCA8F742
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.
Thanks
Qiuyu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050511/baa0ed3b/attachment.html>
More information about the llvm-dev
mailing list