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 (default x8632). |
| 39 |
| 40 ``-verbose=<list>`` -- Set verbosity flags. This argument allows |
| 41 a comma-separated list of values. The default is ``none``, and |
| 42 the value ``inst,pred`` will roughly match the .ll bitcode file. |
| 43 Of particular use are ``all`` and ``none``. |
| 44 |
| 45 See ir_samples/README.rst for more details. |
| 46 |
| 47 Running the test suite |
| 48 ---------------------- |
| 49 |
| 50 Subzero uses the LLVM ``lit`` testing tool for its test suite, which lives in |
| 51 ``tests_lit``. To execute the test suite, first build Subzero, and then run:: |
| 52 |
| 53 python <path_to_lit.py> -sv tests_lit |
| 54 |
| 55 ``path_to_lit`` is the direct path to the lit script in the LLVM source |
| 56 (``$LLVM_SRC_PATH/utils/lit/lit.py``). |
| 57 |
| 58 The above ``lit`` execution also needs the LLVM binary path in the |
| 59 ``LLVM_BIN_PATH`` env var. |
| 60 |
| 61 Assuming the LLVM paths are set up, ``make check`` is a convenient way to run |
| 62 the test suite. |
| 63 |
| 64 Assembling ``llvm2ice`` output |
| 65 ------------------------------ |
| 66 |
| 67 Currently ``llvm2ice`` produces textual assembly code in a structure |
| 68 suitable for input to ``llvm-mc`` and currently using "intel" assembly |
| 69 syntax. The first line of output is a convenient comment indicating |
| 70 how to pipe the output to ``llvm-mc`` to produce object code. |
OLD | NEW |