[LLVMdev] Questions about LLVM IR encoding
张乐
yueguoguo1024 at gmail.com
Mon Feb 21 00:42:22 PST 2011
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.
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.
I have read the LLVM documents, yet I still have some questions as follows:
1. As IR is target-independent, how can we encode them into bit-code
executable files without specific targets' information?
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.
I have made several tests as the document suggests, but I conclude with
nothing helpful to my work.
The result of my experiment is attached.
It is a simple add program, and from the bc file generated by
llvm-bcanalyzer I cannot relate it to the original IR.
For example, the expressions of
<INST_STORE2 op0=6 op1=1 op2=3 op3=0/>
<INST_STORE2 op0=5 op1=3 op2=3 op3=0/>
actually represent those of
store i32 1, i32* %a, align 4
store i32 2, i32* %b, align 4
in the .ll file.
Despite the explicit opcode matches in the two forms, I am confused of
the information of op0, op1 etc in the .bc file.
What does it mean? This is not very clearly clarified in the document,
or may I omit something?
Can anybody please lend me a hand?
Thanks very much sincerely!
--
*with best regards*
Zhang Le
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110221/1ebc1f8d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add.ll
Type: application/octet-stream
Size: 873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110221/1ebc1f8d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add.bc.dump
Type: application/octet-stream
Size: 6700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110221/1ebc1f8d/attachment-0001.obj>
More information about the llvm-dev
mailing list