From: Dan Gohman Date: Sat, 3 Dec 2016 23:00:12 +0000 (+0000) Subject: [WebAssembly] Eliminate an ad-hoc command-line argument. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a88a6dddfcc1dc2bc5970ffd9d055d958149ea5;p=llvm [WebAssembly] Eliminate an ad-hoc command-line argument. Use the target triple to determine whether to run the explicit-locals pass, rather than using a separate command-line argument. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288602 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp b/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp index 56b0f4fb684..04ede7ff110 100644 --- a/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp +++ b/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp @@ -146,6 +146,11 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) { "********** Function: " << MF.getName() << '\n'); + // Disable this pass if we aren't doing direct wasm object emission. + if (MF.getSubtarget() + .getTargetTriple().isOSBinFormatELF()) + return false; + bool Changed = false; MachineRegisterInfo &MRI = MF.getRegInfo(); WebAssemblyFunctionInfo &MFI = *MF.getInfo(); diff --git a/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp index f0f74e7b5e8..b61bc0a0814 100644 --- a/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp +++ b/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp @@ -41,11 +41,6 @@ static cl::opt EnableEmSjLj( cl::desc("WebAssembly Emscripten-style setjmp/longjmp handling"), cl::init(false)); -static cl::opt ExplicitLocals( - "wasm-explicit-locals", - cl::desc("WebAssembly with explicit get_local/set_local"), - cl::init(false)); - extern "C" void LLVMInitializeWebAssemblyTarget() { // Register the target. RegisterTargetMachine X( @@ -262,8 +257,7 @@ void WebAssemblyPassConfig::addPreEmitPass() { } // Insert explicit get_local and set_local operators. - if (ExplicitLocals) - addPass(createWebAssemblyExplicitLocals()); + addPass(createWebAssemblyExplicitLocals()); // Eliminate multiple-entry loops. addPass(createWebAssemblyFixIrreducibleControlFlow());