[WebAssembly] Move lambda declaration output of loop. NFC.

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

llvm-svn: 325857
This commit is contained in:
Sam Clegg 2018-02-23 04:59:57 +00:00
parent 7129ae39bd
commit 6c4dbfeec1
1 changed files with 24 additions and 22 deletions

View File

@ -759,11 +759,10 @@ void Writer::assignIndexes() {
}
}
for (ObjFile *File : Symtab->ObjectFiles) {
DEBUG(dbgs() << "Handle relocs: " << File->getName() << "\n");
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 ||
@ -774,16 +773,19 @@ void Writer::assignIndexes() {
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;
File->TypeMap[Reloc.Index] = registerType(Types[Reloc.Index]);
File->TypeIsUsed[Reloc.Index] = true;
}
}
};
for (InputFunction* Function : File->Functions)
HandleRelocs(Function);
for (InputSegment* Segment : File->Segments)
HandleRelocs(Segment);
for (ObjFile *File : Symtab->ObjectFiles) {
DEBUG(dbgs() << "Handle relocs: " << File->getName() << "\n");
for (InputChunk* Chunk : File->Functions)
HandleRelocs(Chunk);
for (InputChunk* Chunk : File->Segments)
HandleRelocs(Chunk);
}
}