10b57cec5SDimitry Andric//===-- MSP430RegisterInfo.td - MSP430 Register defs -------*- tablegen -*-===// 20b57cec5SDimitry Andric// 30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric// 70b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 100b57cec5SDimitry Andric// Declarations that describe the MSP430 register file 110b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andricclass MSP430Reg<bits<4> num, string n, list<string> alt = []> : Register<n> { 140b57cec5SDimitry Andric field bits<4> Num = num; 150b57cec5SDimitry Andric let Namespace = "MSP430"; 160b57cec5SDimitry Andric let HWEncoding{3-0} = num; 170b57cec5SDimitry Andric let AltNames = alt; 185ffd83dbSDimitry Andric let DwarfNumbers = [num]; 190b57cec5SDimitry Andric} 200b57cec5SDimitry Andric 210b57cec5SDimitry Andricclass MSP430RegWithSubregs<bits<4> num, string n, list<Register> subregs, 220b57cec5SDimitry Andric list<string> alt = []> 230b57cec5SDimitry Andric : RegisterWithSubRegs<n, subregs> { 240b57cec5SDimitry Andric field bits<4> Num = num; 250b57cec5SDimitry Andric let Namespace = "MSP430"; 260b57cec5SDimitry Andric let HWEncoding{3-0} = num; 270b57cec5SDimitry Andric let AltNames = alt; 285ffd83dbSDimitry Andric let DwarfNumbers = [num]; 290b57cec5SDimitry Andric} 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 320b57cec5SDimitry Andric// Registers 330b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 340b57cec5SDimitry Andric 35*06c3fb27SDimitry Andricdef PCB : MSP430Reg<0, "r0", ["pc"]>, DwarfRegNum<[16]>; 36*06c3fb27SDimitry Andricdef SPB : MSP430Reg<1, "r1", ["sp"]>, DwarfRegNum<[17]>; 37*06c3fb27SDimitry Andricdef SRB : MSP430Reg<2, "r2", ["sr"]>, DwarfRegNum<[18]>; 38*06c3fb27SDimitry Andricdef CGB : MSP430Reg<3, "r3", ["cg"]>, DwarfRegNum<[19]>; 39*06c3fb27SDimitry Andricdef R4B : MSP430Reg<4, "r4", ["fp"]>, DwarfRegNum<[20]>; 40*06c3fb27SDimitry Andricdef R5B : MSP430Reg<5, "r5">, DwarfRegNum<[21]>; 41*06c3fb27SDimitry Andricdef R6B : MSP430Reg<6, "r6">, DwarfRegNum<[22]>; 42*06c3fb27SDimitry Andricdef R7B : MSP430Reg<7, "r7">, DwarfRegNum<[23]>; 43*06c3fb27SDimitry Andricdef R8B : MSP430Reg<8, "r8">, DwarfRegNum<[24]>; 44*06c3fb27SDimitry Andricdef R9B : MSP430Reg<9, "r9">, DwarfRegNum<[25]>; 45*06c3fb27SDimitry Andricdef R10B : MSP430Reg<10, "r10">, DwarfRegNum<[26]>; 46*06c3fb27SDimitry Andricdef R11B : MSP430Reg<11, "r11">, DwarfRegNum<[27]>; 47*06c3fb27SDimitry Andricdef R12B : MSP430Reg<12, "r12">, DwarfRegNum<[28]>; 48*06c3fb27SDimitry Andricdef R13B : MSP430Reg<13, "r13">, DwarfRegNum<[29]>; 49*06c3fb27SDimitry Andricdef R14B : MSP430Reg<14, "r14">, DwarfRegNum<[30]>; 50*06c3fb27SDimitry Andricdef R15B : MSP430Reg<15, "r15">, DwarfRegNum<[31]>; 510b57cec5SDimitry Andric 520b57cec5SDimitry Andricdef subreg_8bit : SubRegIndex<8> { let Namespace = "MSP430"; } 530b57cec5SDimitry Andric 540b57cec5SDimitry Andriclet SubRegIndices = [subreg_8bit] in { 55*06c3fb27SDimitry Andricdef PC : MSP430RegWithSubregs<0, "r0", [PCB], ["pc"]>, DwarfRegNum<[0]>; 56*06c3fb27SDimitry Andricdef SP : MSP430RegWithSubregs<1, "r1", [SPB], ["sp"]>, DwarfRegNum<[1]>; 57*06c3fb27SDimitry Andricdef SR : MSP430RegWithSubregs<2, "r2", [SRB], ["sr"]>, DwarfRegNum<[2]>; 58*06c3fb27SDimitry Andricdef CG : MSP430RegWithSubregs<3, "r3", [CGB], ["cg"]>, DwarfRegNum<[3]>; 59*06c3fb27SDimitry Andricdef R4 : MSP430RegWithSubregs<4, "r4", [R4B], ["fp"]>, DwarfRegNum<[4]>; 60*06c3fb27SDimitry Andricdef R5 : MSP430RegWithSubregs<5, "r5", [R5B]>, DwarfRegNum<[5]>; 61*06c3fb27SDimitry Andricdef R6 : MSP430RegWithSubregs<6, "r6", [R6B]>, DwarfRegNum<[6]>; 62*06c3fb27SDimitry Andricdef R7 : MSP430RegWithSubregs<7, "r7", [R7B]>, DwarfRegNum<[7]>; 63*06c3fb27SDimitry Andricdef R8 : MSP430RegWithSubregs<8, "r8", [R8B]>, DwarfRegNum<[8]>; 64*06c3fb27SDimitry Andricdef R9 : MSP430RegWithSubregs<9, "r9", [R9B]>, DwarfRegNum<[9]>; 65*06c3fb27SDimitry Andricdef R10 : MSP430RegWithSubregs<10, "r10", [R10B]>, DwarfRegNum<[10]>; 66*06c3fb27SDimitry Andricdef R11 : MSP430RegWithSubregs<11, "r11", [R11B]>, DwarfRegNum<[11]>; 67*06c3fb27SDimitry Andricdef R12 : MSP430RegWithSubregs<12, "r12", [R12B]>, DwarfRegNum<[12]>; 68*06c3fb27SDimitry Andricdef R13 : MSP430RegWithSubregs<13, "r13", [R13B]>, DwarfRegNum<[13]>; 69*06c3fb27SDimitry Andricdef R14 : MSP430RegWithSubregs<14, "r14", [R14B]>, DwarfRegNum<[14]>; 70*06c3fb27SDimitry Andricdef R15 : MSP430RegWithSubregs<15, "r15", [R15B]>, DwarfRegNum<[15]>; 710b57cec5SDimitry Andric} 720b57cec5SDimitry Andric 730b57cec5SDimitry Andricdef GR8 : RegisterClass<"MSP430", [i8], 8, 740b57cec5SDimitry Andric // Volatile registers 750b57cec5SDimitry Andric (add R12B, R13B, R14B, R15B, R11B, R10B, R9B, R8B, R7B, R6B, R5B, 760b57cec5SDimitry Andric // Frame pointer, sometimes allocable 775ffd83dbSDimitry Andric R4B, 780b57cec5SDimitry Andric // Volatile, but not allocable 790b57cec5SDimitry Andric PCB, SPB, SRB, CGB)>; 800b57cec5SDimitry Andric 810b57cec5SDimitry Andricdef GR16 : RegisterClass<"MSP430", [i16], 16, 820b57cec5SDimitry Andric // Volatile registers 830b57cec5SDimitry Andric (add R12, R13, R14, R15, R11, R10, R9, R8, R7, R6, R5, 840b57cec5SDimitry Andric // Frame pointer, sometimes allocable 855ffd83dbSDimitry Andric R4, 860b57cec5SDimitry Andric // Volatile, but not allocable 870b57cec5SDimitry Andric PC, SP, SR, CG)>; 88