File: ARCRegisterInfo.td

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (79 lines) | stat: -rw-r--r-- 2,533 bytes parent folder | download | duplicates (25)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//===- ARCRegisterInfo.td - ARC Register defs --------------*- tablegen -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
//  Declarations that describe the ARC register file
//===----------------------------------------------------------------------===//

class ARCReg<string n, list<string> altNames> : Register<n, altNames> {
  field bits<6> HwEncoding;
  let Namespace = "ARC";
}

// Registers are identified with 6-bit ID numbers.
// Core - 32-bit core registers
class Core<int num, string n, list<string>altNames=[]> : ARCReg<n, altNames> {
  let HWEncoding = num;
}

// Auxilary register
class Aux<int num, string n, list<string> altNames=[]> : ARCReg<n, altNames> {
  let HWEncoding = num;
}

// Integer registers
foreach i = 0 - 3 in
  def R#i : Core<i, "%r"#i>, DwarfRegNum<[i]>;

let CostPerUse=[1] in {
  foreach i = 4 - 11 in
    def R#i : Core<i, "%r"#i>, DwarfRegNum<[i]>;
}

foreach i = 12 - 15 in
  def R#i : Core<i, "%r"#i>, DwarfRegNum<[i]>;

let CostPerUse=[1] in {

  foreach i = 16 - 25 in
    def R#i : Core<i, "%r"#i>, DwarfRegNum<[i]>;

  def GP : Core<26, "%gp",["%r26"]>, DwarfRegNum<[26]>;
  def FP : Core<27, "%fp", ["%r27"]>, DwarfRegNum<[27]>;
  def SP : Core<28, "%sp", ["%r28"]>, DwarfRegNum<[28]>;
  def ILINK : Core<29, "%ilink">, DwarfRegNum<[29]>;
  def R30 : Core<30, "%r30">, DwarfRegNum<[30]>;
  def BLINK : Core<31, "%blink">, DwarfRegNum<[31]>;

  // Define extended core registers R32..R63
  foreach i = 32 - 63 in
    def R#i : Core<i, "%r"#i>, DwarfRegNum<[i]>;
}

// Auxilary registers
let CostPerUse=[1] in {
  def STATUS32 : Aux<10, "status32">; // No DwarfRegNum defined in the ARC ABI
}

def GPR32: RegisterClass<"ARC", [i32], 32,
  (add (sequence "R%u", 0, 25), GP, FP, SP, ILINK, R30, BLINK, (sequence "R%u", 32, 63))> {
  let AltOrders=[(add (sequence "R%u", 0, 25), GP, FP, SP, ILINK, R30, BLINK)];
  let AltOrderSelect = [{
      // When referenced in a C++ code block like this
      // 0 is all Core32 regs
      // 1 is AltOrders[0]
      // 2 is AltOrders[1] and so on
      return 1;
    }];
}

def SREG : RegisterClass<"ARC", [i32], 1, (add STATUS32)>;

def GPR_S : RegisterClass<"ARC", [i32], 8,
  (add R0, R1, R2, R3, R12, R13, R14, R15)>;