From 96ba8befa9aed3a771d022057061be607ca1618e Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 5 Apr 2018 19:37:48 +0000 Subject: [PATCH] [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 --- lld/wasm/Driver.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index 97a8159..21d4b37 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -57,7 +57,6 @@ private: void addFile(StringRef Path); void addLibrary(StringRef Name); std::vector Files; - llvm::wasm::WasmGlobal StackPointerGlobal; }; } // anonymous namespace @@ -336,10 +335,11 @@ void LinkerDriver::link(ArrayRef 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(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(Global); StackPointer->Live = true; static WasmSignature NullSignature = {{}, WASM_TYPE_NORESULT}; -- 2.7.4