summaryrefslogtreecommitdiffstats
path: root/lld/COFF/MarkLive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/COFF/MarkLive.cpp')
-rw-r--r--lld/COFF/MarkLive.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/lld/COFF/MarkLive.cpp b/lld/COFF/MarkLive.cpp
index 50e41ba1506..0543d0ee2de 100644
--- a/lld/COFF/MarkLive.cpp
+++ b/lld/COFF/MarkLive.cpp
@@ -15,57 +15,57 @@
namespace lld {
namespace coff {
-static Timer GCTimer("GC", Timer::root());
+static Timer gCTimer("GC", Timer::root());
// Set live bit on for each reachable chunk. Unmarked (unreachable)
// COMDAT chunks will be ignored by Writer, so they will be excluded
// from the final output.
-void markLive(ArrayRef<Chunk *> Chunks) {
- ScopedTimer T(GCTimer);
+void markLive(ArrayRef<Chunk *> chunks) {
+ ScopedTimer t(gCTimer);
// We build up a worklist of sections which have been marked as live. We only
// push into the worklist when we discover an unmarked section, and we mark
// as we push, so sections never appear twice in the list.
- SmallVector<SectionChunk *, 256> Worklist;
+ SmallVector<SectionChunk *, 256> worklist;
// COMDAT section chunks are dead by default. Add non-COMDAT chunks.
- for (Chunk *C : Chunks)
- if (auto *SC = dyn_cast<SectionChunk>(C))
- if (SC->Live)
- Worklist.push_back(SC);
+ for (Chunk *c : chunks)
+ if (auto *sc = dyn_cast<SectionChunk>(c))
+ if (sc->live)
+ worklist.push_back(sc);
- auto Enqueue = [&](SectionChunk *C) {
- if (C->Live)
+ auto enqueue = [&](SectionChunk *c) {
+ if (c->live)
return;
- C->Live = true;
- Worklist.push_back(C);
+ c->live = true;
+ worklist.push_back(c);
};
- auto AddSym = [&](Symbol *B) {
- if (auto *Sym = dyn_cast<DefinedRegular>(B))
- Enqueue(Sym->getChunk());
- else if (auto *Sym = dyn_cast<DefinedImportData>(B))
- Sym->File->Live = true;
- else if (auto *Sym = dyn_cast<DefinedImportThunk>(B))
- Sym->WrappedSym->File->Live = Sym->WrappedSym->File->ThunkLive = true;
+ auto addSym = [&](Symbol *b) {
+ if (auto *sym = dyn_cast<DefinedRegular>(b))
+ enqueue(sym->getChunk());
+ else if (auto *sym = dyn_cast<DefinedImportData>(b))
+ sym->file->live = true;
+ else if (auto *sym = dyn_cast<DefinedImportThunk>(b))
+ sym->wrappedSym->file->live = sym->wrappedSym->file->thunkLive = true;
};
// Add GC root chunks.
- for (Symbol *B : Config->GCRoot)
- AddSym(B);
+ for (Symbol *b : config->gCRoot)
+ addSym(b);
- while (!Worklist.empty()) {
- SectionChunk *SC = Worklist.pop_back_val();
- assert(SC->Live && "We mark as live when pushing onto the worklist!");
+ while (!worklist.empty()) {
+ SectionChunk *sc = worklist.pop_back_val();
+ assert(sc->live && "We mark as live when pushing onto the worklist!");
// Mark all symbols listed in the relocation table for this section.
- for (Symbol *B : SC->symbols())
- if (B)
- AddSym(B);
+ for (Symbol *b : sc->symbols())
+ if (b)
+ addSym(b);
// Mark associative sections if any.
- for (SectionChunk &C : SC->children())
- Enqueue(&C);
+ for (SectionChunk &c : sc->children())
+ enqueue(&c);
}
}
OpenPOWER on IntegriCloud