1 //===-- SPIRVRegisterInfo.td - SPIR-V Register defs --------*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Declarations that describe the SPIR-V register file.
11 //===----------------------------------------------------------------------===//
13 let Namespace = "SPIRV" in {
14 def p0 : PtrValueType <i32, 0>;
15 // All registers are for 32-bit identifiers, so have a single dummy register
17 // Class for registers that are the result of OpTypeXXX instructions
18 def TYPE0 : Register<"TYPE0">;
19 def TYPE : RegisterClass<"SPIRV", [i32], 32, (add TYPE0)>;
21 // Class for every other non-type ID
22 def ID0 : Register<"ID0">;
23 def ID : RegisterClass<"SPIRV", [i32], 32, (add ID0)>;
24 def fID0 : Register<"FID0">;
25 def fID : RegisterClass<"SPIRV", [f32], 32, (add fID0)>;
26 def pID0 : Register<"pID0">;
27 def pID : RegisterClass<"SPIRV", [p0], 32, (add pID0)>;
28 def vID0 : Register<"pID0">;
29 def vID : RegisterClass<"SPIRV", [v2i32], 32, (add vID0)>;
30 def vfID0 : Register<"pID0">;
31 def vfID : RegisterClass<"SPIRV", [v2f32], 32, (add vfID0)>;
33 def ANYID : RegisterClass<"SPIRV", [i32, f32, p0, v2i32, v2f32], 32, (add ID, fID, pID, vID, vfID)>;
35 // A few instructions like OpName can take ids from both type and non-type
36 // instructions, so we need a super-class to allow for both to count as valid
37 // arguments for these instructions.
38 def ANY : RegisterClass<"SPIRV", [i32], 32, (add TYPE, ID)>;