diff options
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r-- | llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Target/Alpha/AlphaRegisterInfo.h | 3 | ||||
-rw-r--r-- | llvm/lib/Target/IA64/IA64RegisterInfo.cpp | 7 | ||||
-rw-r--r-- | llvm/lib/Target/IA64/IA64RegisterInfo.h | 1 | ||||
-rw-r--r-- | llvm/lib/Target/MRegisterInfo.cpp | 15 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp | 31 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCRegisterInfo.h | 2 | ||||
-rw-r--r-- | llvm/lib/Target/Sparc/SparcRegisterInfo.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/Sparc/SparcRegisterInfo.h | 1 | ||||
-rw-r--r-- | llvm/lib/Target/SparcV9/SparcV9RegisterInfo.cpp | 9 | ||||
-rw-r--r-- | llvm/lib/Target/SparcV9/SparcV9RegisterInfo.h | 2 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86RegisterInfo.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86RegisterInfo.h | 1 |
13 files changed, 86 insertions, 7 deletions
diff --git a/llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp b/llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp index d2a398465b0..8f6310e4398 100644 --- a/llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp +++ b/llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp @@ -354,8 +354,13 @@ void AlphaRegisterInfo::emitEpilogue(MachineFunction &MF, } } +unsigned AlphaRegisterInfo::getRARegister() const { + assert(0 && "What is the return address register"); + return 0; +} + unsigned AlphaRegisterInfo::getFrameRegister(MachineFunction &MF) const { - return getDwarfRegNum(hasFP(MF) ? Alpha::R15 : Alpha::R30); + return hasFP(MF) ? Alpha::R15 : Alpha::R30; } #include "AlphaGenRegisterInfo.inc" diff --git a/llvm/lib/Target/Alpha/AlphaRegisterInfo.h b/llvm/lib/Target/Alpha/AlphaRegisterInfo.h index 161a8268568..d4d86f39163 100644 --- a/llvm/lib/Target/Alpha/AlphaRegisterInfo.h +++ b/llvm/lib/Target/Alpha/AlphaRegisterInfo.h @@ -53,7 +53,8 @@ struct AlphaRegisterInfo : public AlphaGenRegisterInfo { void emitPrologue(MachineFunction &MF) const; void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; - // Debug information queries. + // Debug information queries. + unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction &MF) const; static std::string getPrettyName(unsigned reg); diff --git a/llvm/lib/Target/IA64/IA64RegisterInfo.cpp b/llvm/lib/Target/IA64/IA64RegisterInfo.cpp index b1e681d9b43..e9a809f4075 100644 --- a/llvm/lib/Target/IA64/IA64RegisterInfo.cpp +++ b/llvm/lib/Target/IA64/IA64RegisterInfo.cpp @@ -329,8 +329,13 @@ void IA64RegisterInfo::emitEpilogue(MachineFunction &MF, } +unsigned IA64RegisterInfo::getRARegister() const { + assert(0 && "What is the return address register"); + return 0; +} + unsigned IA64RegisterInfo::getFrameRegister(MachineFunction &MF) const { - return getDwarfRegNum(hasFP(MF) ? IA64::r5 : IA64::r12); + return hasFP(MF) ? IA64::r5 : IA64::r12; } #include "IA64GenRegisterInfo.inc" diff --git a/llvm/lib/Target/IA64/IA64RegisterInfo.h b/llvm/lib/Target/IA64/IA64RegisterInfo.h index 328b4155737..93d09deae92 100644 --- a/llvm/lib/Target/IA64/IA64RegisterInfo.h +++ b/llvm/lib/Target/IA64/IA64RegisterInfo.h @@ -50,6 +50,7 @@ struct IA64RegisterInfo : public IA64GenRegisterInfo { void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; // Debug information queries. + unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction &MF) const; }; diff --git a/llvm/lib/Target/MRegisterInfo.cpp b/llvm/lib/Target/MRegisterInfo.cpp index 558783aedc4..4ddfe9f3230 100644 --- a/llvm/lib/Target/MRegisterInfo.cpp +++ b/llvm/lib/Target/MRegisterInfo.cpp @@ -44,6 +44,13 @@ std::vector<bool> MRegisterInfo::getAllocatableSet(MachineFunction &MF) const { return Allocatable; } +/// getStackDirection - This method should return the factor by which stacks +/// grow. The tyical value is -4 which is the grows negatively in 4 byte +/// increments. +int MRegisterInfo::getStackDirection() const { + return -sizeof(int32_t); +} + /// getLocation - This method should return the actual location of a frame /// variable given the frame index. The location is returned in ML. /// Subclasses should override this method for special handling of frame @@ -54,3 +61,11 @@ void MRegisterInfo::getLocation(MachineFunction &MF, unsigned Index, ML.set(getFrameRegister(MF), MFI->getObjectOffset(Index) + MFI->getStackSize()); } + +/// getInitialFrameState - Returns a list of machine moves that are assumed +/// on entry to a function. +void +MRegisterInfo::getInitialFrameState(std::vector<MachineMove *> &Moves) const { + // Default is to do nothing. +} + diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp index c3007c4aec0..67f5285b7d2 100644 --- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp @@ -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 @@ void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const { 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 @@ void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const { // 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 @@ void PPCRegisterInfo::emitPrologue(MachineFunction &MF) const { .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 @@ void PPCRegisterInfo::emitEpilogue(MachineFunction &MF, } } +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" diff --git a/llvm/lib/Target/PowerPC/PPCRegisterInfo.h b/llvm/lib/Target/PowerPC/PPCRegisterInfo.h index d05bc70c11d..7fb0af29530 100644 --- a/llvm/lib/Target/PowerPC/PPCRegisterInfo.h +++ b/llvm/lib/Target/PowerPC/PPCRegisterInfo.h @@ -57,7 +57,9 @@ public: 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 diff --git a/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp b/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp index 44f3adce043..75c3378cbb6 100644 --- a/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp +++ b/llvm/lib/Target/Sparc/SparcRegisterInfo.cpp @@ -200,8 +200,14 @@ void SparcRegisterInfo::emitEpilogue(MachineFunction &MF, BuildMI(MBB, MBBI, SP::RESTORErr, 2, SP::G0).addReg(SP::G0).addReg(SP::G0); } +unsigned SparcRegisterInfo::getRARegister() const { + assert(0 && "What is the return address register"); + return 0; +} + unsigned SparcRegisterInfo::getFrameRegister(MachineFunction &MF) const { - return getDwarfRegNum(SP::G1); + assert(0 && "What is the frame register"); + return SP::G1; } #include "SparcGenRegisterInfo.inc" diff --git a/llvm/lib/Target/Sparc/SparcRegisterInfo.h b/llvm/lib/Target/Sparc/SparcRegisterInfo.h index d36b3c1eed0..176e93491b0 100644 --- a/llvm/lib/Target/Sparc/SparcRegisterInfo.h +++ b/llvm/lib/Target/Sparc/SparcRegisterInfo.h @@ -58,6 +58,7 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo { void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; // Debug information queries. + unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction &MF) const; }; diff --git a/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.cpp b/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.cpp index 267d69a4f76..a49525b46e4 100644 --- a/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.cpp +++ b/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.cpp @@ -317,6 +317,15 @@ void SparcV9RegisterInfo::emitEpilogue(MachineFunction &MF, abort (); } +int SparcV9RegisterInfo::getDwarfRegNum(unsigned RegNum) const { + abort (); + return 0; +} + +unsigned SparcV9RegisterInfo::getRARegister() const { + abort (); + return 0; +} unsigned SparcV9RegisterInfo::getFrameRegister(MachineFunction &MF) const { abort (); diff --git a/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.h b/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.h index 6de47cbb629..c9570d3a933 100644 --- a/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.h +++ b/llvm/lib/Target/SparcV9/SparcV9RegisterInfo.h @@ -46,6 +46,8 @@ struct SparcV9RegisterInfo : public MRegisterInfo { void emitEpilogue (MachineFunction &MF, MachineBasicBlock &MBB) const; // Debug information queries. + int getDwarfRegNum(unsigned RegNum) const; + unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction &MF) const; }; diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index 08dea90ddd0..647f3886b92 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -686,8 +686,12 @@ void X86RegisterInfo::emitEpilogue(MachineFunction &MF, } } +unsigned X86RegisterInfo::getRARegister() const { + return X86::ST0; // use a non-register register +} + unsigned X86RegisterInfo::getFrameRegister(MachineFunction &MF) const { - return getDwarfRegNum(hasFP(MF) ? X86::EBP : X86::ESP); + return hasFP(MF) ? X86::EBP : X86::ESP; } #include "X86GenRegisterInfo.inc" diff --git a/llvm/lib/Target/X86/X86RegisterInfo.h b/llvm/lib/Target/X86/X86RegisterInfo.h index 998fb398d91..1cfd2730d86 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.h +++ b/llvm/lib/Target/X86/X86RegisterInfo.h @@ -64,6 +64,7 @@ struct X86RegisterInfo : public X86GenRegisterInfo { void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; // Debug information queries. + unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction &MF) const; }; |