OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import driver_tools | 6 import driver_tools |
7 import filetype | 7 import filetype |
8 import ldtools | 8 import ldtools |
9 import multiprocessing | 9 import multiprocessing |
10 import os | 10 import os |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 '${USE_DEFAULTLIBS ? ${DEFAULTLIBS}} ' + | 83 '${USE_DEFAULTLIBS ? ${DEFAULTLIBS}} ' + |
84 '--end-group ' + | 84 '--end-group ' + |
85 '${CRTEND}', | 85 '${CRTEND}', |
86 | 86 |
87 'DEFAULTLIBS': '${ALLOW_ZEROCOST_CXX_EH ? -l:libgcc_eh.a} ' + | 87 'DEFAULTLIBS': '${ALLOW_ZEROCOST_CXX_EH ? -l:libgcc_eh.a} ' + |
88 '-l:libgcc.a -l:libcrt_platform.a ', | 88 '-l:libgcc.a -l:libcrt_platform.a ', |
89 | 89 |
90 # BE CAREFUL: anything added here can introduce skew between | 90 # BE CAREFUL: anything added here can introduce skew between |
91 # the pnacl-translate commandline tool and the in-browser translator. | 91 # the pnacl-translate commandline tool and the in-browser translator. |
92 # See: llvm/tools/pnacl-llc/srpc_main.cpp and | 92 # See: llvm/tools/pnacl-llc/srpc_main.cpp and |
93 # chromium/src/ppapi/native_client/src/trusted/plugin/pnacl_options.cc | 93 # Chromium's plugin/pnacl_translate_thread.cc |
94 'LLC_FLAGS_COMMON': '${PIC ? -relocation-model=pic} ' + | 94 'LLC_FLAGS_COMMON': '${PIC ? -relocation-model=pic} ' + |
95 # -force-tls-non-pic makes the code generator (llc) | 95 # -force-tls-non-pic makes the code generator (llc) |
96 # do the work that would otherwise be done by | 96 # do the work that would otherwise be done by |
97 # linker rewrites which are quite messy in the nacl | 97 # linker rewrites which are quite messy in the nacl |
98 # case and hence have not been implemented in gold | 98 # case and hence have not been implemented in gold |
99 '${PIC ? -force-tls-non-pic} ', | 99 '${PIC ? -force-tls-non-pic} ', |
100 | 100 |
101 # LLC flags which set the target and output type. | 101 # LLC flags which set the target and output type. |
102 'LLC_FLAGS_TARGET' : '-mtriple=${TRIPLE} -filetype=${outfiletype}', | 102 'LLC_FLAGS_TARGET' : '-mtriple=${TRIPLE} -filetype=${outfiletype}', |
103 | 103 |
104 # Append additional non-default flags here. | 104 # Append additional non-default flags here. |
105 # BE CAREFUL: anything added here can introduce skew between | 105 # BE CAREFUL: anything added here can introduce skew between |
106 # the pnacl-translate commandline tool and the in-browser translator. | 106 # the pnacl-translate commandline tool and the in-browser translator. |
107 # See: llvm/tools/pnacl-llc/srpc_main.cpp and | 107 # See: llvm/tools/pnacl-llc/srpc_main.cpp and |
108 # chromium/src/ppapi/native_client/src/trusted/plugin/pnacl_options.cc | 108 # Chromium's plugin/pnacl_translate_thread.cc |
109 'LLC_FLAGS_EXTRA' : '${FAST_TRANSLATION ? ${LLC_FLAGS_FAST}} ' + | 109 'LLC_FLAGS_EXTRA' : '${FAST_TRANSLATION ? ${LLC_FLAGS_FAST}} ' + |
110 '${#OPT_LEVEL ? -O${OPT_LEVEL}} ' + | 110 '${#OPT_LEVEL ? -O${OPT_LEVEL}} ' + |
111 '${OPT_LEVEL == 0 ? -disable-fp-elim}', | 111 '${OPT_LEVEL == 0 ? -disable-fp-elim}', |
112 | 112 |
113 # Opt level from command line (if any) | 113 # Opt level from command line (if any) |
114 'OPT_LEVEL' : '', | 114 'OPT_LEVEL' : '', |
115 | 115 |
116 # faster translation == slower code | 116 # faster translation == slower code |
117 'LLC_FLAGS_FAST' : '-O0' | 117 'LLC_FLAGS_FAST' : '-O0' |
118 # This, surprisingly, makes a measurable difference | 118 # This, surprisingly, makes a measurable difference |
(...skipping 29 matching lines...) Expand all Loading... |
148 | 148 |
149 ( '-pso', "env.set('TRANSLATE_PSO', '1')"), | 149 ( '-pso', "env.set('TRANSLATE_PSO', '1')"), |
150 | 150 |
151 ( '-S', "env.set('OUTPUT_TYPE', 's')"), # Stop at .s | 151 ( '-S', "env.set('OUTPUT_TYPE', 's')"), # Stop at .s |
152 ( '-c', "env.set('OUTPUT_TYPE', 'o')"), # Stop at .o | 152 ( '-c', "env.set('OUTPUT_TYPE', 'o')"), # Stop at .o |
153 | 153 |
154 # Expose a very limited set of llc flags. | 154 # Expose a very limited set of llc flags. |
155 # BE CAREFUL: anything added here can introduce skew between | 155 # BE CAREFUL: anything added here can introduce skew between |
156 # the pnacl-translate commandline tool and the in-browser translator. | 156 # the pnacl-translate commandline tool and the in-browser translator. |
157 # See: llvm/tools/pnacl-llc/srpc_main.cpp and | 157 # See: llvm/tools/pnacl-llc/srpc_main.cpp and |
158 # chromium/src/ppapi/native_client/src/trusted/plugin/pnacl_options.cc | 158 # Chromium's plugin/pnacl_translate_thread.cc |
159 ( '(-sfi-.+)', "env.append('LLC_FLAGS_EXTRA', $0)"), | 159 ( '(-sfi-.+)', "env.append('LLC_FLAGS_EXTRA', $0)"), |
160 ( '(-mtls-use-call)', "env.append('LLC_FLAGS_EXTRA', $0)"), | 160 ( '(-mtls-use-call)', "env.append('LLC_FLAGS_EXTRA', $0)"), |
161 ( '(-force-align-stack)', "env.append('LLC_FLAGS_EXTRA', $0)"), | 161 ( '(-force-align-stack)', "env.append('LLC_FLAGS_EXTRA', $0)"), |
162 # These flags are usually used for linktime dead code/data | 162 # These flags are usually used for linktime dead code/data |
163 # removal but also help with reloc overflows on ARM | 163 # removal but also help with reloc overflows on ARM |
164 ( '(-fdata-sections)', "env.append('LLC_FLAGS_EXTRA', '-data-sections')"), | 164 ( '(-fdata-sections)', "env.append('LLC_FLAGS_EXTRA', '-data-sections')"), |
165 ( '(-ffunction-sections)', | 165 ( '(-ffunction-sections)', |
166 "env.append('LLC_FLAGS_EXTRA', '-function-sections')"), | 166 "env.append('LLC_FLAGS_EXTRA', '-function-sections')"), |
167 ( '(--gc-sections)', "env.append('LD_FLAGS', $0)"), | 167 ( '(--gc-sections)', "env.append('LD_FLAGS', $0)"), |
168 ( '(-mattr=.*)', "env.append('LLC_FLAGS_EXTRA', $0)"), | 168 ( '(-mattr=.*)', "env.append('LLC_FLAGS_EXTRA', $0)"), |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 538 |
539 ADVANCED OPTIONS: | 539 ADVANCED OPTIONS: |
540 -mattr=<+feat1,-feat2> Toggle specific cpu features on and off. | 540 -mattr=<+feat1,-feat2> Toggle specific cpu features on and off. |
541 -mcpu=<cpu-name> Target a specific cpu type. Tunes code as well as | 541 -mcpu=<cpu-name> Target a specific cpu type. Tunes code as well as |
542 turns cpu features on and off. | 542 turns cpu features on and off. |
543 -S Generate native assembly only. | 543 -S Generate native assembly only. |
544 -c Generate native object file only. | 544 -c Generate native object file only. |
545 --pnacl-sb Use the translator which runs inside the NaCl sandbox. | 545 --pnacl-sb Use the translator which runs inside the NaCl sandbox. |
546 -O[0-3] Change translation-time optimization level. | 546 -O[0-3] Change translation-time optimization level. |
547 """ | 547 """ |
OLD | NEW |