OLD | NEW |
---|---|
1 Subzero - Fast code generator for PNaCl bitcode | 1 Subzero - Fast code generator for PNaCl bitcode |
2 =============================================== | 2 =============================================== |
3 | 3 |
4 Building | 4 Building |
5 -------- | 5 -------- |
6 | 6 |
7 Subzero is set up to be built within the Native Client tree. Follow the | 7 Subzero is set up to be built within the Native Client tree. Follow the |
8 `Developing PNaCl | 8 `Developing PNaCl |
9 <https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/developing-pnacl >`_ | 9 <https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/developing-pnacl >`_ |
10 instructions, in particular the section on building PNaCl sources. This will | 10 instructions, in particular the section on building PNaCl sources. This will |
(...skipping 14 matching lines...) Expand all Loading... | |
25 make -f Makefile.standalone DEBUG=1 | 25 make -f Makefile.standalone DEBUG=1 |
26 make -f Makefile.standalone NOASSERT=1 | 26 make -f Makefile.standalone NOASSERT=1 |
27 make -f Makefile.standalone DEBUG=1 NOASSERT=1 | 27 make -f Makefile.standalone DEBUG=1 NOASSERT=1 |
28 make -f Makefile.standalone MINIMAL=1 | 28 make -f Makefile.standalone MINIMAL=1 |
29 | 29 |
30 ``DEBUG=1`` builds without optimizations and is good when running the translator | 30 ``DEBUG=1`` builds without optimizations and is good when running the translator |
31 inside a debugger. ``NOASSERT=1`` disables assertions and is the preferred | 31 inside a debugger. ``NOASSERT=1`` disables assertions and is the preferred |
32 configuration for performance testing the translator. ``MINIMAL=1`` attempts to | 32 configuration for performance testing the translator. ``MINIMAL=1`` attempts to |
33 minimize the size of the translator by compiling out everything unnecessary. | 33 minimize the size of the translator by compiling out everything unnecessary. |
34 | 34 |
35 The result of the ``make`` command is the target ``llvm2ice`` in the current | 35 The result of the ``make`` command is the target ``pnacl-sz`` in the current |
36 directory. | 36 directory. |
37 | 37 |
38 ``llvm2ice`` | 38 ``pnacl-sz`` |
39 ------------ | 39 ------------ |
40 | 40 |
41 The ``llvm2ice`` program parses a pexe or an LLVM bitcode file and translates it | 41 The ``pnacl-sz`` program parses a pexe or an LLVM bitcode file and translates it |
42 into ICE (Subzero's intermediate representation). It then invokes the ICE | 42 into ICE (Subzero's intermediate representation). It then invokes the ICE |
43 translate method to lower it to target-specific machine code, optionally dumping | 43 translate method to lower it to target-specific machine code, optionally dumping |
44 the intermediate representation at various stages of the translation. | 44 the intermediate representation at various stages of the translation. |
45 | 45 |
46 The program can be run as follows:: | 46 The program can be run as follows:: |
47 | 47 |
48 ../llvm2ice ./path/to/<file>.pexe | 48 ../pnacl-sz ./path/to/<file>.pexe |
Karl
2015/02/26 17:03:34
Doesn't this require -build-on-read?
Jim Stichnoth
2015/02/26 17:11:33
No, thanks to a magical moment:
https://coderevie
| |
49 ../llvm2ice ./tests_lit/llvm2ice_tests/<file>.ll | 49 ../pnacl-sz ./tests_lit/pnacl-sz_tests/<file>.ll |
50 | 50 |
51 At this time, ``llvm2ice`` accepts a number of arguments, including the | 51 At this time, ``pnacl-sz`` accepts a number of arguments, including the |
52 following: | 52 following: |
53 | 53 |
54 ``-help`` -- Show available arguments and possible values. (Note: this | 54 ``-help`` -- Show available arguments and possible values. (Note: this |
55 unfortunately also pulls in some LLVM-specific options that are reported but | 55 unfortunately also pulls in some LLVM-specific options that are reported but |
56 that Subzero doesn't use.) | 56 that Subzero doesn't use.) |
57 | 57 |
58 ``-notranslate`` -- Suppress the ICE translation phase, which is useful if | 58 ``-notranslate`` -- Suppress the ICE translation phase, which is useful if |
59 ICE is missing some support. | 59 ICE is missing some support. |
60 | 60 |
61 ``-target=<TARGET>`` -- Set the target architecture. The default is x8632. | 61 ``-target=<TARGET>`` -- Set the target architecture. The default is x8632. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 The Subzero-translated symbols are specially mangled to avoid multiple | 98 The Subzero-translated symbols are specially mangled to avoid multiple |
99 definition errors from the linker. Both translated versions are linked together | 99 definition errors from the linker. Both translated versions are linked together |
100 with a driver program that calls each version of each unit test with a variety | 100 with a driver program that calls each version of each unit test with a variety |
101 of interesting inputs and compares the results for equality. The cross tests | 101 of interesting inputs and compares the results for equality. The cross tests |
102 are currently invoked by running the ``runtests.sh`` script. | 102 are currently invoked by running the ``runtests.sh`` script. |
103 | 103 |
104 A convenient way to run both the lit tests and the cross tests is:: | 104 A convenient way to run both the lit tests and the cross tests is:: |
105 | 105 |
106 make -f Makefile.standalone check | 106 make -f Makefile.standalone check |
107 | 107 |
108 Assembling ``llvm2ice`` output as needed | 108 Assembling ``pnacl-sz`` output as needed |
109 ---------------------------------------- | 109 ---------------------------------------- |
110 | 110 |
111 ``llvm2ice`` can now produce a native ELF binary using ``-filetype=obj``. | 111 ``pnacl-sz`` can now produce a native ELF binary using ``-filetype=obj``. |
112 | 112 |
113 ``llvm2ice`` can also produce textual assembly code in a structure suitable for | 113 ``pnacl-sz`` can also produce textual assembly code in a structure suitable for |
114 input to ``llvm-mc``, using ``-filetype=asm`` or ``-filetype=iasm``. An object | 114 input to ``llvm-mc``, using ``-filetype=asm`` or ``-filetype=iasm``. An object |
115 file can then be produced using the command:: | 115 file can then be produced using the command:: |
116 | 116 |
117 llvm-mc -arch=x86 -filetype=obj -o=MyObj.o | 117 llvm-mc -arch=x86 -filetype=obj -o=MyObj.o |
118 | 118 |
119 Building a translated binary | 119 Building a translated binary |
120 ---------------------------- | 120 ---------------------------- |
121 | 121 |
122 There is a helper script, ``pydir/szbuild.py``, that translates a finalized pexe | 122 There is a helper script, ``pydir/szbuild.py``, that translates a finalized pexe |
123 into a fully linked executable. Run it with ``-help`` for extensive | 123 into a fully linked executable. Run it with ``-help`` for extensive |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 165 |
166 * Global, linear-scan register allocation. | 166 * Global, linear-scan register allocation. |
167 | 167 |
168 * Advanced phi lowering after target lowering and global register allocation, | 168 * Advanced phi lowering after target lowering and global register allocation, |
169 via edge splitting, topological sorting of the parallel moves, and final local | 169 via edge splitting, topological sorting of the parallel moves, and final local |
170 register allocation. | 170 register allocation. |
171 | 171 |
172 * Stack slot coalescing to reduce frame size. | 172 * Stack slot coalescing to reduce frame size. |
173 | 173 |
174 * Branch optimization to reduce the number of branches to the following block. | 174 * Branch optimization to reduce the number of branches to the following block. |
OLD | NEW |