1 //===- XtensaRegisterInfo.td - Xtensa Register defs --------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6 // See https://llvm.org/LICENSE.txt for license information.
7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
15 class XtensaReg<string n> : Register<n> {
16 let Namespace = "Xtensa";
19 class XtensaRegWithSubRegs<string n, list<Register> subregs>
20 : RegisterWithSubRegs<n, subregs> {
21 let Namespace = "Xtensa";
24 //===----------------------------------------------------------------------===//
25 // General-purpose registers
26 //===----------------------------------------------------------------------===//
28 // Xtensa general purpose regs
29 class ARReg<bits<4> num, string n, list<string> alt = []> : XtensaReg<n> {
30 let HWEncoding{3-0} = num;
35 def A0 : ARReg<0, "a0">, DwarfRegNum<[0]>;
37 // Stack Pointer (callee-saved)
38 def SP : ARReg<1, "a1", ["sp"]>, DwarfRegNum<[1]>;
41 def A2 : ARReg<2, "a2">, DwarfRegNum<[2]>;
42 def A3 : ARReg<3, "a3">, DwarfRegNum<[3]>;
43 def A4 : ARReg<4, "a4">, DwarfRegNum<[4]>;
44 def A5 : ARReg<5, "a5">, DwarfRegNum<[5]>;
45 def A6 : ARReg<6, "a6">, DwarfRegNum<[6]>;
46 def A7 : ARReg<7, "a7">, DwarfRegNum<[7]>;
49 def A8 : ARReg<8, "a8">, DwarfRegNum<[8]>;
51 def A9 : ARReg<9, "a9">, DwarfRegNum<[9]>;
52 def A10 : ARReg<10, "a10">, DwarfRegNum<[10]>;
53 def A11 : ARReg<11, "a11">, DwarfRegNum<[11]>;
56 def A12 : ARReg<12, "a12">, DwarfRegNum<[12]>;
57 def A13 : ARReg<13, "a13">, DwarfRegNum<[13]>;
58 def A14 : ARReg<14, "a14">, DwarfRegNum<[14]>;
60 // Stack-Frame Pointer (optional) - Callee-Saved
61 def A15 : ARReg<15, "a15">, DwarfRegNum<[15]>;
63 // Register class with allocation order
64 def AR : RegisterClass<"Xtensa", [i32], 32, (add
65 A8, A9, A10, A11, A12, A13, A14, A15,
66 A7, A6, A5, A4, A3, A2, A0, SP)>;
67 //===----------------------------------------------------------------------===//
68 // Special-purpose registers
69 //===----------------------------------------------------------------------===//
70 class SRReg<bits<8> num, string n, list<string> alt = []> : XtensaReg<n> {
71 let HWEncoding{7-0} = num;
75 // Shift Amount Register
76 def SAR : SRReg<3, "sar", ["SAR","3"]>;
78 def SR : RegisterClass<"Xtensa", [i32], 32, (add SAR)>;