1 //===- XCoreRegisterInfo.h - XCore 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 XCore implementation of the MRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef XCOREREGISTERINFO_H
15 #define XCOREREGISTERINFO_H
17 #include "llvm/Target/TargetRegisterInfo.h"
18 #include "XCoreGenRegisterInfo.h.inc"
22 class TargetInstrInfo;
24 struct XCoreRegisterInfo : public XCoreGenRegisterInfo {
26 const TargetInstrInfo &TII;
28 void loadConstant(MachineBasicBlock &MBB,
29 MachineBasicBlock::iterator I,
30 unsigned DstReg, int64_t Value, DebugLoc dl) const;
32 void storeToStack(MachineBasicBlock &MBB,
33 MachineBasicBlock::iterator I,
34 unsigned SrcReg, int Offset, DebugLoc dl) const;
36 void loadFromStack(MachineBasicBlock &MBB,
37 MachineBasicBlock::iterator I,
38 unsigned DstReg, int Offset, DebugLoc dl) const;
41 XCoreRegisterInfo(const TargetInstrInfo &tii);
43 /// Code Generation virtual methods...
45 const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
47 const TargetRegisterClass* const* getCalleeSavedRegClasses(
48 const MachineFunction *MF = 0) const;
50 BitVector getReservedRegs(const MachineFunction &MF) const;
52 bool requiresRegisterScavenging(const MachineFunction &MF) const;
54 bool hasFP(const MachineFunction &MF) const;
56 void eliminateCallFramePseudoInstr(MachineFunction &MF,
57 MachineBasicBlock &MBB,
58 MachineBasicBlock::iterator I) const;
60 unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
61 int SPAdj, int *Value = NULL,
62 RegScavenger *RS = NULL) const;
64 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
65 RegScavenger *RS = NULL) const;
67 void processFunctionBeforeFrameFinalized(MachineFunction &MF) 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(const MachineFunction &MF) const;
75 void getInitialFrameState(std::vector<MachineMove> &Moves) const;
77 //! Return the array of argument passing registers
79 \note The size of this array is returned by getArgRegsSize().
81 static const unsigned *getArgRegs(const MachineFunction *MF = 0);
83 //! Return the size of the argument passing register array
84 static unsigned getNumArgRegs(const MachineFunction *MF = 0);
86 //! Return whether to emit frame moves
87 static bool needsFrameMoves(const MachineFunction &MF);
89 //! Get DWARF debugging register number
90 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
93 } // end namespace llvm