diff --git a/tools/building.py b/tools/building.py index 5fded4a2562a8..eec4524eb4531 100644 --- a/tools/building.py +++ b/tools/building.py @@ -452,7 +452,7 @@ def link_to_object(linker_inputs, target): # other otherwise for linking of bitcode we must use our python # code (necessary for asm.js, for wasm bitcode see # https://bugs.llvm.org/show_bug.cgi?id=40654) - if Settings.WASM_BACKEND and not Settings.LTO: + if not Settings.LTO: link_lld(linker_inputs + ['--relocatable'], target) else: link(linker_inputs, target) @@ -743,13 +743,6 @@ def llvm_opt(filename, opts, out=None): assert out, 'must provide out if llvm_opt on a list of inputs' assert len(opts), 'should not call opt with nothing to do' opts = opts[:] - # TODO: disable inlining when needed - # if not can_inline(): - # opts.append('-disable-inlining') - # opts += ['-debug-pass=Arguments'] - # TODO: move vectorization logic to clang/LLVM? - if not Settings.WASM_BACKEND: - opts += ['-disable-loop-vectorization', '-disable-slp-vectorization', '-vectorize-loops=false', '-vectorize-slp=false'] target = out or (filename + '.opt.bc') cmd = [LLVM_OPT] + inputs + opts + ['-o', target] @@ -868,19 +861,6 @@ def is_wasm_only(): if not Settings.WASM: return False # llvm backend can only ever produce wasm - if Settings.WASM_BACKEND: - return True - # fastcomp can emit wasm-only code. - # also disable this mode if it depends on special optimizations that are not yet - # compatible with it. - if not Settings.LEGALIZE_JS_FFI: - # the user has requested no legalization for JS, and so we are not - # emitting code compatible with JS, and there is no reason not to - # be wasm-only, regardless of everything else - return True - if Settings.RUNNING_JS_OPTS: - # if the JS optimizer runs, it must run on valid asm.js - return False return True @@ -962,14 +942,14 @@ def acorn_optimizer(filename, passes, extra_info=None, return_output=False): # evals ctors. if binaryen_bin is provided, it is the dir of the binaryen tool # for this, and we are in wasm mode def eval_ctors(js_file, binary_file, binaryen_bin='', debug_info=False): - if Settings.WASM_BACKEND: - logger.debug('Ctor evalling in the wasm backend is disabled due to https://github.com/emscripten-core/emscripten/issues/9527') - return - 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))] - if binaryen_bin: - cmd += get_binaryen_feature_flags() - print_compiler_stage(cmd) - check_call(cmd) + logger.debug('Ctor evalling in the wasm backend is disabled due to https://github.com/emscripten-core/emscripten/issues/9527') + return + # TODO re-enable + # 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))] + # if binaryen_bin: + # cmd += get_binaryen_feature_flags() + # print_compiler_stage(cmd) + # check_call(cmd) def calculate_reachable_functions(infile, initial_list, can_reach=True): @@ -1235,8 +1215,7 @@ def metadce(js_file, wasm_file, minify_whitespace, debug_info): if 'export' in item: export = item['export'] # wasm backend's exports are prefixed differently inside the wasm - if Settings.WASM_BACKEND: - export = asmjs_mangle(export) + export = asmjs_mangle(export) if export in user_requested_exports or Settings.EXPORT_ALL: item['root'] = True # in standalone wasm, always export the memory @@ -1266,12 +1245,11 @@ def metadce(js_file, wasm_file, minify_whitespace, debug_info): for item in graph: if 'import' in item and item['import'][1][1:] in WASI_IMPORTS: item['import'][0] = Settings.WASI_MODULE_NAME - if Settings.WASM_BACKEND: - # wasm backend's imports are prefixed differently inside the wasm - for item in graph: - if 'import' in item: - if item['import'][1][0] == '_': - item['import'][1] = item['import'][1][1:] + # fixup wasm backend prefixing + for item in graph: + if 'import' in item: + if item['import'][1][0] == '_': + item['import'][1] = item['import'][1][1:] # map import names from wasm to JS, using the actual name the wasm uses for the import import_name_map = {} for item in graph: @@ -1579,9 +1557,6 @@ def path_to_system_js_libraries(library_name): elif library_name.endswith('.js') and os.path.isfile(path_from_root('src', 'library_' + library_name)): library_files += ['library_' + library_name] - elif not Settings.WASM_BACKEND: - # The wasm backend will report these when wasm-ld runs - exit_with_error('emcc: cannot find library "%s"', library_name) return library_files diff --git a/tools/cache.py b/tools/cache.py index 6b267f4cf03ec..cb3699c2335c6 100644 --- a/tools/cache.py +++ b/tools/cache.py @@ -32,14 +32,11 @@ def __init__(self, dirname, use_subdir=True): # if relevant, use a subdir of the cache if use_subdir: - if shared.Settings.WASM_BACKEND: - subdir = 'wasm' - if shared.Settings.LTO: - subdir += '-lto' - if shared.Settings.RELOCATABLE: - subdir += '-pic' - else: - subdir = 'asmjs' + subdir = 'wasm' + if shared.Settings.LTO: + subdir += '-lto' + if shared.Settings.RELOCATABLE: + subdir += '-pic' dirname = os.path.join(dirname, subdir) self.dirname = dirname diff --git a/tools/ctor_evaller.py b/tools/ctor_evaller.py index c4398a4b74bcc..ceeebddbd7f45 100755 --- a/tools/ctor_evaller.py +++ b/tools/ctor_evaller.py @@ -61,9 +61,8 @@ def find_ctors_data(js, num): ctors_text = js[ctors_start:ctors_end] all_ctors = [ctor for ctor in ctors_text.split(' ') if ctor.endswith('()') and not ctor == 'function()' and '.' not in ctor] all_ctors = [ctor.replace('()', '') for ctor in all_ctors] - if shared.Settings.WASM_BACKEND: - assert all(ctor.startswith('_') for ctor in all_ctors) - all_ctors = [ctor[1:] for ctor in all_ctors] + assert all(ctor.startswith('_') for ctor in all_ctors) + all_ctors = [ctor[1:] for ctor in all_ctors] assert len(all_ctors) ctors = all_ctors[:num] return ctors_start, ctors_end, all_ctors, ctors diff --git a/tools/gen_struct_info.py b/tools/gen_struct_info.py index fdfbc48fb9fbe..3cdcded9bac56 100755 --- a/tools/gen_struct_info.py +++ b/tools/gen_struct_info.py @@ -408,9 +408,6 @@ def inspect_code(headers, cpp_opts, structs, defines): # TODO(sbc): Remove this one we remove the test_em_config_env_var test cmd += ['-Wno-deprecated'] - if not shared.Settings.WASM_BACKEND: - # Avoid the binaryen dependency if we are only using fastcomp - cmd += ['-s', 'WASM=0', '-Wno-fastcomp'] if shared.Settings.LTO: cmd += ['-flto=' + shared.Settings.LTO]