AsmPrinter: Store MDExpression directly instead of MDNode, NFC

Clean up `DebugLocEntry::Value::Expression`'s type while I'm messing
around in here anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235203 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-04-17 16:36:10 +00:00
parent f98df953fb
commit 80c84fe4ff
2 changed files with 8 additions and 10 deletions

View File

@ -17,7 +17,7 @@
namespace llvm { namespace llvm {
class AsmPrinter; class AsmPrinter;
class MDNode;
/// \brief This struct describes location entries emitted in the .debug_loc /// \brief This struct describes location entries emitted in the .debug_loc
/// section. /// section.
class DebugLocEntry { class DebugLocEntry {
@ -28,25 +28,25 @@ class DebugLocEntry {
public: public:
/// \brief A single location or constant. /// \brief A single location or constant.
struct Value { struct Value {
Value(const MDNode *Expr, int64_t i) Value(const MDExpression *Expr, int64_t i)
: Expression(Expr), EntryKind(E_Integer) { : Expression(Expr), EntryKind(E_Integer) {
Constant.Int = i; Constant.Int = i;
} }
Value(const MDNode *Expr, const ConstantFP *CFP) Value(const MDExpression *Expr, const ConstantFP *CFP)
: Expression(Expr), EntryKind(E_ConstantFP) { : Expression(Expr), EntryKind(E_ConstantFP) {
Constant.CFP = CFP; Constant.CFP = CFP;
} }
Value(const MDNode *Expr, const ConstantInt *CIP) Value(const MDExpression *Expr, const ConstantInt *CIP)
: Expression(Expr), EntryKind(E_ConstantInt) { : Expression(Expr), EntryKind(E_ConstantInt) {
Constant.CIP = CIP; Constant.CIP = CIP;
} }
Value(const MDNode *Expr, MachineLocation Loc) Value(const MDExpression *Expr, MachineLocation Loc)
: Expression(Expr), EntryKind(E_Location), Loc(Loc) { : Expression(Expr), EntryKind(E_Location), Loc(Loc) {
assert(cast<MDExpression>(Expr)->isValid()); assert(cast<MDExpression>(Expr)->isValid());
} }
/// Any complex address location expression for this Value. /// Any complex address location expression for this Value.
const MDNode *Expression; const MDExpression *Expression;
/// Type of entry that this represents. /// Type of entry that this represents.
enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt }; enum EntryType { E_Location, E_Integer, E_ConstantFP, E_ConstantInt };
@ -71,9 +71,7 @@ public:
const ConstantInt *getConstantInt() const { return Constant.CIP; } const ConstantInt *getConstantInt() const { return Constant.CIP; }
MachineLocation getLoc() const { return Loc; } MachineLocation getLoc() const { return Loc; }
bool isBitPiece() const { return getExpression()->isBitPiece(); } bool isBitPiece() const { return getExpression()->isBitPiece(); }
DIExpression getExpression() const { DIExpression getExpression() const { return Expression; }
return cast_or_null<MDExpression>(Expression);
}
friend bool operator==(const Value &, const Value &); friend bool operator==(const Value &, const Value &);
friend bool operator<(const Value &, const Value &); friend bool operator<(const Value &, const Value &);
}; };

View File

@ -733,7 +733,7 @@ void DwarfDebug::collectVariableInfoFromMMITable(
// Get .debug_loc entry for the instruction range starting at MI. // Get .debug_loc entry for the instruction range starting at MI.
static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) { static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {
const MDNode *Expr = MI->getDebugExpression(); const MDExpression *Expr = MI->getDebugExpression();
assert(MI->getNumOperands() == 4); assert(MI->getNumOperands() == 4);
if (MI->getOperand(0).isReg()) { if (MI->getOperand(0).isReg()) {