OLD | NEW |
(Empty) | |
| 1 Subzero - Fast code generator for PNaCl bitcode |
| 2 =============================================== |
| 3 |
| 4 Building |
| 5 -------- |
| 6 |
| 7 You must have LLVM trunk source code available and built. See |
| 8 http://llvm.org/docs/GettingStarted.html#getting-started-quickly-a-summary for |
| 9 guidance. |
| 10 |
| 11 Set variables ``LLVM_SRC_PATH``, ``LLVM_BUILD_PATH``, and ``LLVM_BIN_PATH`` to |
| 12 point to the appropriate directories in the LLVM source and build directories. |
| 13 These can be set as environment variables, or you can modify the top-level |
| 14 Makefile. |
| 15 |
| 16 Run ``make`` at the top level to build the main target ``llvm2ice``. |
| 17 |
| 18 ``llvm2ice`` |
| 19 ------------ |
| 20 |
| 21 The ``llvm2ice`` program uses the LLVM infrastructure to parse an LLVM bitcode |
| 22 file and translate it into ICE. It then invokes ICE's translate method to lower |
| 23 it to target-specific machine code, dumping the IR at various stages of the |
| 24 translation. |
| 25 |
| 26 The program can be run as follows:: |
| 27 |
| 28 ../llvm2ice ./ir_samples/<file>.ll |
| 29 ../llvm2ice ./tests_lit/llvm2ice_tests/<file>.ll |
| 30 |
| 31 At this time, ``llvm2ice`` accepts a few arguments: |
| 32 |
| 33 ``-help`` -- Show available arguments and possible values. |
| 34 |
| 35 ``-notranslate`` -- Suppress the ICE translation phase, which is useful if |
| 36 ICE is missing some support. |
| 37 |
| 38 ``-target=<TARGET>`` -- Set the target architecture. The default is x8632, |
| 39 and x8632fast (generate x8632 code as fast as possible at the cost of code |
| 40 quality) is also available. Future targets include x8664, arm32, and arm64. |
| 41 |
| 42 ``-verbose=<list>`` -- Set verbosity flags. This argument allows a |
| 43 comma-separated list of values. The default is ``none``, and the value |
| 44 ``inst,pred`` will roughly match the .ll bitcode file. Of particular use |
| 45 are ``all`` and ``none``. |
| 46 |
| 47 See ir_samples/README.rst for more details. |
| 48 |
| 49 Running the test suite |
| 50 ---------------------- |
| 51 |
| 52 Subzero uses the LLVM ``lit`` testing tool for its test suite, which lives in |
| 53 ``tests_lit``. To execute the test suite, first build Subzero, and then run:: |
| 54 |
| 55 python <path_to_lit.py> -sv tests_lit |
| 56 |
| 57 ``path_to_lit`` is the direct path to the lit script in the LLVM source |
| 58 (``$LLVM_SRC_PATH/utils/lit/lit.py``). |
| 59 |
| 60 The above ``lit`` execution also needs the LLVM binary path in the |
| 61 ``LLVM_BIN_PATH`` env var. |
| 62 |
| 63 Assuming the LLVM paths are set up, ``make check`` is a convenient way to run |
| 64 the test suite. |
| 65 |
| 66 Assembling ``llvm2ice`` output |
| 67 ------------------------------ |
| 68 |
| 69 Currently ``llvm2ice`` produces textual assembly code in a structure suitable |
| 70 for input to ``llvm-mc`` and currently using "intel" assembly syntax. The first |
| 71 line of output is a convenient comment indicating how to pipe the output to |
| 72 ``llvm-mc`` to produce object code. |
OLD | NEW |