Adding files for Microchip's PIC16 target.
[oota-llvm.git] / lib / Target / PIC16 / PIC16RegisterInfo.td
1 //===- PIC16RegisterInfo.td - PIC16 Register defs ------------*- tblgen -*-===//
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 //===----------------------------------------------------------------------===//
11 //  Declarations that describe the PIC16 register file
12 //===----------------------------------------------------------------------===//
13
14 // We have banks of 32 registers each.
15 class PIC16Reg<string n> : Register<n> {
16   field bits<5> Num;
17   let Namespace = "PIC16";
18 }
19
20 // PIC16 CPU Registers
21 class PIC16GPRReg<bits<5> num, string n> : PIC16Reg<n> {
22   let Num = num;
23 }
24
25 // CPU GPR Registers
26 def FSR0 : PIC16GPRReg< 0, "FSR0">, DwarfRegNum<[0]>;
27 def FSR1 : PIC16GPRReg< 1, "FSR1">, DwarfRegNum<[1]>;
28
29 // CPU Registers Class
30 def PTRRegs : RegisterClass<"PIC16", [i16], 8, 
31   [FSR0, FSR1]>
32 {
33   let MethodProtos = [{
34     iterator allocation_order_end(const MachineFunction &MF) const;
35   }];
36   let MethodBodies = [{
37     PTRRegsClass::iterator
38     PTRRegsClass::allocation_order_end(const MachineFunction &MF) const {
39       return end();
40     }
41   }];
42 }
43
44 def WREG : PIC16GPRReg< 0, "WREG">, DwarfRegNum<[0]>;
45
46 // CPU Registers Class
47 def CPURegs : RegisterClass<"PIC16", [i8], 8, 
48   [WREG]>
49 {
50   let MethodProtos = [{
51     iterator allocation_order_end(const MachineFunction &MF) const;
52   }];
53   let MethodBodies = [{
54     CPURegsClass::iterator
55     CPURegsClass::allocation_order_end(const MachineFunction &MF) const {
56       return end();
57     }
58   }];
59 }
60
61 def STATUSREG : PIC16GPRReg<2, "STATUS">, DwarfRegNum<[0]>;
62
63 // STATUS Registers Class
64 def STATUSRegs : RegisterClass<"PIC16", [i8], 8, 
65   [STATUSREG]>;
66
67
68 // Dummy stack pointer.
69 def STKPTR : PIC16GPRReg< 0, "SP">, DwarfRegNum<[0]>;
70
71 // CPU Registers Class
72 def STKRegs : RegisterClass<"PIC16", [i8], 8, 
73   [STKPTR]>
74 {
75   let MethodProtos = [{
76     iterator allocation_order_end(const MachineFunction &MF) const;
77   }];
78   let MethodBodies = [{
79     STKRegsClass::iterator
80     STKRegsClass::allocation_order_end(const MachineFunction &MF) const {
81       return end();
82     }
83   }];
84 }