mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 10:56:01 +00:00
MachineModuleInfo: Turn nested std::pairs into a proper struct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203414 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4b484628f4
commit
1ceef0ef50
@ -168,10 +168,13 @@ class MachineModuleInfo : public ImmutablePass {
|
|||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
|
||||||
typedef std::pair<unsigned, DebugLoc> UnsignedDebugLocPair;
|
struct VariableDbgInfo {
|
||||||
typedef SmallVector<std::pair<TrackingVH<MDNode>, UnsignedDebugLocPair>, 4>
|
TrackingVH<MDNode> Var;
|
||||||
VariableDbgInfoMapTy;
|
unsigned Slot;
|
||||||
VariableDbgInfoMapTy VariableDbgInfo;
|
DebugLoc Loc;
|
||||||
|
};
|
||||||
|
typedef SmallVector<VariableDbgInfo, 4> VariableDbgInfoMapTy;
|
||||||
|
VariableDbgInfoMapTy VariableDbgInfos;
|
||||||
|
|
||||||
MachineModuleInfo(); // DUMMY CONSTRUCTOR, DO NOT CALL.
|
MachineModuleInfo(); // DUMMY CONSTRUCTOR, DO NOT CALL.
|
||||||
// Real constructor.
|
// Real constructor.
|
||||||
@ -401,10 +404,11 @@ public:
|
|||||||
/// setVariableDbgInfo - Collect information used to emit debugging
|
/// setVariableDbgInfo - Collect information used to emit debugging
|
||||||
/// information of a variable.
|
/// information of a variable.
|
||||||
void setVariableDbgInfo(MDNode *N, unsigned Slot, DebugLoc Loc) {
|
void setVariableDbgInfo(MDNode *N, unsigned Slot, DebugLoc Loc) {
|
||||||
VariableDbgInfo.push_back(std::make_pair(N, std::make_pair(Slot, Loc)));
|
VariableDbgInfo Info = { N, Slot, Loc };
|
||||||
|
VariableDbgInfos.push_back(std::move(Info));
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfo; }
|
VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfos; }
|
||||||
|
|
||||||
}; // End class MachineModuleInfo
|
}; // End class MachineModuleInfo
|
||||||
|
|
||||||
|
@ -1185,26 +1185,23 @@ bool DwarfDebug::addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope) {
|
|||||||
void DwarfDebug::collectVariableInfoFromMMITable(
|
void DwarfDebug::collectVariableInfoFromMMITable(
|
||||||
SmallPtrSet<const MDNode *, 16> &Processed) {
|
SmallPtrSet<const MDNode *, 16> &Processed) {
|
||||||
for (const auto &VI : MMI->getVariableDbgInfo()) {
|
for (const auto &VI : MMI->getVariableDbgInfo()) {
|
||||||
const MDNode *Var = VI.first;
|
if (!VI.Var)
|
||||||
if (!Var)
|
|
||||||
continue;
|
continue;
|
||||||
Processed.insert(Var);
|
Processed.insert(VI.Var);
|
||||||
DIVariable DV(Var);
|
DIVariable DV(VI.Var);
|
||||||
const std::pair<unsigned, DebugLoc> &VP = VI.second;
|
LexicalScope *Scope = LScopes.findLexicalScope(VI.Loc);
|
||||||
|
|
||||||
LexicalScope *Scope = LScopes.findLexicalScope(VP.second);
|
|
||||||
|
|
||||||
// If variable scope is not found then skip this variable.
|
// If variable scope is not found then skip this variable.
|
||||||
if (Scope == 0)
|
if (Scope == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second);
|
DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VI.Loc);
|
||||||
DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this);
|
DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this);
|
||||||
RegVar->setFrameIndex(VP.first);
|
RegVar->setFrameIndex(VI.Slot);
|
||||||
if (!addCurrentFnArgument(RegVar, Scope))
|
if (!addCurrentFnArgument(RegVar, Scope))
|
||||||
addScopeVariable(Scope, RegVar);
|
addScopeVariable(Scope, RegVar);
|
||||||
if (AbsDbgVariable)
|
if (AbsDbgVariable)
|
||||||
AbsDbgVariable->setFrameIndex(VP.first);
|
AbsDbgVariable->setFrameIndex(VI.Slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ void MachineModuleInfo::EndFunction() {
|
|||||||
CallsEHReturn = 0;
|
CallsEHReturn = 0;
|
||||||
CallsUnwindInit = 0;
|
CallsUnwindInit = 0;
|
||||||
CompactUnwindEncoding = 0;
|
CompactUnwindEncoding = 0;
|
||||||
VariableDbgInfo.clear();
|
VariableDbgInfos.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// AnalyzeModule - Scan the module for global debug information.
|
/// AnalyzeModule - Scan the module for global debug information.
|
||||||
|
@ -473,15 +473,12 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
|
|||||||
MachineModuleInfo *MMI = &MF->getMMI();
|
MachineModuleInfo *MMI = &MF->getMMI();
|
||||||
|
|
||||||
// Remap debug information that refers to stack slots.
|
// Remap debug information that refers to stack slots.
|
||||||
MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();
|
for (auto &VI : MMI->getVariableDbgInfo()) {
|
||||||
for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),
|
if (!VI.Var)
|
||||||
VE = VMap.end(); VI != VE; ++VI) {
|
continue;
|
||||||
const MDNode *Var = VI->first;
|
if (SlotRemap.count(VI.Slot)) {
|
||||||
if (!Var) continue;
|
DEBUG(dbgs()<<"Remapping debug info for ["<<VI.Var->getName()<<"].\n");
|
||||||
std::pair<unsigned, DebugLoc> &VP = VI->second;
|
VI.Slot = SlotRemap[VI.Slot];
|
||||||
if (SlotRemap.count(VP.first)) {
|
|
||||||
DEBUG(dbgs()<<"Remapping debug info for ["<<Var->getName()<<"].\n");
|
|
||||||
VP.first = SlotRemap[VP.first];
|
|
||||||
FixedDbg++;
|
FixedDbg++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user