From 08ede262a744f99429658fadb43662441bdcb42d Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Fri, 25 Aug 2006 22:56:30 +0000 Subject: [PATCH] Tidy up. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29888 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineFrameInfo.h | 12 ++++++++++-- lib/CodeGen/PrologEpilogInserter.cpp | 6 ++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 40ebcd3c316..be6f1b9c423 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -134,7 +134,7 @@ class MachineFrameInfo { unsigned MaxCallFrameSize; /// CSInfo - The prolog/epilog code inserter fills in this vector with each - /// callee saved register saved in the frame. Beyond it's use by the prolog/ + /// callee saved register saved in the frame. Beyond its use by the prolog/ /// epilog code inserter, this data used for debug info and exception /// handling. std::vector CSInfo; @@ -273,7 +273,15 @@ public: /// getCalleeSavedInfo - Returns a reference to call saved info vector for the /// current function. - std::vector &getCalleeSavedInfo() { return CSInfo; } + const std::vector &getCalleeSavedInfo() const { + return CSInfo; + } + + /// setCalleeSavedInfo - Used by prolog/epilog inserter to set the function's + /// callee saved information. + void setCalleeSavedInfo(const std::vector &CSI) { + CSInfo = CSI; + } /// getMachineDebugInfo - Used by a prologue/epilogue emitter (MRegisterInfo) /// to provide frame layout information. diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index 3d37b88218f..05052d354df 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -139,7 +139,7 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) { const bool *PhysRegsUsed = Fn.getUsedPhysregs(); const TargetRegisterClass* const *CSRegClasses = RegInfo->getCalleeSaveRegClasses(); - std::vector &CSI = FFI->getCalleeSavedInfo(); + std::vector CSI; for (unsigned i = 0; CSRegs[i]; ++i) { unsigned Reg = CSRegs[i]; if (PhysRegsUsed[Reg]) { @@ -186,6 +186,8 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) { } CSI[i].setFrameIdx(FrameIdx); } + + FFI->setCalleeSavedInfo(CSI); } /// saveCallerSavedRegisters - Insert spill code for any caller saved registers @@ -194,7 +196,7 @@ void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) { void PEI::saveCallerSavedRegisters(MachineFunction &Fn) { // Get callee saved register information. MachineFrameInfo *FFI = Fn.getFrameInfo(); - std::vector &CSI = FFI->getCalleeSavedInfo(); + const std::vector &CSI = FFI->getCalleeSavedInfo(); // Early exit if no caller saved registers are modified! if (CSI.empty())