Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | bool operator!=(const SpillLocationNo &Other) const { | ||||
return !(*this == Other); | return !(*this == Other); | ||||
} | } | ||||
}; | }; | ||||
/// Meta qualifiers for a value. Pair of whatever expression is used to qualify | /// Meta qualifiers for a value. Pair of whatever expression is used to qualify | ||||
/// the value, and Boolean of whether or not it's indirect. | /// the value, and Boolean of whether or not it's indirect. | ||||
class DbgValueProperties { | class DbgValueProperties { | ||||
public: | public: | ||||
DbgValueProperties(const DIExpression *DIExpr, bool Indirect) | DbgValueProperties(const DIExpression *DIExpr, bool Indirect, bool IsVariadic) | ||||
: DIExpr(DIExpr), Indirect(Indirect) {} | : DIExpr(DIExpr), Indirect(Indirect), IsVariadic(IsVariadic) {} | ||||
/// Extract properties from an existing DBG_VALUE instruction. | /// Extract properties from an existing DBG_VALUE instruction. | ||||
DbgValueProperties(const MachineInstr &MI) { | DbgValueProperties(const MachineInstr &MI) { | ||||
assert(MI.isDebugValue()); | assert(MI.isDebugValue()); | ||||
assert(MI.getDebugExpression()->getNumLocationOperands() == 0 || | |||||
MI.isDebugValueList() || MI.isUndefDebugValue()); | |||||
IsVariadic = MI.isDebugValueList(); | |||||
DIExpr = MI.getDebugExpression(); | DIExpr = MI.getDebugExpression(); | ||||
Indirect = MI.getOperand(1).isImm(); | Indirect = MI.isDebugOffsetImm(); | ||||
} | } | ||||
bool operator==(const DbgValueProperties &Other) const { | bool operator==(const DbgValueProperties &Other) const { | ||||
return std::tie(DIExpr, Indirect) == std::tie(Other.DIExpr, Other.Indirect); | return std::tie(DIExpr, Indirect, IsVariadic) == | ||||
std::tie(Other.DIExpr, Other.Indirect, Other.IsVariadic); | |||||
} | } | ||||
bool operator!=(const DbgValueProperties &Other) const { | bool operator!=(const DbgValueProperties &Other) const { | ||||
return !(*this == Other); | return !(*this == Other); | ||||
} | } | ||||
unsigned getLocationOpCount() const { | |||||
return IsVariadic ? DIExpr->getNumLocationOperands() : 1; | |||||
} | |||||
const DIExpression *DIExpr; | const DIExpression *DIExpr; | ||||
bool Indirect; | bool Indirect; | ||||
bool IsVariadic; | |||||
}; | }; | ||||
/// Class recording the (high level) _value_ of a variable. Identifies either | /// Class recording the (high level) _value_ of a variable. Identifies either | ||||
/// the value of the variable as a ValueIDNum, or a constant MachineOperand. | /// the value of the variable as a ValueIDNum, or a constant MachineOperand. | ||||
/// This class also stores meta-information about how the value is qualified. | /// This class also stores meta-information about how the value is qualified. | ||||
/// Used to reason about variable values when performing the second | /// Used to reason about variable values when performing the second | ||||
/// (DebugVariable specific) dataflow analysis. | /// (DebugVariable specific) dataflow analysis. | ||||
class DbgValue { | class DbgValue { | ||||
▲ Show 20 Lines • Show All 469 Lines • ▼ Show 20 Lines | public: | ||||
MapVector<DebugVariable, DbgValue> Vars; | MapVector<DebugVariable, DbgValue> Vars; | ||||
SmallDenseMap<DebugVariable, const DILocation *, 8> Scopes; | SmallDenseMap<DebugVariable, const DILocation *, 8> Scopes; | ||||
MachineBasicBlock *MBB = nullptr; | MachineBasicBlock *MBB = nullptr; | ||||
const OverlapMap &OverlappingFragments; | const OverlapMap &OverlappingFragments; | ||||
DbgValueProperties EmptyProperties; | DbgValueProperties EmptyProperties; | ||||
public: | public: | ||||
VLocTracker(const OverlapMap &O, const DIExpression *EmptyExpr) | VLocTracker(const OverlapMap &O, const DIExpression *EmptyExpr) | ||||
: OverlappingFragments(O), EmptyProperties(EmptyExpr, false) {} | : OverlappingFragments(O), EmptyProperties(EmptyExpr, false, false) {} | ||||
void defVar(const MachineInstr &MI, const DbgValueProperties &Properties, | void defVar(const MachineInstr &MI, const DbgValueProperties &Properties, | ||||
Optional<ValueIDNum> ID) { | Optional<ValueIDNum> ID) { | ||||
assert(MI.isDebugValue() || MI.isDebugRef()); | assert(MI.isDebugValue() || MI.isDebugRef()); | ||||
DebugVariable Var(MI.getDebugVariable(), MI.getDebugExpression(), | DebugVariable Var(MI.getDebugVariable(), MI.getDebugExpression(), | ||||
MI.getDebugLoc()->getInlinedAt()); | MI.getDebugLoc()->getInlinedAt()); | ||||
DbgValue Rec = (ID) ? DbgValue(*ID, Properties, DbgValue::Def) | DbgValue Rec = (ID) ? DbgValue(*ID, Properties, DbgValue::Def) | ||||
: DbgValue(Properties, DbgValue::Undef); | : DbgValue(Properties, DbgValue::Undef); | ||||
▲ Show 20 Lines • Show All 474 Lines • Show Last 20 Lines |