[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
This commit is contained in:
Dan Gohman 2016-12-03 23:00:12 +00:00
parent 46db4b27f2
commit 2a88a6dddf
2 changed files with 6 additions and 7 deletions

View File

@ -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<WebAssemblySubtarget>()
.getTargetTriple().isOSBinFormatELF())
return false;
bool Changed = false;
MachineRegisterInfo &MRI = MF.getRegInfo();
WebAssemblyFunctionInfo &MFI = *MF.getInfo<WebAssemblyFunctionInfo>();

View File

@ -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::addPreEmitPass() {
}
// Insert explicit get_local and set_local operators.
if (ExplicitLocals)
addPass(createWebAssemblyExplicitLocals());
addPass(createWebAssemblyExplicitLocals());
// Eliminate multiple-entry loops.
addPass(createWebAssemblyFixIrreducibleControlFlow());