diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 10:51:19 +0000 | 
| commit | eb11fae6d08f479c0799db45860a98af528fa6e7 (patch) | |
| tree | 44d492a50c8c1a7eb8e2d17ea3360ec4d066f042 /lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp | |
| parent | b8a2042aa938069e862750553db0e4d82d25822c (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
| -rw-r--r-- | lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp | 33 | 
1 files changed, 7 insertions, 26 deletions
diff --git a/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp index d94b0e5c2118..82e14dc13cb1 100644 --- a/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ b/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -25,6 +25,8 @@  using namespace llvm; +#define DEBUG_TYPE "dwarfdebug" +  Optional<DbgVariableLocation>  DbgVariableLocation::extractFromMachineInstruction(      const MachineInstr &Instruction) { @@ -123,29 +125,6 @@ MCSymbol *DebugHandlerBase::getLabelAfterInsn(const MachineInstr *MI) {    return LabelsAfterInsn.lookup(MI);  } -int DebugHandlerBase::fragmentCmp(const DIExpression *P1, -                                  const DIExpression *P2) { -  auto Fragment1 = *P1->getFragmentInfo(); -  auto Fragment2 = *P2->getFragmentInfo(); -  unsigned l1 = Fragment1.OffsetInBits; -  unsigned l2 = Fragment2.OffsetInBits; -  unsigned r1 = l1 + Fragment1.SizeInBits; -  unsigned r2 = l2 + Fragment2.SizeInBits; -  if (r1 <= l2) -    return -1; -  else if (r2 <= l1) -    return 1; -  else -    return 0; -} - -bool DebugHandlerBase::fragmentsOverlap(const DIExpression *P1, -                                        const DIExpression *P2) { -  if (!P1->isFragment() || !P2->isFragment()) -    return true; -  return fragmentCmp(P1, P2) == 0; -} -  /// If this type is derived from a base type then return base type size.  uint64_t DebugHandlerBase::getBaseTypeSize(const DITypeRef TyRef) {    DIType *Ty = TyRef.resolve(); @@ -163,7 +142,8 @@ uint64_t DebugHandlerBase::getBaseTypeSize(const DITypeRef TyRef) {    DIType *BaseType = DDTy->getBaseType().resolve(); -  assert(BaseType && "Unexpected invalid base type"); +  if (!BaseType) +    return 0;    // If this is a derived type, go ahead and get the base type, unless it's a    // reference then it's just the size of the field. Pointer types have no need @@ -212,6 +192,7 @@ void DebugHandlerBase::beginFunction(const MachineFunction *MF) {    assert(DbgValues.empty() && "DbgValues map wasn't cleaned!");    calculateDbgValueHistory(MF, Asm->MF->getSubtarget().getRegisterInfo(),                             DbgValues); +  LLVM_DEBUG(DbgValues.dump());    // Request labels for the full history.    for (const auto &I : DbgValues) { @@ -231,8 +212,8 @@ void DebugHandlerBase::beginFunction(const MachineFunction *MF) {            const DIExpression *Fragment = I->first->getDebugExpression();            if (std::all_of(Ranges.begin(), I,                            [&](DbgValueHistoryMap::InstrRange Pred) { -                            return !fragmentsOverlap( -                                Fragment, Pred.first->getDebugExpression()); +                            return !Fragment->fragmentsOverlap( +                                Pred.first->getDebugExpression());                            }))              LabelsBeforeInsn[I->first] = Asm->getFunctionBegin();            else  | 
