[llvm] r288602 - [WebAssembly] Eliminate an ad-hoc command-line argument.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 3 15:00:12 PST 2016


Author: djg
Date: Sat Dec  3 17:00:12 2016
New Revision: 288602

URL: http://llvm.org/viewvc/llvm-project?rev=288602&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
    llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp?rev=288602&r1=288601&r2=288602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp Sat Dec  3 17:00:12 2016
@@ -146,6 +146,11 @@ bool WebAssemblyExplicitLocals::runOnMac
                   "********** Function: "
                << MF.getName() << '\n');
 
+  // Disable this pass if we aren't doing direct wasm object emission.
+  if (MF.getSubtarget<WebAssemblySubtarget>()
+        .getTargetTriple().isOSBinFormatELF())
+    return false;
+
   bool Changed = false;
   MachineRegisterInfo &MRI = MF.getRegInfo();
   WebAssemblyFunctionInfo &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();

Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp?rev=288602&r1=288601&r2=288602&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp Sat Dec  3 17:00:12 2016
@@ -41,11 +41,6 @@ static cl::opt<bool> EnableEmSjLj(
     cl::desc("WebAssembly Emscripten-style setjmp/longjmp handling"),
     cl::init(false));
 
-static cl::opt<bool> ExplicitLocals(
-    "wasm-explicit-locals",
-    cl::desc("WebAssembly with explicit get_local/set_local"),
-    cl::init(false));
-
 extern "C" void LLVMInitializeWebAssemblyTarget() {
   // Register the target.
   RegisterTargetMachine<WebAssemblyTargetMachine> X(
@@ -262,8 +257,7 @@ void WebAssemblyPassConfig::addPreEmitPa
   }
 
   // Insert explicit get_local and set_local operators.
-  if (ExplicitLocals)
-    addPass(createWebAssemblyExplicitLocals());
+  addPass(createWebAssemblyExplicitLocals());
 
   // Eliminate multiple-entry loops.
   addPass(createWebAssemblyFixIrreducibleControlFlow());




More information about the llvm-commits mailing list