<meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: 'Droid Sans', arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(32, 32, 32); "><div>
Hi all, I am new to LLVM (even the field of compiler) and currently I am engaged in the work of adapting LLVM IR to M5 simulator to observe the enhancement of the novel architecture we design.</div><div>Simply speaking if you know little about M5, my aim is to know how LLVM IR is interpreted and encoded, then try to implement it in the framework of M5.</div>
<div>I have read the LLVM documents, yet I still have some questions as follows:</div><div> </div><div>1. As IR is target-independent, how can we encode them into bit-code executable files without specific targets' information?  </div>
<div>2. The "bitstream container format" as the document refers, is XML-like, and I wonder how does LLVM translate it into executable format such as bit-code.</div><div>    I have made several tests as the document suggests, but I conclude with nothing helpful to my work. <br>
    The result of my experiment is attached. <br>    It is a simple add program, and from the bc file generated by llvm-bcanalyzer I cannot relate it to the original IR.<br>    For example, the expressions of <br>    <INST_STORE2 op0=6 op1=1 op2=3 op3=0/><br>
    <INST_STORE2 op0=5 op1=3 op2=3 op3=0/><br>    actually represent those of<br>    store i32 1, i32* %a, align 4<br>    store i32 2, i32* %b, align 4<br>    in the .ll file.<br>    Despite the explicit opcode matches in the two forms, I am confused of the information of op0, op1 etc in the .bc file.<br>
    What does it mean? This is not very clearly clarified in the document, or may I omit something? <br><br>Can anybody please lend me a hand?<br>Thanks very much sincerely!</div></span><br>-- <br><i><font face="arial, helvetica, sans-serif" color="#330000">with best regards</font></i><div>
<font face="arial, helvetica, sans-serif" color="#330000">Zhang  Le</font></div><br>