[PATCH] D43534: [WebAssembly] Move lambda declaration output of loop

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 21:04:11 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 rLLD325857: [WebAssembly] Move lambda declaration output of loop. NFC. (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43534?vs=135167&id=135588#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43534

Files:
  wasm/Writer.cpp


Index: wasm/Writer.cpp
===================================================================
--- wasm/Writer.cpp
+++ wasm/Writer.cpp
@@ -759,31 +759,33 @@
     }
   }
 
+  auto HandleRelocs = [&](InputChunk *Chunk) {
+    if (!Chunk->Live)
+      return;
+    ObjFile *File = Chunk->File;
+    ArrayRef<WasmSignature> Types = File->getWasmObj()->types();
+    for (const WasmRelocation& Reloc : Chunk->getRelocations()) {
+      if (Reloc.Type == R_WEBASSEMBLY_TABLE_INDEX_I32 ||
+          Reloc.Type == R_WEBASSEMBLY_TABLE_INDEX_SLEB) {
+        FunctionSymbol *Sym = File->getFunctionSymbol(Reloc.Index);
+        if (Sym->hasTableIndex() || !Sym->hasOutputIndex())
+          continue;
+        Sym->setTableIndex(TableIndex++);
+        IndirectFunctions.emplace_back(Sym);
+      } else if (Reloc.Type == R_WEBASSEMBLY_TYPE_INDEX_LEB) {
+        File->TypeMap[Reloc.Index] = registerType(Types[Reloc.Index]);
+        File->TypeIsUsed[Reloc.Index] = true;
+      }
+    }
+  };
+
   for (ObjFile *File : Symtab->ObjectFiles) {
     DEBUG(dbgs() << "Handle relocs: " << File->getName() << "\n");
-    auto HandleRelocs = [&](InputChunk *Chunk) {
-      if (!Chunk->Live)
-        return;
-      ArrayRef<WasmSignature> Types = File->getWasmObj()->types();
-      for (const WasmRelocation& Reloc : Chunk->getRelocations()) {
-        if (Reloc.Type == R_WEBASSEMBLY_TABLE_INDEX_I32 ||
-            Reloc.Type == R_WEBASSEMBLY_TABLE_INDEX_SLEB) {
-          FunctionSymbol *Sym = File->getFunctionSymbol(Reloc.Index);
-          if (Sym->hasTableIndex() || !Sym->hasOutputIndex())
-            continue;
-          Sym->setTableIndex(TableIndex++);
-          IndirectFunctions.emplace_back(Sym);
-        } else if (Reloc.Type == R_WEBASSEMBLY_TYPE_INDEX_LEB) {
-          Chunk->File->TypeMap[Reloc.Index] = registerType(Types[Reloc.Index]);
-          Chunk->File->TypeIsUsed[Reloc.Index] = true;
-        }
-      }
-    };
 
-    for (InputFunction* Function : File->Functions)
-      HandleRelocs(Function);
-    for (InputSegment* Segment : File->Segments)
-      HandleRelocs(Segment);
+    for (InputChunk* Chunk : File->Functions)
+      HandleRelocs(Chunk);
+    for (InputChunk* Chunk : File->Segments)
+      HandleRelocs(Chunk);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43534.135588.patch
Type: text/x-patch
Size: 2255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180223/170b6a63/attachment.bin>


More information about the llvm-commits mailing list