1 //===- MSP430RegisterInfo.cpp - MSP430 Register Information ---------------===//
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 MSP430 implementation of the TargetRegisterInfo class.
12 //===----------------------------------------------------------------------===//
14 #define DEBUG_TYPE "msp430-reg-info"
17 #include "MSP430RegisterInfo.h"
18 #include "llvm/CodeGen/MachineFrameInfo.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/Target/TargetMachine.h"
21 #include "llvm/Target/TargetOptions.h"
22 #include "llvm/ADT/BitVector.h"
26 // FIXME: Provide proper call frame setup / destroy opcodes.
27 MSP430RegisterInfo::MSP430RegisterInfo(const TargetInstrInfo
&tii
)
28 : MSP430GenRegisterInfo(MSP430::NOP
, MSP430::NOP
),
32 MSP430RegisterInfo::getCalleeSavedRegs(const MachineFunction
*MF
) const {
33 static const unsigned CalleeSavedRegs
[] = {
34 MSP430::FPW
, MSP430::R5W
, MSP430::R6W
, MSP430::R7W
,
35 MSP430::R8W
, MSP430::R9W
, MSP430::R10W
, MSP430::R11W
,
39 return CalleeSavedRegs
;
42 const TargetRegisterClass
* const*
43 MSP430RegisterInfo::getCalleeSavedRegClasses(const MachineFunction
*MF
) const {
44 static const TargetRegisterClass
* const CalleeSavedRegClasses
[] = {
45 &MSP430::GR16RegClass
, &MSP430::GR16RegClass
,
46 &MSP430::GR16RegClass
, &MSP430::GR16RegClass
,
47 &MSP430::GR16RegClass
, &MSP430::GR16RegClass
,
48 &MSP430::GR16RegClass
, &MSP430::GR16RegClass
,
52 return CalleeSavedRegClasses
;
56 MSP430RegisterInfo::getReservedRegs(const MachineFunction
&MF
) const {
57 BitVector
Reserved(getNumRegs());
59 // Mark 4 special registers as reserved.
60 Reserved
.set(MSP430::PCW
);
61 Reserved
.set(MSP430::SPW
);
62 Reserved
.set(MSP430::SRW
);
63 Reserved
.set(MSP430::CGW
);
65 // Mark frame pointer as reserved if needed.
67 Reserved
.set(MSP430::FPW
);
72 bool MSP430RegisterInfo::hasFP(const MachineFunction
&MF
) const {
73 return NoFramePointerElim
|| MF
.getFrameInfo()->hasVarSizedObjects();
77 MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II
,
78 int SPAdj
, RegScavenger
*RS
) const {
79 assert(0 && "Not implemented yet!");
82 void MSP430RegisterInfo::emitPrologue(MachineFunction
&MF
) const {
86 void MSP430RegisterInfo::emitEpilogue(MachineFunction
&MF
,
87 MachineBasicBlock
&MBB
) const {
91 unsigned MSP430RegisterInfo::getRARegister() const {
92 assert(0 && "Not implemented yet!");
95 unsigned MSP430RegisterInfo::getFrameRegister(MachineFunction
&MF
) const {
96 assert(0 && "Not implemented yet!");
99 int MSP430RegisterInfo::getDwarfRegNum(unsigned RegNum
, bool isEH
) const {
100 assert(0 && "Not implemented yet!");
103 #include "MSP430GenRegisterInfo.inc"