summaryrefslogtreecommitdiffstats
path: root/lld/wasm/MarkLive.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-02-19 22:34:47 +0000
committerRui Ueyama <ruiu@google.com>2018-02-19 22:34:47 +0000
commit34133b23e4ac36d686f4db582e63f8ce7946c31f (patch)
treecf405c430362e2738125e91878da0e9ee2faff0d /lld/wasm/MarkLive.cpp
parent81bee04bf9abf3fa71a7cc4813bf4b483749adca (diff)
downloadbcm5719-llvm-34133b23e4ac36d686f4db582e63f8ce7946c31f.tar.gz
bcm5719-llvm-34133b23e4ac36d686f4db582e63f8ce7946c31f.zip
[WebAssembly] Expand a lambda that is used only once.
Differential Revision: https://reviews.llvm.org/D43435 llvm-svn: 325536
Diffstat (limited to 'lld/wasm/MarkLive.cpp')
-rw-r--r--lld/wasm/MarkLive.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp
index bba1b9d8b35..1e00ca04ea2 100644
--- a/lld/wasm/MarkLive.cpp
+++ b/lld/wasm/MarkLive.cpp
@@ -61,33 +61,33 @@ void lld::wasm::markLive() {
// The ctor functions are all used in the synthetic __wasm_call_ctors
// function, but since this function is created in-place it doesn't contain
- // reloctations which mean we have to manually mark the ctors.
+ // relocations which mean we have to manually mark the ctors.
for (const ObjFile *Obj : Symtab->ObjectFiles) {
const WasmLinkingData &L = Obj->getWasmObj()->linkingData();
for (const WasmInitFunc &F : L.InitFunctions)
Enqueue(Obj->getFunctionSymbol(F.FunctionIndex));
}
- auto EnqueueSuccessors = [Enqueue](InputChunk &Chunk) {
- for (const WasmRelocation Reloc : Chunk.getRelocations()) {
+ // Follow relocations to mark all reachable chunks.
+ while (!Q.empty()) {
+ InputChunk *C = Q.pop_back_val();
+
+ for (const WasmRelocation Reloc : C->getRelocations()) {
switch (Reloc.Type) {
case R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
case R_WEBASSEMBLY_TABLE_INDEX_I32:
case R_WEBASSEMBLY_TABLE_INDEX_SLEB:
- Enqueue(Chunk.File->getFunctionSymbol(Reloc.Index));
+ Enqueue(C->File->getFunctionSymbol(Reloc.Index));
break;
case R_WEBASSEMBLY_GLOBAL_INDEX_LEB:
case R_WEBASSEMBLY_MEMORY_ADDR_LEB:
case R_WEBASSEMBLY_MEMORY_ADDR_SLEB:
case R_WEBASSEMBLY_MEMORY_ADDR_I32:
- Enqueue(Chunk.File->getGlobalSymbol(Reloc.Index));
+ Enqueue(C->File->getGlobalSymbol(Reloc.Index));
break;
}
}
- };
-
- while (!Q.empty())
- EnqueueSuccessors(*Q.pop_back_val());
+ }
// Report garbage-collected sections.
if (Config->PrintGcSections) {
OpenPOWER on IntegriCloud