[PATCH] D44441: [WebAssembly] Replace varargs debugPrint with standard log call
Nicholas Wilson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 14 06:52:51 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL327507: [WebAssembly] Replace varargs debugPrint with standard log call (authored by ncw, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D44441
Files:
lld/trunk/wasm/Writer.cpp
Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -143,16 +143,6 @@
} // anonymous namespace
-static void debugPrint(const char *fmt, ...) {
- if (!errorHandler().Verbose)
- return;
- fprintf(stderr, "lld: ");
- va_list ap;
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-}
-
void Writer::createImportSection() {
uint32_t NumImports = ImportedSymbols.size();
if (Config->ImportMemory)
@@ -568,7 +558,7 @@
void Writer::layoutMemory() {
uint32_t MemoryPtr = 0;
MemoryPtr = Config->GlobalBase;
- debugPrint("mem: global base = %d\n", Config->GlobalBase);
+ log("mem: global base = " + Twine(Config->GlobalBase));
createOutputSegments();
@@ -580,38 +570,38 @@
for (OutputSegment *Seg : Segments) {
MemoryPtr = alignTo(MemoryPtr, Seg->Alignment);
Seg->StartVA = MemoryPtr;
- debugPrint("mem: %-15s offset=%-8d size=%-8d align=%d\n",
- Seg->Name.str().c_str(), MemoryPtr, Seg->Size, Seg->Alignment);
+ log(formatv("mem: {0,-15} offset={1,-8} size={2,-8} align={3}", Seg->Name,
+ MemoryPtr, Seg->Size, Seg->Alignment));
MemoryPtr += Seg->Size;
}
// TODO: Add .bss space here.
if (WasmSym::DataEnd)
WasmSym::DataEnd->setVirtualAddress(MemoryPtr);
- debugPrint("mem: static data = %d\n", MemoryPtr - Config->GlobalBase);
+ log("mem: static data = " + Twine(MemoryPtr - Config->GlobalBase));
// Stack comes after static data and bss
if (!Config->Relocatable) {
MemoryPtr = alignTo(MemoryPtr, kStackAlignment);
if (Config->ZStackSize != alignTo(Config->ZStackSize, kStackAlignment))
error("stack size must be " + Twine(kStackAlignment) + "-byte aligned");
- debugPrint("mem: stack size = %d\n", Config->ZStackSize);
- debugPrint("mem: stack base = %d\n", MemoryPtr);
+ log("mem: stack size = " + Twine(Config->ZStackSize));
+ log("mem: stack base = " + Twine(MemoryPtr));
MemoryPtr += Config->ZStackSize;
WasmSym::StackPointer->Global->Global.InitExpr.Value.Int32 = MemoryPtr;
- debugPrint("mem: stack top = %d\n", MemoryPtr);
+ log("mem: stack top = " + Twine(MemoryPtr));
// Set `__heap_base` to directly follow the end of the stack. We don't
// allocate any heap memory up front, but instead really on the malloc/brk
// implementation growing the memory at runtime.
WasmSym::HeapBase->setVirtualAddress(MemoryPtr);
- debugPrint("mem: heap base = %d\n", MemoryPtr);
+ log("mem: heap base = " + Twine(MemoryPtr));
}
uint32_t MemSize = alignTo(MemoryPtr, WasmPageSize);
NumMemoryPages = MemSize / WasmPageSize;
- debugPrint("mem: total pages = %d\n", NumMemoryPages);
+ log("mem: total pages = " + Twine(NumMemoryPages));
}
SyntheticSection *Writer::createSyntheticSection(uint32_t Type,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44441.138342.patch
Type: text/x-patch
Size: 2929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180314/dd63be47/attachment.bin>
More information about the llvm-commits
mailing list