<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.3826.2400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Times New Roman" size=2>Hi, </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Times New Roman" size=2>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.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Times New Roman" size=2>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. </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Times New Roman" size=2>For example,</FONT></DIV>
<DIV> <FONT face="Times New Roman" size=2>Correct way:</FONT></DIV>
<DIV><FONT face="Times New Roman" size=2>    Instruction *NewInst 
= new LoadInst(...);</FONT></DIV>
<DIV><FONT face="Times New Roman" size=2>    
NewBB->getInstList().push_back(NewInst);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Times New Roman" size=2> what I need just put some junk 
data in the BB, not instructions. From assemble code level, it looks like the 
following,</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Times New Roman" size=2> a piece of code from correct 
instructions by disassemble object code.</FONT></DIV>
<DIV><FONT face="Times New Roman" size=2>   </FONT></DIV>
<DIV><FONT face="Times New Roman" size=2>:00000009 
0533709283              
add eax, 83927033<BR>:0000000E 
05A2B78135              
add eax, 3581B7A2<BR>:00000013 
C1C819                  
ror eax, 19<BR>:00000016 
05E5167711              
add eax, 117716E5<BR>:0000001B 
0542F7A8DC              
add eax, DCA8F742<BR></FONT></DIV>
<DIV><FONT face="Times New Roman" size=2></FONT> </DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2>:00000009 
0533709283              
add eax, 83927033<BR>:0000000E 
7878787878          
???                
                
    <<<<<<  here is the illegal 
instruction.<BR>:00000013 23232        
            ???    
                
                
<<<<<<<BR>:00000016 
05E5167711              
add eax, 117716E5<BR>:0000001B 
0542F7A8DC              
add eax, DCA8F742</FONT></FONT></DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2></FONT></FONT> </DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2>    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. </FONT></FONT></DIV>
<DIV><FONT face="Times New Roman" size=2>    </FONT></DIV>
<DIV><FONT face="Times New Roman" 
size=2>            
Instruction *NewInst  =  ;   </FONT></DIV>
<DIV><FONT face="Times New Roman" size=2>    
        
NewBB->getInstList().push_back(NewInst);</FONT></DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2></FONT></FONT> </DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" size=2>So 
I was wondering if it is allowed in LLVM or not, if so, how to do 
that?</FONT></FONT></DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2></FONT></FONT> </DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" size=2>Let 
me know if my question is not clear.</FONT></FONT></DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2></FONT></FONT> </DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2>Thanks</FONT></FONT></DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2>Qiuyu<BR></DIV></FONT></FONT>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2></FONT></FONT> </DIV>
<DIV><FONT face="Times New Roman" size=2><FONT face="Times New Roman" 
size=2> </DIV></FONT></FONT></BODY></HTML>