[llvm] r203414 - MachineModuleInfo: Turn nested std::pairs into a proper struct.
Eric Christopher
echristo at gmail.com
Wed Mar 12 16:27:19 PDT 2014
Hey cool, thanks!
-eric
On Sun, Mar 9, 2014 at 8:44 AM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Sun Mar 9 10:44:39 2014
> New Revision: 203414
>
> URL: http://llvm.org/viewvc/llvm-project?rev=203414&view=rev
> Log:
> MachineModuleInfo: Turn nested std::pairs into a proper struct.
>
> Modified:
> llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
> llvm/trunk/lib/CodeGen/StackColoring.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=203414&r1=203413&r2=203414&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Sun Mar 9 10:44:39 2014
> @@ -168,10 +168,13 @@ class MachineModuleInfo : public Immutab
> public:
> static char ID; // Pass identification, replacement for typeid
>
> - typedef std::pair<unsigned, DebugLoc> UnsignedDebugLocPair;
> - typedef SmallVector<std::pair<TrackingVH<MDNode>, UnsignedDebugLocPair>, 4>
> - VariableDbgInfoMapTy;
> - VariableDbgInfoMapTy VariableDbgInfo;
> + struct VariableDbgInfo {
> + TrackingVH<MDNode> Var;
> + unsigned Slot;
> + DebugLoc Loc;
> + };
> + typedef SmallVector<VariableDbgInfo, 4> VariableDbgInfoMapTy;
> + VariableDbgInfoMapTy VariableDbgInfos;
>
> MachineModuleInfo(); // DUMMY CONSTRUCTOR, DO NOT CALL.
> // Real constructor.
> @@ -401,10 +404,11 @@ public:
> /// setVariableDbgInfo - Collect information used to emit debugging
> /// information of a variable.
> 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
>
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=203414&r1=203413&r2=203414&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Mar 9 10:44:39 2014
> @@ -1185,26 +1185,23 @@ bool DwarfDebug::addCurrentFnArgument(Db
> void DwarfDebug::collectVariableInfoFromMMITable(
> SmallPtrSet<const MDNode *, 16> &Processed) {
> for (const auto &VI : MMI->getVariableDbgInfo()) {
> - const MDNode *Var = VI.first;
> - if (!Var)
> + if (!VI.Var)
> continue;
> - Processed.insert(Var);
> - DIVariable DV(Var);
> - const std::pair<unsigned, DebugLoc> &VP = VI.second;
> -
> - LexicalScope *Scope = LScopes.findLexicalScope(VP.second);
> + Processed.insert(VI.Var);
> + DIVariable DV(VI.Var);
> + LexicalScope *Scope = LScopes.findLexicalScope(VI.Loc);
>
> // If variable scope is not found then skip this variable.
> if (Scope == 0)
> continue;
>
> - DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VP.second);
> + DbgVariable *AbsDbgVariable = findAbstractVariable(DV, VI.Loc);
> DbgVariable *RegVar = new DbgVariable(DV, AbsDbgVariable, this);
> - RegVar->setFrameIndex(VP.first);
> + RegVar->setFrameIndex(VI.Slot);
> if (!addCurrentFnArgument(RegVar, Scope))
> addScopeVariable(Scope, RegVar);
> if (AbsDbgVariable)
> - AbsDbgVariable->setFrameIndex(VP.first);
> + AbsDbgVariable->setFrameIndex(VI.Slot);
> }
> }
>
>
> Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=203414&r1=203413&r2=203414&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Sun Mar 9 10:44:39 2014
> @@ -313,7 +313,7 @@ void MachineModuleInfo::EndFunction() {
> CallsEHReturn = 0;
> CallsUnwindInit = 0;
> CompactUnwindEncoding = 0;
> - VariableDbgInfo.clear();
> + VariableDbgInfos.clear();
> }
>
> /// AnalyzeModule - Scan the module for global debug information.
>
> Modified: llvm/trunk/lib/CodeGen/StackColoring.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackColoring.cpp?rev=203414&r1=203413&r2=203414&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/StackColoring.cpp (original)
> +++ llvm/trunk/lib/CodeGen/StackColoring.cpp Sun Mar 9 10:44:39 2014
> @@ -473,15 +473,12 @@ void StackColoring::remapInstructions(De
> MachineModuleInfo *MMI = &MF->getMMI();
>
> // Remap debug information that refers to stack slots.
> - MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();
> - for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),
> - VE = VMap.end(); VI != VE; ++VI) {
> - const MDNode *Var = VI->first;
> - if (!Var) continue;
> - std::pair<unsigned, DebugLoc> &VP = VI->second;
> - if (SlotRemap.count(VP.first)) {
> - DEBUG(dbgs()<<"Remapping debug info for ["<<Var->getName()<<"].\n");
> - VP.first = SlotRemap[VP.first];
> + for (auto &VI : MMI->getVariableDbgInfo()) {
> + if (!VI.Var)
> + continue;
> + if (SlotRemap.count(VI.Slot)) {
> + DEBUG(dbgs()<<"Remapping debug info for ["<<VI.Var->getName()<<"].\n");
> + VI.Slot = SlotRemap[VI.Slot];
> FixedDbg++;
> }
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list