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;
27 // Subregister indices, keep in sync with BlackfinRegisterInfo.td
34 struct BlackfinRegisterInfo : public BlackfinGenRegisterInfo {
35 BlackfinSubtarget &Subtarget;
36 const TargetInstrInfo &TII;
38 BlackfinRegisterInfo(BlackfinSubtarget &st, const TargetInstrInfo &tii);
40 /// Code Generation virtual methods...
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 // getSubReg implemented by tablegen
50 const TargetRegisterClass *getPointerRegClass(unsigned Kind = 0) const {
51 return &BF::PRegClass;
54 const TargetRegisterClass *getPhysicalRegisterRegClass(unsigned reg,
57 bool hasFP(const MachineFunction &MF) const;
59 // bool hasReservedCallFrame(MachineFunction &MF) const;
61 bool requiresRegisterScavenging(const MachineFunction &MF) const;
63 void eliminateCallFramePseudoInstr(MachineFunction &MF,
64 MachineBasicBlock &MBB,
65 MachineBasicBlock::iterator I) const;
67 unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
68 int SPAdj, FrameIndexValue *Value = NULL,
69 RegScavenger *RS = NULL) const;
71 void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
72 RegScavenger *RS) const;
74 void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
76 void emitPrologue(MachineFunction &MF) const;
77 void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
79 unsigned getFrameRegister(const MachineFunction &MF) const;
80 unsigned getRARegister() const;
82 // Exception handling queries.
83 unsigned getEHExceptionRegister() const;
84 unsigned getEHHandlerRegister() const;
86 int getDwarfRegNum(unsigned RegNum, bool isEH) const;
89 void adjustRegister(MachineBasicBlock &MBB,
90 MachineBasicBlock::iterator I,
95 void loadConstant(MachineBasicBlock &MBB,
96 MachineBasicBlock::iterator I,
102 } // end namespace llvm