1//===-- BPFRegisterInfo.td - BPF 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//===----------------------------------------------------------------------===// 11// Declarations that describe the BPF register file 12//===----------------------------------------------------------------------===// 13 14let Namespace = "BPF" in { 15 def sub_32 : SubRegIndex<32>; 16} 17 18class Wi<bits<16> Enc, string n> : Register<n> { 19 let HWEncoding = Enc; 20 let Namespace = "BPF"; 21} 22 23// Registers are identified with 4-bit ID numbers. 24// Ri - 64-bit integer registers 25class Ri<bits<16> Enc, string n, list<Register> subregs> 26 : RegisterWithSubRegs<n, subregs> { 27 let HWEncoding = Enc; 28 let Namespace = "BPF"; 29 let SubRegIndices = [sub_32]; 30} 31 32foreach I = 0-11 in { 33 // 32-bit Integer (alias to low part of 64-bit register). 34 def W#I : Wi<I, "w"#I>, DwarfRegNum<[I]>; 35 // 64-bit Integer registers 36 def R#I : Ri<I, "r"#I, [!cast<Wi>("W"#I)]>, DwarfRegNum<[I]>; 37} 38 39// Register classes. 40def GPR32 : RegisterClass<"BPF", [i32], 32, (add 41 (sequence "W%u", 1, 9), 42 W0, // Return value 43 W11, // Stack Ptr 44 W10 // Frame Ptr 45)>; 46 47def GPR : RegisterClass<"BPF", [i64], 64, (add 48 (sequence "R%u", 1, 9), 49 R0, // Return value 50 R11, // Stack Ptr 51 R10 // Frame Ptr 52)>; 53