1919#include " llvm/ADT/MapVector.h"
2020#include " llvm/ADT/SmallVector.h"
2121#include " llvm/Support/Debug.h"
22+ #include " llvm/Support/DebugLog.h"
2223#include " llvm/Support/Endian.h"
2324#include " llvm/Support/raw_ostream.h"
2425#include < optional>
@@ -150,8 +151,7 @@ class EncodingEmitter {
150151
151152 // / Backpatch a byte in the result buffer at the given offset.
152153 void patchByte (uint64_t offset, uint8_t value, StringLiteral desc) {
153- LLVM_DEBUG (llvm::dbgs () << " patchByte(" << offset << ' ,' << uint64_t (value)
154- << " )\t " << desc << ' \n ' );
154+ LDBG () << " patchByte(" << offset << ' ,' << uint64_t (value) << " )\t " << desc;
155155 assert (offset < size () && offset >= prevResultSize &&
156156 " cannot patch previously emitted data" );
157157 currentResult[offset - prevResultSize] = value;
@@ -160,8 +160,7 @@ class EncodingEmitter {
160160 // / Emit the provided blob of data, which is owned by the caller and is
161161 // / guaranteed to not die before the end of the bytecode process.
162162 void emitOwnedBlob (ArrayRef<uint8_t > data, StringLiteral desc) {
163- LLVM_DEBUG (llvm::dbgs ()
164- << " emitOwnedBlob(" << data.size () << " b)\t " << desc << ' \n ' );
163+ LDBG () << " emitOwnedBlob(" << data.size () << " b)\t " << desc;
165164 // Push the current buffer before adding the provided data.
166165 appendResult (std::move (currentResult));
167166 appendOwnedResult (data);
@@ -209,15 +208,13 @@ class EncodingEmitter {
209208 // / Emit a single byte.
210209 template <typename T>
211210 void emitByte (T byte, StringLiteral desc) {
212- LLVM_DEBUG (llvm::dbgs ()
213- << " emitByte(" << uint64_t (byte) << " )\t " << desc << ' \n ' );
211+ LDBG () << " emitByte(" << uint64_t (byte) << " )\t " << desc;
214212 currentResult.push_back (static_cast <uint8_t >(byte));
215213 }
216214
217215 // / Emit a range of bytes.
218216 void emitBytes (ArrayRef<uint8_t > bytes, StringLiteral desc) {
219- LLVM_DEBUG (llvm::dbgs ()
220- << " emitBytes(" << bytes.size () << " b)\t " << desc << ' \n ' );
217+ LDBG () << " emitBytes(" << bytes.size () << " b)\t " << desc;
221218 llvm::append_range (currentResult, bytes);
222219 }
223220
@@ -229,7 +226,7 @@ class EncodingEmitter {
229226 // / additional bytes, provide the value of the integer encoded in
230227 // / little-endian order.
231228 void emitVarInt (uint64_t value, StringLiteral desc) {
232- LLVM_DEBUG ( llvm::dbgs ( ) << " emitVarInt(" << value << " )\t " << desc << ' \n ' ) ;
229+ LDBG ( ) << " emitVarInt(" << value << " )\t " << desc;
233230
234231 // In the most common case, the value can be represented in a single byte.
235232 // Given how hot this case is, explicitly handle that here.
0 commit comments