X86Disassembler: if verbose logging is going to nulls(), disable logging completely.

Otherwise we'll spend a ridiculous amount of time pretty printing debug output and then discarding it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140276 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2011-09-21 21:47:35 +00:00
parent fe59d853c6
commit 15c9a1f60c

View File

@ -117,11 +117,15 @@ X86GenericDisassembler::getInstruction(MCInst &instr,
raw_ostream &vStream, raw_ostream &vStream,
raw_ostream &cStream) const { raw_ostream &cStream) const {
InternalInstruction internalInstr; InternalInstruction internalInstr;
dlog_t loggerFn = logger;
if (&vStream == &nulls())
loggerFn = 0; // Disable logging completely if it's going to nulls().
int ret = decodeInstruction(&internalInstr, int ret = decodeInstruction(&internalInstr,
regionReader, regionReader,
(void*)&region, (void*)&region,
logger, loggerFn,
(void*)&vStream, (void*)&vStream,
address, address,
fMode); fMode);