[llvm] r235202 - AsmPrinter: Stop storing MDLocalVariable in DebugLocEntry
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Apr 17 09:33:38 PDT 2015
Author: dexonsmith
Date: Fri Apr 17 11:33:37 2015
New Revision: 235202
URL: http://llvm.org/viewvc/llvm-project?rev=235202&view=rev
Log:
AsmPrinter: Stop storing MDLocalVariable in DebugLocEntry
Stop storing the `MDLocalVariable` in the `DebugLocEntry::Value`s. We
generate the list of `DebugLocEntry`s separately for each
variable/inlined-at pair, so the variable never actually changes here.
This is effectively NFC (aside from saving some memory and CPU time).
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h?rev=235202&r1=235201&r2=235202&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DebugLocEntry.h Fri Apr 17 11:33:37 2015
@@ -28,27 +28,23 @@ class DebugLocEntry {
public:
/// \brief A single location or constant.
struct Value {
- Value(const MDNode *Var, const MDNode *Expr, int64_t i)
- : Variable(Var), Expression(Expr), EntryKind(E_Integer) {
+ Value(const MDNode *Expr, int64_t i)
+ : Expression(Expr), EntryKind(E_Integer) {
Constant.Int = i;
}
- Value(const MDNode *Var, const MDNode *Expr, const ConstantFP *CFP)
- : Variable(Var), Expression(Expr), EntryKind(E_ConstantFP) {
+ Value(const MDNode *Expr, const ConstantFP *CFP)
+ : Expression(Expr), EntryKind(E_ConstantFP) {
Constant.CFP = CFP;
}
- Value(const MDNode *Var, const MDNode *Expr, const ConstantInt *CIP)
- : Variable(Var), Expression(Expr), EntryKind(E_ConstantInt) {
+ Value(const MDNode *Expr, const ConstantInt *CIP)
+ : Expression(Expr), EntryKind(E_ConstantInt) {
Constant.CIP = CIP;
}
- Value(const MDNode *Var, const MDNode *Expr, MachineLocation Loc)
- : Variable(Var), Expression(Expr), EntryKind(E_Location), Loc(Loc) {
- assert(isa<MDLocalVariable>(Var));
+ Value(const MDNode *Expr, MachineLocation Loc)
+ : Expression(Expr), EntryKind(E_Location), Loc(Loc) {
assert(cast<MDExpression>(Expr)->isValid());
}
- /// The variable to which this location entry corresponds.
- const MDNode *Variable;
-
/// Any complex address location expression for this Value.
const MDNode *Expression;
@@ -74,7 +70,6 @@ public:
const ConstantFP *getConstantFP() const { return Constant.CFP; }
const ConstantInt *getConstantInt() const { return Constant.CIP; }
MachineLocation getLoc() const { return Loc; }
- DIVariable getVariable() const { return cast<MDLocalVariable>(Variable); }
bool isBitPiece() const { return getExpression()->isBitPiece(); }
DIExpression getExpression() const {
return cast_or_null<MDExpression>(Expression);
@@ -103,11 +98,9 @@ public:
bool MergeValues(const DebugLocEntry &Next) {
if (Begin == Next.Begin) {
DIExpression Expr = cast_or_null<MDExpression>(Values[0].Expression);
- DIVariable Var = cast_or_null<MDLocalVariable>(Values[0].Variable);
DIExpression NextExpr =
cast_or_null<MDExpression>(Next.Values[0].Expression);
- DIVariable NextVar = cast_or_null<MDLocalVariable>(Next.Values[0].Variable);
- if (Var == NextVar && Expr->isBitPiece() && NextExpr->isBitPiece()) {
+ if (Expr->isBitPiece() && NextExpr->isBitPiece()) {
addValues(Next.Values);
End = Next.End;
return true;
@@ -144,12 +137,12 @@ public:
// Remove any duplicate entries by dropping all but the first.
void sortUniqueValues() {
std::sort(Values.begin(), Values.end());
- Values.erase(std::unique(Values.begin(), Values.end(),
- [](const Value &A, const Value &B) {
- return A.getVariable() == B.getVariable() &&
- A.getExpression() == B.getExpression();
- }),
- Values.end());
+ Values.erase(
+ std::unique(
+ Values.begin(), Values.end(), [](const Value &A, const Value &B) {
+ return A.getExpression() == B.getExpression();
+ }),
+ Values.end());
}
/// \brief Lower this entry into a DWARF expression.
@@ -170,9 +163,6 @@ inline bool operator==(const DebugLocEnt
if (A.Expression != B.Expression)
return false;
- if (A.Variable != B.Variable)
- return false;
-
switch (A.EntryKind) {
case DebugLocEntry::Value::E_Location:
return A.Loc == B.Loc;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=235202&r1=235201&r2=235202&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Apr 17 11:33:37 2015
@@ -734,7 +734,6 @@ void DwarfDebug::collectVariableInfoFrom
// Get .debug_loc entry for the instruction range starting at MI.
static DebugLocEntry::Value getDebugLocValue(const MachineInstr *MI) {
const MDNode *Expr = MI->getDebugExpression();
- const MDNode *Var = MI->getDebugVariable();
assert(MI->getNumOperands() == 4);
if (MI->getOperand(0).isReg()) {
@@ -745,14 +744,14 @@ static DebugLocEntry::Value getDebugLocV
MLoc.set(MI->getOperand(0).getReg());
else
MLoc.set(MI->getOperand(0).getReg(), MI->getOperand(1).getImm());
- return DebugLocEntry::Value(Var, Expr, MLoc);
+ return DebugLocEntry::Value(Expr, MLoc);
}
if (MI->getOperand(0).isImm())
- return DebugLocEntry::Value(Var, Expr, MI->getOperand(0).getImm());
+ return DebugLocEntry::Value(Expr, MI->getOperand(0).getImm());
if (MI->getOperand(0).isFPImm())
- return DebugLocEntry::Value(Var, Expr, MI->getOperand(0).getFPImm());
+ return DebugLocEntry::Value(Expr, MI->getOperand(0).getFPImm());
if (MI->getOperand(0).isCImm())
- return DebugLocEntry::Value(Var, Expr, MI->getOperand(0).getCImm());
+ return DebugLocEntry::Value(Expr, MI->getOperand(0).getCImm());
llvm_unreachable("Unexpected 4-operand DBG_VALUE instruction!");
}
@@ -865,7 +864,6 @@ DwarfDebug::buildLocationList(SmallVecto
DEBUG({
dbgs() << CurEntry->getValues().size() << " Values:\n";
for (auto Value : CurEntry->getValues()) {
- Value.getVariable()->dump();
Value.getExpression()->dump();
}
dbgs() << "-----\n";
More information about the llvm-commits
mailing list