diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-02-16 18:48:33 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-02-16 18:48:33 +0000 |
commit | b2fbb4b2764f49c07de373cb537f15048e9e7af0 (patch) | |
tree | bcaf9871efb99dc2c5266323df331bfe28214650 /llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp | |
parent | 920576042d53ab69298bdd13095f63a9bae2697b (diff) | |
download | bcm5719-llvm-b2fbb4b2764f49c07de373cb537f15048e9e7af0.tar.gz bcm5719-llvm-b2fbb4b2764f49c07de373cb537f15048e9e7af0.zip |
Refactor DebugHandlerBase a bit to common non-debug-having-function filtering
llvm-svn: 295354
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp index 94190981e88..aa8b8fbb869 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -115,12 +115,34 @@ uint64_t DebugHandlerBase::getBaseTypeSize(const DITypeRef TyRef) { return getBaseTypeSize(BaseType); } +bool hasDebugInfo(const MachineModuleInfo *MMI, const MachineFunction *MF) { + if (!MMI->hasDebugInfo()) + return false; + auto *SP = MF->getFunction()->getSubprogram(); + if (!SP) + return false; + assert(SP->getUnit()); + auto EK = SP->getUnit()->getEmissionKind(); + if (EK == DICompileUnit::NoDebug) + return false; + return true; +} + void DebugHandlerBase::beginFunction(const MachineFunction *MF) { + assert(Asm); + + if (!hasDebugInfo(MMI, MF)) { + skippedNonDebugFunction(); + return; + } + // Grab the lexical scopes for the function, if we don't have any of those // then we're not going to be able to do anything. LScopes.initialize(*MF); - if (LScopes.empty()) + if (LScopes.empty()) { + beginFunctionImpl(MF); return; + } // Make sure that each lexical scope will have a begin/end label. identifyScopeMarkers(); @@ -167,6 +189,7 @@ void DebugHandlerBase::beginFunction(const MachineFunction *MF) { PrevInstLoc = DebugLoc(); PrevLabel = Asm->getFunctionBegin(); + beginFunctionImpl(MF); } void DebugHandlerBase::beginInstruction(const MachineInstr *MI) { @@ -228,6 +251,8 @@ void DebugHandlerBase::endInstruction() { } void DebugHandlerBase::endFunction(const MachineFunction *MF) { + if (hasDebugInfo(MMI, MF)) + endFunctionImpl(MF); DbgValues.clear(); LabelsBeforeInsn.clear(); LabelsAfterInsn.clear(); |