@@ -452,7 +452,7 @@ def link_to_object(linker_inputs, target):
452452 # other otherwise for linking of bitcode we must use our python
453453 # code (necessary for asm.js, for wasm bitcode see
454454 # https://bugs.llvm.org/show_bug.cgi?id=40654)
455- if Settings . WASM_BACKEND and not Settings .LTO :
455+ if not Settings .LTO :
456456 link_lld (linker_inputs + ['--relocatable' ], target )
457457 else :
458458 link (linker_inputs , target )
@@ -743,13 +743,6 @@ def llvm_opt(filename, opts, out=None):
743743 assert out , 'must provide out if llvm_opt on a list of inputs'
744744 assert len (opts ), 'should not call opt with nothing to do'
745745 opts = opts [:]
746- # TODO: disable inlining when needed
747- # if not can_inline():
748- # opts.append('-disable-inlining')
749- # opts += ['-debug-pass=Arguments']
750- # TODO: move vectorization logic to clang/LLVM?
751- if not Settings .WASM_BACKEND :
752- opts += ['-disable-loop-vectorization' , '-disable-slp-vectorization' , '-vectorize-loops=false' , '-vectorize-slp=false' ]
753746
754747 target = out or (filename + '.opt.bc' )
755748 cmd = [LLVM_OPT ] + inputs + opts + ['-o' , target ]
@@ -868,19 +861,6 @@ def is_wasm_only():
868861 if not Settings .WASM :
869862 return False
870863 # llvm backend can only ever produce wasm
871- if Settings .WASM_BACKEND :
872- return True
873- # fastcomp can emit wasm-only code.
874- # also disable this mode if it depends on special optimizations that are not yet
875- # compatible with it.
876- if not Settings .LEGALIZE_JS_FFI :
877- # the user has requested no legalization for JS, and so we are not
878- # emitting code compatible with JS, and there is no reason not to
879- # be wasm-only, regardless of everything else
880- return True
881- if Settings .RUNNING_JS_OPTS :
882- # if the JS optimizer runs, it must run on valid asm.js
883- return False
884864 return True
885865
886866
@@ -962,14 +942,14 @@ def acorn_optimizer(filename, passes, extra_info=None, return_output=False):
962942# evals ctors. if binaryen_bin is provided, it is the dir of the binaryen tool
963943# for this, and we are in wasm mode
964944def eval_ctors (js_file , binary_file , binaryen_bin = '' , debug_info = False ):
965- if Settings . WASM_BACKEND :
966- logger . debug ( 'Ctor evalling in the wasm backend is disabled due to https://github.com/emscripten-core/emscripten/issues/9527' )
967- return
968- cmd = [PYTHON , path_from_root ('tools' , 'ctor_evaller.py' ), js_file , binary_file , str (Settings .INITIAL_MEMORY ), str (Settings .TOTAL_STACK ), str (Settings .GLOBAL_BASE ), binaryen_bin , str (int (debug_info ))]
969- if binaryen_bin :
970- cmd += get_binaryen_feature_flags ()
971- print_compiler_stage (cmd )
972- check_call (cmd )
945+ logger . debug ( 'Ctor evalling in the wasm backend is disabled due to https://github.com/emscripten-core/emscripten/issues/9527' )
946+ return
947+ # TODO re-enable
948+ # cmd = [PYTHON, path_from_root('tools', 'ctor_evaller.py'), js_file, binary_file, str(Settings.INITIAL_MEMORY), str(Settings.TOTAL_STACK), str(Settings.GLOBAL_BASE), binaryen_bin, str(int(debug_info))]
949+ # if binaryen_bin:
950+ # cmd += get_binaryen_feature_flags()
951+ # print_compiler_stage(cmd)
952+ # check_call(cmd)
973953
974954
975955def calculate_reachable_functions (infile , initial_list , can_reach = True ):
@@ -1235,8 +1215,7 @@ def metadce(js_file, wasm_file, minify_whitespace, debug_info):
12351215 if 'export' in item :
12361216 export = item ['export' ]
12371217 # wasm backend's exports are prefixed differently inside the wasm
1238- if Settings .WASM_BACKEND :
1239- export = asmjs_mangle (export )
1218+ export = asmjs_mangle (export )
12401219 if export in user_requested_exports or Settings .EXPORT_ALL :
12411220 item ['root' ] = True
12421221 # in standalone wasm, always export the memory
@@ -1266,12 +1245,11 @@ def metadce(js_file, wasm_file, minify_whitespace, debug_info):
12661245 for item in graph :
12671246 if 'import' in item and item ['import' ][1 ][1 :] in WASI_IMPORTS :
12681247 item ['import' ][0 ] = Settings .WASI_MODULE_NAME
1269- if Settings .WASM_BACKEND :
1270- # wasm backend's imports are prefixed differently inside the wasm
1271- for item in graph :
1272- if 'import' in item :
1273- if item ['import' ][1 ][0 ] == '_' :
1274- item ['import' ][1 ] = item ['import' ][1 ][1 :]
1248+ # fixup wasm backend prefixing
1249+ for item in graph :
1250+ if 'import' in item :
1251+ if item ['import' ][1 ][0 ] == '_' :
1252+ item ['import' ][1 ] = item ['import' ][1 ][1 :]
12751253 # map import names from wasm to JS, using the actual name the wasm uses for the import
12761254 import_name_map = {}
12771255 for item in graph :
@@ -1579,9 +1557,6 @@ def path_to_system_js_libraries(library_name):
15791557
15801558 elif library_name .endswith ('.js' ) and os .path .isfile (path_from_root ('src' , 'library_' + library_name )):
15811559 library_files += ['library_' + library_name ]
1582- elif not Settings .WASM_BACKEND :
1583- # The wasm backend will report these when wasm-ld runs
1584- exit_with_error ('emcc: cannot find library "%s"' , library_name )
15851560
15861561 return library_files
15871562
0 commit comments