//==- SystemZRegisterInfo.td - SystemZ register definitions -*- tablegen -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // Class definitions. //===----------------------------------------------------------------------===// class SystemZReg : Register { let Namespace = "SystemZ"; } class SystemZRegWithSubregs subregs> : RegisterWithSubRegs { let Namespace = "SystemZ"; } let Namespace = "SystemZ" in { def subreg_l32 : SubRegIndex<32, 0>; // Also acts as subreg_ll32. def subreg_h32 : SubRegIndex<32, 32>; // Also acts as subreg_lh32. def subreg_l64 : SubRegIndex<64, 0>; def subreg_h64 : SubRegIndex<64, 64>; def subreg_hh32 : ComposedSubRegIndex; def subreg_hl32 : ComposedSubRegIndex; } // Define a register class that contains values of type TYPE and an // associated operand called NAME. SIZE is the size and alignment // of the registers and REGLIST is the list of individual registers. multiclass SystemZRegClass { def AsmOperand : AsmOperandClass { let Name = name; let ParserMethod = "parse"##name; let RenderMethod = "addRegOperands"; } def Bit : RegisterClass<"SystemZ", [type], size, regList> { let Size = size; } def "" : RegisterOperand(name##"Bit")> { let ParserMatchClass = !cast(name##"AsmOperand"); } } //===----------------------------------------------------------------------===// // General-purpose registers //===----------------------------------------------------------------------===// // Lower 32 bits of one of the 16 64-bit general-purpose registers class GPR32 num, string n> : SystemZReg { let HWEncoding = num; } // One of the 16 64-bit general-purpose registers. class GPR64 num, string n, GPR32 low, GPR32 high> : SystemZRegWithSubregs { let HWEncoding = num; let SubRegIndices = [subreg_l32, subreg_h32]; } // 8 even-odd pairs of GPR64s. class GPR128 num, string n, GPR64 low, GPR64 high> : SystemZRegWithSubregs { let HWEncoding = num; let SubRegIndices = [subreg_l64, subreg_h64]; } // General-purpose registers foreach I = 0-15 in { def R#I#L : GPR32; def R#I#H : GPR32; def R#I#D : GPR64("R"#I#"L"), !cast("R"#I#"H")>, DwarfRegNum<[I]>; } foreach I = [0, 2, 4, 6, 8, 10, 12, 14] in { def R#I#Q : GPR128("R"#!add(I, 1)#"D"), !cast("R"#I#"D")>; } /// Allocate the callee-saved R6-R13 backwards. That way they can be saved /// together with R14 and R15 in one prolog instruction. defm GR32 : SystemZRegClass<"GR32", i32, 32, (add (sequence "R%uL", 0, 5), (sequence "R%uL", 15, 6))>; defm GRH32 : SystemZRegClass<"GRH32", i32, 32, (add (sequence "R%uH", 0, 5), (sequence "R%uH", 15, 6))>; defm GR64 : SystemZRegClass<"GR64", i64, 64, (add (sequence "R%uD", 0, 5), (sequence "R%uD", 15, 6))>; // Combine the low and high GR32s into a single class. This can only be // used for virtual registers if the high-word facility is available. defm GRX32 : SystemZRegClass<"GRX32", i32, 32, (add (sequence "R%uL", 0, 5), (sequence "R%uH", 0, 5), R15L, R15H, R14L, R14H, R13L, R13H, R12L, R12H, R11L, R11H, R10L, R10H, R9L, R9H, R8L, R8H, R7L, R7H, R6L, R6H)>; // The architecture doesn't really have any i128 support, so model the // register pairs as untyped instead. defm GR128 : SystemZRegClass<"GR128", untyped, 128, (add R0Q, R2Q, R4Q, R12Q, R10Q, R8Q, R6Q, R14Q)>; // Base and index registers. Everything except R0, which in an address // context evaluates as 0. defm ADDR32 : SystemZRegClass<"ADDR32", i32, 32, (sub GR32Bit, R0L)>; defm ADDR64 : SystemZRegClass<"ADDR64", i64, 64, (sub GR64Bit, R0D)>; // Not used directly, but needs to exist for ADDR32 and ADDR64 subregs // of a GR128. defm ADDR128 : SystemZRegClass<"ADDR128", untyped, 128, (sub GR128Bit, R0Q)>; //===----------------------------------------------------------------------===// // Floating-point registers //===----------------------------------------------------------------------===// // Lower 32 bits of one of the 16 64-bit floating-point registers class FPR32 num, string n> : SystemZReg { let HWEncoding = num; } // One of the 16 64-bit floating-point registers class FPR64 num, string n, FPR32 low> : SystemZRegWithSubregs { let HWEncoding = num; let SubRegIndices = [subreg_h32]; } // 8 pairs of FPR64s, with a one-register gap inbetween. class FPR128 num, string n, FPR64 low, FPR64 high> : SystemZRegWithSubregs { let HWEncoding = num; let SubRegIndices = [subreg_l64, subreg_h64]; } // Floating-point registers foreach I = 0-15 in { def F#I#S : FPR32; def F#I#D : FPR64("F"#I#"S")>, DwarfRegNum<[!add(I, 16)]>; } foreach I = [0, 1, 4, 5, 8, 9, 12, 13] in { def F#I#Q : FPR128("F"#!add(I, 2)#"D"), !cast("F"#I#"D")>; } // There's no store-multiple instruction for FPRs, so we're not fussy // about the order in which call-saved registers are allocated. defm FP32 : SystemZRegClass<"FP32", f32, 32, (sequence "F%uS", 0, 15)>; defm FP64 : SystemZRegClass<"FP64", f64, 64, (sequence "F%uD", 0, 15)>; defm FP128 : SystemZRegClass<"FP128", f128, 128, (add F0Q, F1Q, F4Q, F5Q, F8Q, F9Q, F12Q, F13Q)>; //===----------------------------------------------------------------------===// // Other registers //===----------------------------------------------------------------------===// // The 2-bit condition code field of the PSW. Every register named in an // inline asm needs a class associated with it. def CC : SystemZReg<"cc">; def CCRegs : RegisterClass<"SystemZ", [i32], 32, (add CC)>;