Disable stack coloring with register for now. It's not able to set kill markers.
[llvm/avr.git] / lib / Target / Blackfin / BlackfinRegisterInfo.h
blob8af65a3ef847708516295a1b1e186e90ddfb8fdc
1 //===- BlackfinRegisterInfo.h - Blackfin Register Information ..-*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the Blackfin implementation of the TargetRegisterInfo
11 // class.
13 //===----------------------------------------------------------------------===//
15 #ifndef BLACKFINREGISTERINFO_H
16 #define BLACKFINREGISTERINFO_H
18 #include "llvm/Target/TargetRegisterInfo.h"
19 #include "BlackfinGenRegisterInfo.h.inc"
21 namespace llvm {
23 class BlackfinSubtarget;
24 class TargetInstrInfo;
25 class Type;
27 template<unsigned N>
28 static inline bool isImm(int x) {
29 return x >= -(1<<(N-1)) && x < (1<<(N-1));
32 template<unsigned N>
33 static inline bool isUimm(unsigned x) {
34 return x < (1<<N);
37 // Subregister indices, keep in sync with BlackfinRegisterInfo.td
38 enum BfinSubregIdx {
39 bfin_subreg_lo16 = 1,
40 bfin_subreg_hi16 = 2,
41 bfin_subreg_lo32 = 3
44 struct BlackfinRegisterInfo : public BlackfinGenRegisterInfo {
45 BlackfinSubtarget &Subtarget;
46 const TargetInstrInfo &TII;
48 BlackfinRegisterInfo(BlackfinSubtarget &st, const TargetInstrInfo &tii);
50 /// Code Generation virtual methods...
51 const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
53 const TargetRegisterClass* const*
54 getCalleeSavedRegClasses(const MachineFunction *MF = 0) const;
56 BitVector getReservedRegs(const MachineFunction &MF) const;
58 // getSubReg implemented by tablegen
60 const TargetRegisterClass *getPointerRegClass(unsigned Kind = 0) const {
61 return &BF::PRegClass;
64 const TargetRegisterClass *getPhysicalRegisterRegClass(unsigned reg,
65 MVT VT) const;
67 bool hasFP(const MachineFunction &MF) const;
69 // bool hasReservedCallFrame(MachineFunction &MF) const;
71 bool requiresRegisterScavenging(const MachineFunction &MF) const;
73 void eliminateCallFramePseudoInstr(MachineFunction &MF,
74 MachineBasicBlock &MBB,
75 MachineBasicBlock::iterator I) const;
77 void eliminateFrameIndex(MachineBasicBlock::iterator II,
78 int SPAdj, RegScavenger *RS = NULL) const;
80 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
81 RegScavenger *RS) const;
83 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
85 void emitPrologue(MachineFunction &MF) const;
86 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
88 unsigned getFrameRegister(MachineFunction &MF) const;
89 int getFrameIndexOffset(MachineFunction &MF, int FI) const;
90 unsigned getRARegister() const;
92 // Exception handling queries.
93 unsigned getEHExceptionRegister() const;
94 unsigned getEHHandlerRegister() const;
96 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
98 // Utility functions
99 void adjustRegister(MachineBasicBlock &MBB,
100 MachineBasicBlock::iterator I,
101 DebugLoc DL,
102 unsigned Reg,
103 unsigned ScratchReg,
104 int delta) const;
105 void loadConstant(MachineBasicBlock &MBB,
106 MachineBasicBlock::iterator I,
107 DebugLoc DL,
108 unsigned Reg,
109 int value) const;
112 } // end namespace llvm
114 #endif