• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===-- Nios2RegisterInfo.td - Nios2 Register defs ---------*- tablegen -*-===//
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// We have bank of 32 registers.
11class Nios2Reg<string n> : Register<n> {
12  field bits<5> Num;
13  let Namespace = "Nios2";
14}
15
16// Nios2 CPU Registers
17class Nios2GPRReg<bits<5> num, string n> : Nios2Reg<n> {
18  let Num = num;
19}
20
21//===----------------------------------------------------------------------===//
22//  Registers
23//===----------------------------------------------------------------------===//
24
25let Namespace = "Nios2" in {
26  // General Purpose Registers
27  def ZERO : Nios2GPRReg<0, "zero">, DwarfRegNum<[ 0 ]>;
28  def AT : Nios2GPRReg<1, "at">, DwarfRegNum<[ 1 ]>;
29  foreach RegNum = 2 - 23 in {
30    def R #RegNum : Nios2GPRReg<RegNum, "r" #RegNum>, DwarfRegNum<[ RegNum ]>;
31  }
32  def ET : Nios2GPRReg<24, "et">, DwarfRegNum<[ 24 ]>;
33  def BT : Nios2GPRReg<25, "bt">, DwarfRegNum<[ 25 ]>;
34  def GP : Nios2GPRReg<26, "gp">, DwarfRegNum<[ 26 ]>;
35  def SP : Nios2GPRReg<27, "sp">, DwarfRegNum<[ 27 ]>;
36  def FP : Nios2GPRReg<28, "fp">, DwarfRegNum<[ 28 ]>;
37  def EA : Nios2GPRReg<29, "ea">, DwarfRegNum<[ 29 ]>;
38  def BA : Nios2GPRReg<30, "ba">, DwarfRegNum<[ 30 ]>;
39  def RA : Nios2GPRReg<31, "ra">, DwarfRegNum<[ 31 ]>;
40  def PC : Nios2Reg<"pc">, DwarfRegNum<[ 32 ]>;
41}
42
43//===----------------------------------------------------------------------===//
44// Register Classes
45//===----------------------------------------------------------------------===//
46
47def CPURegs : RegisterClass<"Nios2", [ i32 ], 32,
48                            (add
49                            // Reserved
50                            ZERO,
51                            AT,
52                            // Return Values and Arguments
53                            (sequence "R%u", 2, 7),
54                            // Not preserved across procedure calls
55                            // Caller saved
56                            (sequence "R%u", 8, 15),
57                            // Callee saved
58                            (sequence "R%u", 16, 23),
59                            // Reserved
60                            ET, BT, GP, SP, FP, EA, BA, RA, PC)>;
61