[lld] r325857 - [WebAssembly] Move lambda declaration output of loop. NFC.
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 20:59:57 PST 2018
Author: sbc
Date: Thu Feb 22 20:59:57 2018
New Revision: 325857
URL: http://llvm.org/viewvc/llvm-project?rev=325857&view=rev
Log:
[WebAssembly] Move lambda declaration output of loop. NFC.
Differential Revision: https://reviews.llvm.org/D43534
Modified:
lld/trunk/wasm/Writer.cpp
Modified: lld/trunk/wasm/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Writer.cpp?rev=325857&r1=325856&r2=325857&view=diff
==============================================================================
--- lld/trunk/wasm/Writer.cpp (original)
+++ lld/trunk/wasm/Writer.cpp Thu Feb 22 20:59:57 2018
@@ -759,31 +759,33 @@ void Writer::assignIndexes() {
}
}
+ 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);
}
}
More information about the llvm-commits
mailing list