b40cca988d9a07abff9082f2bfd11823522a5281
[oota-llvm.git] / lib / Target / MSP430 / MSP430RegisterInfo.cpp
1 //===- MSP430RegisterInfo.cpp - MSP430 Register Information ---------------===//
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 MSP430 implementation of the TargetRegisterInfo class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #define DEBUG_TYPE "msp430-reg-info"
15
16 #include "MSP430.h"
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"
23
24 using namespace llvm;
25
26 // FIXME: Provide proper call frame setup / destroy opcodes.
27 MSP430RegisterInfo::MSP430RegisterInfo(const TargetInstrInfo &tii)
28   : MSP430GenRegisterInfo(MSP430::NOP, MSP430::NOP),
29     TII(tii) {}
30
31 const unsigned*
32 MSP430RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
33   assert(0 && "Not implemented yet!");
34 }
35
36 const TargetRegisterClass* const*
37 MSP430RegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const {
38   assert(0 && "Not implemented yet!");
39 }
40
41 BitVector
42 MSP430RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
43   BitVector Reserved(getNumRegs());
44
45   // Mark 4 special registers as reserved.
46   Reserved.set(MSP430::PC);
47   Reserved.set(MSP430::SP);
48   Reserved.set(MSP430::SR);
49   Reserved.set(MSP430::CG);
50
51   // Mark frame pointer as reserved if needed.
52   if (hasFP(MF))
53     Reserved.set(MSP430::FP);
54
55   return Reserved;
56 }
57
58 bool MSP430RegisterInfo::hasFP(const MachineFunction &MF) const {
59   return NoFramePointerElim || MF.getFrameInfo()->hasVarSizedObjects();
60 }
61
62 void
63 MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
64                                         int SPAdj, RegScavenger *RS) const {
65   assert(0 && "Not implemented yet!");
66 }
67
68 void MSP430RegisterInfo::emitPrologue(MachineFunction &MF) const {
69   assert(0 && "Not implemented yet!");
70 }
71
72 void MSP430RegisterInfo::emitEpilogue(MachineFunction &MF,
73                                       MachineBasicBlock &MBB) const {
74   assert(0 && "Not implemented yet!");
75 }
76
77 unsigned MSP430RegisterInfo::getRARegister() const {
78   assert(0 && "Not implemented yet!");
79 }
80
81 unsigned MSP430RegisterInfo::getFrameRegister(MachineFunction &MF) const {
82   assert(0 && "Not implemented yet!");
83 }
84
85 int MSP430RegisterInfo::getDwarfRegNum(unsigned RegNum, bool isEH) const {
86   assert(0 && "Not implemented yet!");
87 }
88
89 #include "MSP430GenRegisterInfo.inc"