[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp PPCRegisterInfo.h
Jim Laskey
jlaskey at apple.com
Fri Apr 7 09:35:05 PDT 2006
Changes in directory llvm/lib/Target/PowerPC:
PPCRegisterInfo.cpp updated: 1.53 -> 1.54
PPCRegisterInfo.h updated: 1.12 -> 1.13
---
Log message:
Foundation for call frame information.
---
Diffs of the changes: (+31 -2)
PPCRegisterInfo.cpp | 31 +++++++++++++++++++++++++++++--
PPCRegisterInfo.h | 2 ++
2 files changed, 31 insertions(+), 2 deletions(-)
Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp
diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.53 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.54
--- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.53 Mon Apr 3 17:03:29 2006
+++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Fri Apr 7 11:34:45 2006
@@ -19,9 +19,11 @@
#include "llvm/Type.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/CodeGen/MachineDebugInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
+#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
@@ -339,6 +341,7 @@
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
MachineBasicBlock::iterator MBBI = MBB.begin();
MachineFrameInfo *MFI = MF.getFrameInfo();
+ MachineDebugInfo *DebugInfo = MFI->getMachineDebugInfo();
// Do we have a frame pointer for this function?
bool HasFP = hasFP(MF);
@@ -390,13 +393,13 @@
// Update frame info to pretend that this is part of the stack...
MFI->setStackSize(NumBytes);
+ int NegNumbytes = -NumBytes;
// Adjust stack pointer: r1 -= numbytes.
if (NumBytes <= 32768) {
BuildMI(MBB, MBBI, PPC::STWU, 3)
.addReg(PPC::R1).addSImm(-NumBytes).addReg(PPC::R1);
} else {
- int NegNumbytes = -NumBytes;
BuildMI(MBB, MBBI, PPC::LIS, 1, PPC::R0).addSImm(NegNumbytes >> 16);
BuildMI(MBB, MBBI, PPC::ORI, 2, PPC::R0)
.addReg(PPC::R0).addImm(NegNumbytes & 0xFFFF);
@@ -404,6 +407,18 @@
.addReg(PPC::R1).addReg(PPC::R1).addReg(PPC::R0);
}
+ if (DebugInfo) {
+ std::vector<MachineMove *> &Moves = DebugInfo->getFrameMoves();
+ unsigned LabelID = DebugInfo->NextLabelID();
+
+ // Show update of SP.
+ MachineLocation Dst(MachineLocation::VirtualFP);
+ MachineLocation Src(MachineLocation::VirtualFP, NegNumbytes);
+ Moves.push_back(new MachineMove(LabelID, Dst, Src));
+
+ BuildMI(MBB, MBBI, PPC::DWARF_LABEL, 1).addSImm(LabelID);
+ }
+
// If there is a preferred stack alignment, align R1 now
// FIXME: If this ever matters, this could be made more efficient by folding
// this into the code above, so that we don't issue two store+update
@@ -458,8 +473,20 @@
}
}
+unsigned PPCRegisterInfo::getRARegister() const {
+ return PPC::LR;
+}
+
unsigned PPCRegisterInfo::getFrameRegister(MachineFunction &MF) const {
- return getDwarfRegNum(hasFP(MF) ? PPC::R31 : PPC::R1);
+ return hasFP(MF) ? PPC::R31 : PPC::R1;
+}
+
+void PPCRegisterInfo::getInitialFrameState(std::vector<MachineMove *> &Moves)
+ const {
+ // Initial state is the frame pointer is R1.
+ MachineLocation Dst(MachineLocation::VirtualFP);
+ MachineLocation Src(PPC::R1, 0);
+ Moves.push_back(new MachineMove(0, Dst, Src));
}
#include "PPCGenRegisterInfo.inc"
Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.h
diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.12 llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.13
--- llvm/lib/Target/PowerPC/PPCRegisterInfo.h:1.12 Tue Mar 28 07:48:33 2006
+++ llvm/lib/Target/PowerPC/PPCRegisterInfo.h Fri Apr 7 11:34:45 2006
@@ -57,7 +57,9 @@
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
// Debug information queries.
+ unsigned getRARegister() const;
unsigned getFrameRegister(MachineFunction &MF) const;
+ void getInitialFrameState(std::vector<MachineMove *> &Moves) const;
};
} // end namespace llvm
More information about the llvm-commits
mailing list