diff options
author | Matthias Braun <matze@braunis.de> | 2016-11-30 23:48:50 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-11-30 23:48:50 +0000 |
commit | ef331eff5aa56a70d5bef2e5cf3202a326d697e9 (patch) | |
tree | 05e8c2463af88ed178689df11b5228f9f07ef577 /llvm/lib/CodeGen/MIRPrinter.cpp | |
parent | f23ef437ccf39dd8209960b942b3751547b07af5 (diff) | |
download | llvm-ef331eff5aa56a70d5bef2e5cf3202a326d697e9.zip llvm-ef331eff5aa56a70d5bef2e5cf3202a326d697e9.tar.gz llvm-ef331eff5aa56a70d5bef2e5cf3202a326d697e9.tar.bz2 |
Move VariableDbgInfo from MachineModuleInfo to MachineFunction
VariableDbgInfo is per function data, so it makes sense to have it with
the function instead of the module.
This is a necessary step to have machine module passes work properly.
Differential Revision: https://reviews.llvm.org/D27186
llvm-svn: 288292
Diffstat (limited to 'llvm/lib/CodeGen/MIRPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 3778966..81ab0ba 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -90,10 +90,8 @@ public: const MachineConstantPool &ConstantPool); void convert(ModuleSlotTracker &MST, yaml::MachineJumpTable &YamlJTI, const MachineJumpTableInfo &JTI); - void convertStackObjects(yaml::MachineFunction &MF, - const MachineFrameInfo &MFI, MachineModuleInfo &MMI, - ModuleSlotTracker &MST, - const TargetRegisterInfo *TRI); + void convertStackObjects(yaml::MachineFunction &YMF, + const MachineFunction &MF, ModuleSlotTracker &MST); private: void initRegisterMaskIds(const MachineFunction &MF); @@ -188,8 +186,7 @@ void MIRPrinter::print(const MachineFunction &MF) { ModuleSlotTracker MST(MF.getFunction()->getParent()); MST.incorporateFunction(*MF.getFunction()); convert(MST, YamlMF.FrameInfo, MF.getFrameInfo()); - convertStackObjects(YamlMF, MF.getFrameInfo(), MF.getMMI(), MST, - MF.getSubtarget().getRegisterInfo()); + convertStackObjects(YamlMF, MF, MST); if (const auto *ConstantPool = MF.getConstantPool()) convert(YamlMF, *ConstantPool); if (const auto *JumpTableInfo = MF.getJumpTableInfo()) @@ -286,11 +283,11 @@ void MIRPrinter::convert(ModuleSlotTracker &MST, } } -void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF, - const MachineFrameInfo &MFI, - MachineModuleInfo &MMI, - ModuleSlotTracker &MST, - const TargetRegisterInfo *TRI) { +void MIRPrinter::convertStackObjects(yaml::MachineFunction &YMF, + const MachineFunction &MF, + ModuleSlotTracker &MST) { + const MachineFrameInfo &MFI = MF.getFrameInfo(); + const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo(); // Process fixed stack objects. unsigned ID = 0; for (int I = MFI.getObjectIndexBegin(); I < 0; ++I) { @@ -307,7 +304,7 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF, YamlObject.Alignment = MFI.getObjectAlignment(I); YamlObject.IsImmutable = MFI.isImmutableObjectIndex(I); YamlObject.IsAliased = MFI.isAliasedObjectIndex(I); - MF.FixedStackObjects.push_back(YamlObject); + YMF.FixedStackObjects.push_back(YamlObject); StackObjectOperandMapping.insert( std::make_pair(I, FrameIndexOperand::createFixed(ID++))); } @@ -332,7 +329,7 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF, YamlObject.Size = MFI.getObjectSize(I); YamlObject.Alignment = MFI.getObjectAlignment(I); - MF.StackObjects.push_back(YamlObject); + YMF.StackObjects.push_back(YamlObject); StackObjectOperandMapping.insert(std::make_pair( I, FrameIndexOperand::create(YamlObject.Name.Value, ID++))); } @@ -345,9 +342,9 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF, "Invalid stack object index"); const FrameIndexOperand &StackObject = StackObjectInfo->second; if (StackObject.IsFixed) - MF.FixedStackObjects[StackObject.ID].CalleeSavedRegister = Reg; + YMF.FixedStackObjects[StackObject.ID].CalleeSavedRegister = Reg; else - MF.StackObjects[StackObject.ID].CalleeSavedRegister = Reg; + YMF.StackObjects[StackObject.ID].CalleeSavedRegister = Reg; } for (unsigned I = 0, E = MFI.getLocalFrameObjectCount(); I < E; ++I) { auto LocalObject = MFI.getLocalFrameObjectMap(I); @@ -356,26 +353,26 @@ void MIRPrinter::convertStackObjects(yaml::MachineFunction &MF, "Invalid stack object index"); const FrameIndexOperand &StackObject = StackObjectInfo->second; assert(!StackObject.IsFixed && "Expected a locally mapped stack object"); - MF.StackObjects[StackObject.ID].LocalOffset = LocalObject.second; + YMF.StackObjects[StackObject.ID].LocalOffset = LocalObject.second; } // Print the stack object references in the frame information class after // converting the stack objects. if (MFI.hasStackProtectorIndex()) { - raw_string_ostream StrOS(MF.FrameInfo.StackProtector.Value); + raw_string_ostream StrOS(YMF.FrameInfo.StackProtector.Value); MIPrinter(StrOS, MST, RegisterMaskIds, StackObjectOperandMapping) .printStackObjectReference(MFI.getStackProtectorIndex()); } // Print the debug variable information. - for (MachineModuleInfo::VariableDbgInfo &DebugVar : - MMI.getVariableDbgInfo()) { + for (const MachineFunction::VariableDbgInfo &DebugVar : + MF.getVariableDbgInfo()) { auto StackObjectInfo = StackObjectOperandMapping.find(DebugVar.Slot); assert(StackObjectInfo != StackObjectOperandMapping.end() && "Invalid stack object index"); const FrameIndexOperand &StackObject = StackObjectInfo->second; assert(!StackObject.IsFixed && "Expected a non-fixed stack object"); - auto &Object = MF.StackObjects[StackObject.ID]; + auto &Object = YMF.StackObjects[StackObject.ID]; { raw_string_ostream StrOS(Object.DebugVar.Value); DebugVar.Var->printAsOperand(StrOS, MST); |