diff options
author | Fangrui Song <maskray@google.com> | 2020-01-11 12:03:57 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2020-01-11 12:17:05 -0800 |
commit | 179abb091d8a1d67115d21b54001d10250756042 (patch) | |
tree | f81794560c7a53b0c6c5f796f71c88fecd8062d9 /llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp | |
parent | 5a9954c02a7d6e60da26b2feec0837695846aeed (diff) | |
download | bcm5719-llvm-179abb091d8a1d67115d21b54001d10250756042.tar.gz bcm5719-llvm-179abb091d8a1d67115d21b54001d10250756042.zip |
[X86][Disassembler] Replace custom logger with LLVM_DEBUG
llvm-objdump -d on clang is decreased from 7.8s to 7.4s.
The improvement is likely due to the elimination of logger setup and
dbgprintf(), which has a large overhead.
Diffstat (limited to 'llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp')
-rw-r--r-- | llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp index ca1232648a7..ad3255b8a28 100644 --- a/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp +++ b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp @@ -169,27 +169,6 @@ X86GenericDisassembler::X86GenericDisassembler( llvm_unreachable("Invalid CPU mode"); } -/// A callback function that wraps the readByte method from Region. -/// -/// @param Arg - The generic callback parameter. In this case, this should -/// be a pointer to a Region. -/// @param Byte - A pointer to the byte to be read. -/// @param Address - The address to be read. - -/// logger - a callback function that wraps the operator<< method from -/// raw_ostream. -/// -/// @param arg - The generic callback parameter. This should be a pointe -/// to a raw_ostream. -/// @param log - A string to be logged. logger() adds a newline. -static void logger(void* arg, const char* log) { - if (!arg) - return; - - raw_ostream &vStream = *(static_cast<raw_ostream*>(arg)); - vStream << log << "\n"; -} - // // Public interface for the disassembler // @@ -201,14 +180,10 @@ MCDisassembler::DecodeStatus X86GenericDisassembler::getInstruction( InternalInstruction InternalInstr; - dlog_t LoggerFn = logger; - if (&VStream == &nulls()) - LoggerFn = nullptr; // Disable logging completely if it's going to nulls(). - std::pair<ArrayRef<uint8_t>, uint64_t> R(Bytes, Address); - int Ret = decodeInstruction(&InternalInstr, &R, LoggerFn, (void *)&VStream, - (const void *)MII.get(), Address, fMode); + int Ret = decodeInstruction(&InternalInstr, &R, (const void *)MII.get(), + Address, fMode); if (Ret) { Size = InternalInstr.readerCursor - Address; |