xref: /aosp_15_r20/external/llvm/lib/Target/MSP430/MSP430RegisterInfo.td (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker//===-- MSP430RegisterInfo.td - MSP430 Register defs -------*- tablegen -*-===//
2*9880d681SAndroid Build Coastguard Worker//
3*9880d681SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker//
5*9880d681SAndroid Build Coastguard Worker// This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker// License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker//
8*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
11*9880d681SAndroid Build Coastguard Worker//  Declarations that describe the MSP430 register file
12*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerclass MSP430Reg<bits<4> num, string n> : Register<n> {
15*9880d681SAndroid Build Coastguard Worker  field bits<4> Num = num;
16*9880d681SAndroid Build Coastguard Worker  let Namespace = "MSP430";
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerclass MSP430RegWithSubregs<bits<4> num, string n, list<Register> subregs>
20*9880d681SAndroid Build Coastguard Worker  : RegisterWithSubRegs<n, subregs> {
21*9880d681SAndroid Build Coastguard Worker  field bits<4> Num = num;
22*9880d681SAndroid Build Coastguard Worker  let Namespace = "MSP430";
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
26*9880d681SAndroid Build Coastguard Worker//  Registers
27*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdef PCB  : MSP430Reg<0,  "r0">;
30*9880d681SAndroid Build Coastguard Workerdef SPB  : MSP430Reg<1,  "r1">;
31*9880d681SAndroid Build Coastguard Workerdef SRB  : MSP430Reg<2,  "r2">;
32*9880d681SAndroid Build Coastguard Workerdef CGB  : MSP430Reg<3,  "r3">;
33*9880d681SAndroid Build Coastguard Workerdef FPB  : MSP430Reg<4,  "r4">;
34*9880d681SAndroid Build Coastguard Workerdef R5B  : MSP430Reg<5,  "r5">;
35*9880d681SAndroid Build Coastguard Workerdef R6B  : MSP430Reg<6,  "r6">;
36*9880d681SAndroid Build Coastguard Workerdef R7B  : MSP430Reg<7,  "r7">;
37*9880d681SAndroid Build Coastguard Workerdef R8B  : MSP430Reg<8,  "r8">;
38*9880d681SAndroid Build Coastguard Workerdef R9B  : MSP430Reg<9,  "r9">;
39*9880d681SAndroid Build Coastguard Workerdef R10B : MSP430Reg<10, "r10">;
40*9880d681SAndroid Build Coastguard Workerdef R11B : MSP430Reg<11, "r11">;
41*9880d681SAndroid Build Coastguard Workerdef R12B : MSP430Reg<12, "r12">;
42*9880d681SAndroid Build Coastguard Workerdef R13B : MSP430Reg<13, "r13">;
43*9880d681SAndroid Build Coastguard Workerdef R14B : MSP430Reg<14, "r14">;
44*9880d681SAndroid Build Coastguard Workerdef R15B : MSP430Reg<15, "r15">;
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Workerdef subreg_8bit : SubRegIndex<8> { let Namespace = "MSP430"; }
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Workerlet SubRegIndices = [subreg_8bit] in {
49*9880d681SAndroid Build Coastguard Workerdef PC  : MSP430RegWithSubregs<0,  "r0",  [PCB]>;
50*9880d681SAndroid Build Coastguard Workerdef SP  : MSP430RegWithSubregs<1,  "r1",  [SPB]>;
51*9880d681SAndroid Build Coastguard Workerdef SR  : MSP430RegWithSubregs<2,  "r2",  [SRB]>;
52*9880d681SAndroid Build Coastguard Workerdef CG  : MSP430RegWithSubregs<3,  "r3",  [CGB]>;
53*9880d681SAndroid Build Coastguard Workerdef FP  : MSP430RegWithSubregs<4,  "r4",  [FPB]>;
54*9880d681SAndroid Build Coastguard Workerdef R5  : MSP430RegWithSubregs<5,  "r5",  [R5B]>;
55*9880d681SAndroid Build Coastguard Workerdef R6  : MSP430RegWithSubregs<6,  "r6",  [R6B]>;
56*9880d681SAndroid Build Coastguard Workerdef R7  : MSP430RegWithSubregs<7,  "r7",  [R7B]>;
57*9880d681SAndroid Build Coastguard Workerdef R8  : MSP430RegWithSubregs<8,  "r8",  [R8B]>;
58*9880d681SAndroid Build Coastguard Workerdef R9  : MSP430RegWithSubregs<9,  "r9",  [R9B]>;
59*9880d681SAndroid Build Coastguard Workerdef R10 : MSP430RegWithSubregs<10, "r10", [R10B]>;
60*9880d681SAndroid Build Coastguard Workerdef R11 : MSP430RegWithSubregs<11, "r11", [R11B]>;
61*9880d681SAndroid Build Coastguard Workerdef R12 : MSP430RegWithSubregs<12, "r12", [R12B]>;
62*9880d681SAndroid Build Coastguard Workerdef R13 : MSP430RegWithSubregs<13, "r13", [R13B]>;
63*9880d681SAndroid Build Coastguard Workerdef R14 : MSP430RegWithSubregs<14, "r14", [R14B]>;
64*9880d681SAndroid Build Coastguard Workerdef R15 : MSP430RegWithSubregs<15, "r15", [R15B]>;
65*9880d681SAndroid Build Coastguard Worker}
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Workerdef GR8 : RegisterClass<"MSP430", [i8], 8,
68*9880d681SAndroid Build Coastguard Worker   // Volatile registers
69*9880d681SAndroid Build Coastguard Worker  (add R12B, R13B, R14B, R15B, R11B, R10B, R9B, R8B, R7B, R6B, R5B,
70*9880d681SAndroid Build Coastguard Worker   // Frame pointer, sometimes allocable
71*9880d681SAndroid Build Coastguard Worker   FPB,
72*9880d681SAndroid Build Coastguard Worker   // Volatile, but not allocable
73*9880d681SAndroid Build Coastguard Worker   PCB, SPB, SRB, CGB)>;
74*9880d681SAndroid Build Coastguard Worker
75*9880d681SAndroid Build Coastguard Workerdef GR16 : RegisterClass<"MSP430", [i16], 16,
76*9880d681SAndroid Build Coastguard Worker   // Volatile registers
77*9880d681SAndroid Build Coastguard Worker  (add R12, R13, R14, R15, R11, R10, R9, R8, R7, R6, R5,
78*9880d681SAndroid Build Coastguard Worker   // Frame pointer, sometimes allocable
79*9880d681SAndroid Build Coastguard Worker   FP,
80*9880d681SAndroid Build Coastguard Worker   // Volatile, but not allocable
81*9880d681SAndroid Build Coastguard Worker   PC, SP, SR, CG)>;
82