| 89 | |
| 90 | |
| 91 | def llvm_backend_args(): |
| 92 | # disable slow and relatively unimportant optimization passes |
| 93 | args = ['-combiner-global-alias-analysis=false'] |
| 94 | |
| 95 | # asm.js-style exception handling |
| 96 | if not settings.DISABLE_EXCEPTION_CATCHING: |
| 97 | args += ['-enable-emscripten-cxx-exceptions'] |
| 98 | if settings.EXCEPTION_CATCHING_ALLOWED: |
| 99 | # When 'main' has a non-standard signature, LLVM outlines its content out to |
| 100 | # '__original_main'. So we add it to the allowed list as well. |
| 101 | if 'main' in settings.EXCEPTION_CATCHING_ALLOWED: |
| 102 | settings.EXCEPTION_CATCHING_ALLOWED += ['__original_main', '__main_argc_argv'] |
| 103 | allowed = ','.join(settings.EXCEPTION_CATCHING_ALLOWED) |
| 104 | args += ['-emscripten-cxx-exceptions-allowed=' + allowed] |
| 105 | |
| 106 | match settings.SUPPORT_LONGJMP: |
| 107 | case 'emscripten': |
| 108 | # asm.js-style setjmp/longjmp handling |
| 109 | args += ['-enable-emscripten-sjlj'] |
| 110 | case 'wasm': |
| 111 | # setjmp/longjmp handling using Wasm EH |
| 112 | args += ['-wasm-enable-sjlj'] |
| 113 | |
| 114 | if settings.WASM_EXCEPTIONS or settings.SUPPORT_LONGJMP == 'wasm': |
| 115 | if settings.WASM_LEGACY_EXCEPTIONS: |
| 116 | args += ['-wasm-use-legacy-eh'] |
| 117 | else: |
| 118 | args += ['-wasm-use-legacy-eh=0'] |
| 119 | |
| 120 | # better (smaller, sometimes faster) codegen, see binaryen#1054 |
| 121 | # and https://bugs.llvm.org/show_bug.cgi?id=39488 |
| 122 | args += ['-disable-lsr'] |
| 123 | |
| 124 | return args |
| 125 | |
| 126 | |
| 127 | @ToolchainProfiler.profile() |