[WebAssembly] Remove StackPointerGlobal member variable from the driver.

Since InputGlobal makes a copy of a given object, we can use a temporary
object allocated on the stack here.

Differential Revision: https://reviews.llvm.org/D43924

llvm-svn: 329337
This commit is contained in:
Rui Ueyama 2018-04-05 19:37:48 +00:00
parent ac95bb1d52
commit 96ba8befa9

View File

@ -57,7 +57,6 @@ private:
void addFile(StringRef Path);
void addLibrary(StringRef Name);
std::vector<InputFile *> Files;
llvm::wasm::WasmGlobal StackPointerGlobal;
};
} // anonymous namespace
@ -336,10 +335,11 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) {
// globals aren't yet supported in the official binary format.
// TODO(sbc): Remove WASM_SYMBOL_VISIBILITY_HIDDEN if/when the
// "mutable global" proposal is accepted.
StackPointerGlobal.Type = {WASM_TYPE_I32, true};
StackPointerGlobal.InitExpr.Value.Int32 = 0;
StackPointerGlobal.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
InputGlobal *StackPointer = make<InputGlobal>(StackPointerGlobal);
llvm::wasm::WasmGlobal Global;
Global.Type = {WASM_TYPE_I32, true};
Global.InitExpr.Value.Int32 = 0;
Global.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
InputGlobal *StackPointer = make<InputGlobal>(Global);
StackPointer->Live = true;
static WasmSignature NullSignature = {{}, WASM_TYPE_NORESULT};