[PATCH] D42751: [WebAssembly] Pre-symtab tidy of LLD globals. NFC.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 11:56:35 PST 2018


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD323903: [WebAssembly] Update to match llvm change rL323901. NFC (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42751?vs=132214&id=132240#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D42751

Files:
  wasm/InputFiles.cpp
  wasm/Writer.cpp
  wasm/WriterUtils.cpp
  wasm/WriterUtils.h


Index: wasm/WriterUtils.h
===================================================================
--- wasm/WriterUtils.h
+++ wasm/WriterUtils.h
@@ -60,6 +60,8 @@
 
 void writeLimits(raw_ostream &OS, const llvm::wasm::WasmLimits &Limits);
 
+void writeGlobalType(raw_ostream &OS, const llvm::wasm::WasmGlobalType &Type);
+
 void writeGlobal(raw_ostream &OS, const llvm::wasm::WasmGlobal &Global);
 
 void writeImport(raw_ostream &OS, const llvm::wasm::WasmImport &Import);
Index: wasm/WriterUtils.cpp
===================================================================
--- wasm/WriterUtils.cpp
+++ wasm/WriterUtils.cpp
@@ -123,9 +123,13 @@
     writeUleb128(OS, Limits.Maximum, "limits max");
 }
 
+void wasm::writeGlobalType(raw_ostream &OS, const WasmGlobalType &Type) {
+  writeValueType(OS, Type.Type, "global type");
+  writeUleb128(OS, Type.Mutable, "global mutable");
+}
+
 void wasm::writeGlobal(raw_ostream &OS, const WasmGlobal &Global) {
-  writeValueType(OS, Global.Type, "global type");
-  writeUleb128(OS, Global.Mutable, "global mutable");
+  writeGlobalType(OS, Global.Type);
   writeInitExpr(OS, Global.InitExpr);
 }
 
@@ -138,8 +142,7 @@
     writeUleb128(OS, Import.SigIndex, "import sig index");
     break;
   case WASM_EXTERNAL_GLOBAL:
-    writeValueType(OS, Import.Global.Type, "import global type");
-    writeUleb128(OS, Import.Global.Mutable, "import global mutable");
+    writeGlobalType(OS, Import.Global);
     break;
   case WASM_EXTERNAL_MEMORY:
     writeLimits(OS, Import.Memory);
Index: wasm/InputFiles.cpp
===================================================================
--- wasm/InputFiles.cpp
+++ wasm/InputFiles.cpp
@@ -172,7 +172,7 @@
 uint32_t ObjFile::getGlobalValue(const WasmSymbol &Sym) const {
   const WasmGlobal &Global =
       getWasmObj()->globals()[Sym.ElementIndex - NumGlobalImports];
-  assert(Global.Type == llvm::wasm::WASM_TYPE_I32);
+  assert(Global.Type.Type == llvm::wasm::WASM_TYPE_I32);
   return Global.InitExpr.Value.Int32;
 }
 
@@ -273,7 +273,7 @@
     }
 
     Symbols.push_back(S);
-    if (WasmSym.isFunction()) {
+    if (WasmSym.isTypeFunction()) {
       FunctionSymbols[WasmSym.ElementIndex] = S;
       if (WasmSym.HasAltIndex)
         FunctionSymbols[WasmSym.AltIndex] = S;
@@ -301,7 +301,7 @@
 Symbol *ObjFile::createDefined(const WasmSymbol &Sym, Symbol::Kind Kind,
                                InputChunk *Chunk, uint32_t Address) {
   Symbol *S;
-  if (Sym.isLocal()) {
+  if (Sym.isBindingLocal()) {
     S = make<Symbol>(Sym.Name, true);
     S->update(Kind, this, Sym.Flags, Chunk, Address);
     return S;
Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -236,8 +236,8 @@
   writeUleb128(OS, DefinedGlobals.size(), "global count");
   for (const Symbol *Sym : DefinedGlobals) {
     WasmGlobal Global;
-    Global.Type = WASM_TYPE_I32;
-    Global.Mutable = Sym == Config->StackPointerSymbol;
+    Global.Type.Type = WASM_TYPE_I32;
+    Global.Type.Mutable = Sym == Config->StackPointerSymbol;
     Global.InitExpr.Opcode = WASM_OPCODE_I32_CONST;
     Global.InitExpr.Value.Int32 = Sym->getVirtualAddress();
     writeGlobal(OS, Global);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42751.132240.patch
Type: text/x-patch
Size: 3209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180131/1e6646db/attachment.bin>


More information about the llvm-commits mailing list