1 //===- BlackfinRegisterInfo.h - Blackfin Register Information ..-*- 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 Blackfin implementation of the TargetRegisterInfo
13 //===----------------------------------------------------------------------===//
15 #ifndef BLACKFINREGISTERINFO_H
16 #define BLACKFINREGISTERINFO_H
18 #include "llvm/Target/TargetRegisterInfo.h"
19 #include "BlackfinGenRegisterInfo.h.inc"
23 class BlackfinSubtarget
;
24 class TargetInstrInfo
;
28 static inline bool isImm(int x
) {
29 return x
>= -(1<<(N
-1)) && x
< (1<<(N
-1));
33 static inline bool isUimm(unsigned x
) {
37 // Subregister indices, keep in sync with BlackfinRegisterInfo.td
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
,
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;
99 void adjustRegister(MachineBasicBlock
&MBB
,
100 MachineBasicBlock::iterator I
,
105 void loadConstant(MachineBasicBlock
&MBB
,
106 MachineBasicBlock::iterator I
,
112 } // end namespace llvm