[PATCH] D43434: Define toString(wasm::InputChunk *) and use that in MarkLive.cpp.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 19 14:32:59 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL325535: [WebAssembly] Define toString(wasm::InputChunk *) and use that in MarkLive.cpp. (authored by ruiu, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D43434?vs=134822&id=134970#toc
Repository:
rL LLVM
https://reviews.llvm.org/D43434
Files:
lld/trunk/test/wasm/gc-sections.ll
lld/trunk/wasm/InputChunks.cpp
lld/trunk/wasm/InputChunks.h
lld/trunk/wasm/MarkLive.cpp
Index: lld/trunk/test/wasm/gc-sections.ll
===================================================================
--- lld/trunk/test/wasm/gc-sections.ll
+++ lld/trunk/test/wasm/gc-sections.ll
@@ -1,9 +1,9 @@
; RUN: llc -filetype=obj %s -o %t.o
; RUN: wasm-ld -print-gc-sections -o %t1.wasm %t.o | FileCheck %s -check-prefix=PRINT-GC
-; PRINT-GC: removing unused section 'unused_function' in file '{{.*}}'
-; PRINT-GC-NOT: removing unused section 'used_function' in file '{{.*}}'
-; PRINT-GC: removing unused section '.data.unused_data' in file '{{.*}}'
-; PRINT-GC-NOT: removing unused section '.data.used_data' in file '{{.*}}'
+; PRINT-GC: removing unused section {{.*}}:(unused_function)
+; PRINT-GC-NOT: removing unused section {{.*}}:(used_function)
+; PRINT-GC: removing unused section {{.*}}:(.data.unused_data)
+; PRINT-GC-NOT: removing unused section {{.*}}:(.data.used_data)
target triple = "wasm32-unknown-unknown-wasm"
Index: lld/trunk/wasm/InputChunks.h
===================================================================
--- lld/trunk/wasm/InputChunks.h
+++ lld/trunk/wasm/InputChunks.h
@@ -174,6 +174,8 @@
};
} // namespace wasm
+
+std::string toString(const wasm::InputChunk *);
} // namespace lld
#endif // LLD_WASM_INPUT_CHUNKS_H
Index: lld/trunk/wasm/InputChunks.cpp
===================================================================
--- lld/trunk/wasm/InputChunks.cpp
+++ lld/trunk/wasm/InputChunks.cpp
@@ -22,6 +22,10 @@
using namespace lld;
using namespace lld::wasm;
+std::string lld::toString(const InputChunk *C) {
+ return (toString(C->File) + ":(" + C->getName() + ")").str();
+}
+
uint32_t InputSegment::translateVA(uint32_t Address) const {
assert(Address >= startVA() && Address < endVA());
int32_t Delta = OutputSeg->StartVA + OutputSegmentOffset - startVA();
Index: lld/trunk/wasm/MarkLive.cpp
===================================================================
--- lld/trunk/wasm/MarkLive.cpp
+++ lld/trunk/wasm/MarkLive.cpp
@@ -91,17 +91,13 @@
// Report garbage-collected sections.
if (Config->PrintGcSections) {
- auto CheckChunk = [](const InputChunk *C) {
- if (!C->Live)
- message("removing unused section '" + C->getName() + "' in file '" +
- C->File->getName() + "'");
- };
-
for (const ObjFile *Obj : Symtab->ObjectFiles) {
for (InputChunk *C : Obj->Functions)
- CheckChunk(C);
+ if (!C->Live)
+ message("removing unused section " + toString(C));
for (InputChunk *C : Obj->Segments)
- CheckChunk(C);
+ if (!C->Live)
+ message("removing unused section " + toString(C));
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43434.134970.patch
Type: text/x-patch
Size: 2655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180219/660f5c9a/attachment.bin>
More information about the llvm-commits
mailing list