Skip to content

Commit

Permalink
Replace last DEBUG occurrence with LLVM_DEBUG in lld.
Browse files Browse the repository at this point in the history
llvm-svn: 333084
  • Loading branch information
nzaghen committed May 23, 2018
1 parent c9fed13 commit 5c4fb45
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lld/wasm/InputChunks.cpp
Expand Up @@ -231,7 +231,7 @@ void InputFunction::calculateSize() {
if (!File || !Config->CompressRelocTargets)
return;

DEBUG(dbgs() << "calculateSize: " << getName() << "\n");
LLVM_DEBUG(dbgs() << "calculateSize: " << getName() << "\n");

const uint8_t *SecStart = File->CodeSection->Content.data();
const uint8_t *FuncStart = SecStart + getInputSectionOffset();
Expand All @@ -243,21 +243,21 @@ void InputFunction::calculateSize() {

uint32_t LastRelocEnd = Start + FunctionSizeLength;
for (WasmRelocation &Rel : Relocations) {
DEBUG(dbgs() << " region: " << (Rel.Offset - LastRelocEnd) << "\n");
LLVM_DEBUG(dbgs() << " region: " << (Rel.Offset - LastRelocEnd) << "\n");
CompressedFuncSize += Rel.Offset - LastRelocEnd;
CompressedFuncSize += getRelocWidth(Rel, File->calcNewValue(Rel));
LastRelocEnd = Rel.Offset + getRelocWidthPadded(Rel);
}
DEBUG(dbgs() << " final region: " << (End - LastRelocEnd) << "\n");
LLVM_DEBUG(dbgs() << " final region: " << (End - LastRelocEnd) << "\n");
CompressedFuncSize += End - LastRelocEnd;

// Now we know how long the resulting function is we can add the encoding
// of its length
uint8_t Buf[5];
CompressedSize = CompressedFuncSize + encodeULEB128(CompressedFuncSize, Buf);

DEBUG(dbgs() << " calculateSize orig: " << Function->Size << "\n");
DEBUG(dbgs() << " calculateSize new: " << CompressedSize << "\n");
LLVM_DEBUG(dbgs() << " calculateSize orig: " << Function->Size << "\n");
LLVM_DEBUG(dbgs() << " calculateSize new: " << CompressedSize << "\n");
}

// Override the default writeTo method so that we can (optionally) write the
Expand All @@ -276,20 +276,20 @@ void InputFunction::writeTo(uint8_t *Buf) const {
decodeULEB128(FuncStart, &Count);
FuncStart += Count;

DEBUG(dbgs() << "write func: " << getName() << "\n");
LLVM_DEBUG(dbgs() << "write func: " << getName() << "\n");
Buf += encodeULEB128(CompressedFuncSize, Buf);
const uint8_t *LastRelocEnd = FuncStart;
for (const WasmRelocation &Rel : Relocations) {
unsigned ChunkSize = (SecStart + Rel.Offset) - LastRelocEnd;
DEBUG(dbgs() << " write chunk: " << ChunkSize << "\n");
LLVM_DEBUG(dbgs() << " write chunk: " << ChunkSize << "\n");
memcpy(Buf, LastRelocEnd, ChunkSize);
Buf += ChunkSize;
Buf += writeCompressedReloc(Buf, Rel, File->calcNewValue(Rel));
LastRelocEnd = SecStart + Rel.Offset + getRelocWidthPadded(Rel);
}

unsigned ChunkSize = End - LastRelocEnd;
DEBUG(dbgs() << " write final chunk: " << ChunkSize << "\n");
LLVM_DEBUG(dbgs() << " write final chunk: " << ChunkSize << "\n");
memcpy(Buf, LastRelocEnd, ChunkSize);
DEBUG(dbgs() << " total: " << (Buf + ChunkSize - Orig) << "\n");
LLVM_DEBUG(dbgs() << " total: " << (Buf + ChunkSize - Orig) << "\n");
}

0 comments on commit 5c4fb45

Please sign in to comment.