summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-04-01 22:04:07 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-04-01 22:04:07 +0000
commitd306baf572e2cdeb37678a298cda290714961277 (patch)
tree8b8fe12615fc1cd1c89dab78cd71b419bc70b62a /llvm/lib/CodeGen/AsmPrinter
parent5632e26d364bb3639a50ae1bcbda117862bf44c0 (diff)
downloadbcm5719-llvm-d306baf572e2cdeb37678a298cda290714961277.tar.gz
bcm5719-llvm-d306baf572e2cdeb37678a298cda290714961277.zip
Refactor out the comparison of the location/value in a DebugLocEntry
llvm-svn: 205364
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h37
1 files changed, 19 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
index e62897e86a3..5bc9ebc893a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h
@@ -42,6 +42,24 @@ class DebugLocEntry {
// The compile unit to which this location entry is referenced by.
const DwarfCompileUnit *Unit;
+ bool hasSameValueOrLocation(const DebugLocEntry &Next) {
+ if (EntryKind != Next.EntryKind)
+ return false;
+
+ switch (EntryKind) {
+ case E_Location:
+ if (Loc != Next.Loc) return false;
+ case E_Integer:
+ if (Constants.Int != Next.Constants.Int) return false;
+ case E_ConstantFP:
+ if (Constants.CFP != Next.Constants.CFP) return false;
+ case E_ConstantInt:
+ if (Constants.CIP != Next.Constants.CIP) return false;
+ }
+
+ return true;
+ }
+
public:
DebugLocEntry() : Begin(0), End(0), Variable(0), Unit(0) {
Constants.Int = 0;
@@ -75,24 +93,7 @@ public:
/// labels are referenced is used to find debug_loc offset for a given DIE.
bool isEmpty() const { return Begin == 0 && End == 0; }
bool Merge(const DebugLocEntry &Next) {
- if (End != Next.Begin)
- return false;
-
- if (EntryKind != Next.EntryKind)
- return false;
-
- switch (EntryKind) {
- case E_Location:
- if (Loc != Next.Loc) return false;
- case E_Integer:
- if (Constants.Int != Next.Constants.Int) return false;
- case E_ConstantFP:
- if (Constants.CFP != Next.Constants.CFP) return false;
- case E_ConstantInt:
- if (Constants.CIP != Next.Constants.CIP) return false;
- }
-
- return true;
+ return End == Next.Begin && hasSameValueOrLocation(Next);
}
bool isLocation() const { return EntryKind == E_Location; }
bool isInt() const { return EntryKind == E_Integer; }
OpenPOWER on IntegriCloud