1 //===- PPCRegisterInfo.h - PowerPC Register Information Impl -----*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the PowerPC implementation of the MRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef POWERPC32_REGISTERINFO_H
15 #define POWERPC32_REGISTERINFO_H
18 #include "PPCGenRegisterInfo.h.inc"
23 class TargetInstrInfo
;
26 class PPCRegisterInfo
: public PPCGenRegisterInfo
{
27 std::map
<unsigned, unsigned> ImmToIdxMap
;
28 const PPCSubtarget
&Subtarget
;
29 const TargetInstrInfo
&TII
;
31 PPCRegisterInfo(const PPCSubtarget
&SubTarget
, const TargetInstrInfo
&tii
);
33 /// getRegisterNumbering - Given the enum value for some register, e.g.
34 /// PPC::F14, return the number that it corresponds to (e.g. 14).
35 static unsigned getRegisterNumbering(unsigned RegEnum
);
37 /// Code Generation virtual methods...
38 void reMaterialize(MachineBasicBlock
&MBB
, MachineBasicBlock::iterator MI
,
39 unsigned DestReg
, const MachineInstr
*Orig
) const;
41 const unsigned *getCalleeSavedRegs(const MachineFunction
* MF
= 0) const;
43 const TargetRegisterClass
* const*
44 getCalleeSavedRegClasses(const MachineFunction
*MF
= 0) const;
46 BitVector
getReservedRegs(const MachineFunction
&MF
) const;
48 /// targetHandlesStackFrameRounding - Returns true if the target is
49 /// responsible for rounding up the stack frame (probably at emitPrologue
51 bool targetHandlesStackFrameRounding() const { return true; }
53 bool hasFP(const MachineFunction
&MF
) const;
55 void eliminateCallFramePseudoInstr(MachineFunction
&MF
,
56 MachineBasicBlock
&MBB
,
57 MachineBasicBlock::iterator I
) const;
59 void lowerDynamicAlloc(MachineBasicBlock::iterator II
) const;
60 void eliminateFrameIndex(MachineBasicBlock::iterator II
,
61 int SPAdj
, RegScavenger
*RS
= NULL
) const;
63 /// determineFrameLayout - Determine the size of the frame and maximum call
65 void determineFrameLayout(MachineFunction
&MF
) const;
67 void processFunctionBeforeCalleeSavedScan(MachineFunction
&MF
,
68 RegScavenger
*RS
= NULL
) const;
69 void emitPrologue(MachineFunction
&MF
) const;
70 void emitEpilogue(MachineFunction
&MF
, MachineBasicBlock
&MBB
) const;
72 // Debug information queries.
73 unsigned getRARegister() const;
74 unsigned getFrameRegister(MachineFunction
&MF
) const;
75 void getInitialFrameState(std::vector
<MachineMove
> &Moves
) const;
77 // Exception handling queries.
78 unsigned getEHExceptionRegister() const;
79 unsigned getEHHandlerRegister() const;
81 int getDwarfRegNum(unsigned RegNum
, bool isEH
) const;
84 } // end namespace llvm