1 //===- X86RegisterInfo.td - Describe the X86 Register File ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the X86 Register file, defining the registers themselves,
11 // aliases between the registers, and the register classes built out of the
14 //===----------------------------------------------------------------------===//
16 //===----------------------------------------------------------------------===//
17 // Register definitions...
19 let Namespace = "X86" in {
21 // In the register alias definitions below, we define which registers alias
22 // which others. We only specify which registers the small registers alias,
23 // because the register file generator is smart enough to figure out that
24 // AL aliases AX if we tell it that AX aliased AL (for example).
26 // FIXME: X86-64 have different Dwarf numbers.
29 def AL : Register<"AL">, DwarfRegNum<0>;
30 def CL : Register<"CL">, DwarfRegNum<1>;
31 def DL : Register<"DL">, DwarfRegNum<2>;
32 def BL : Register<"BL">, DwarfRegNum<3>;
35 def SIL : Register<"SIL">, DwarfRegNum<4>;
36 def DIL : Register<"DIL">, DwarfRegNum<5>;
37 def BPL : Register<"BPL">, DwarfRegNum<6>;
38 def SPL : Register<"SPL">, DwarfRegNum<7>;
39 def R8B : Register<"R8B">, DwarfRegNum<8>;
40 def R9B : Register<"R9B">, DwarfRegNum<9>;
41 def R10B : Register<"R10B">, DwarfRegNum<10>;
42 def R11B : Register<"R11B">, DwarfRegNum<11>;
43 def R12B : Register<"R12B">, DwarfRegNum<12>;
44 def R13B : Register<"R13B">, DwarfRegNum<13>;
45 def R14B : Register<"R14B">, DwarfRegNum<14>;
46 def R15B : Register<"R15B">, DwarfRegNum<15>;
48 // High registers X86-32 only
49 def AH : Register<"AH">, DwarfRegNum<0>;
50 def CH : Register<"CH">, DwarfRegNum<1>;
51 def DH : Register<"DH">, DwarfRegNum<2>;
52 def BH : Register<"BH">, DwarfRegNum<3>;
55 def AX : RegisterWithSubRegs<"AX", [AH,AL]>, DwarfRegNum<0>;
56 def CX : RegisterWithSubRegs<"CX", [CH,CL]>, DwarfRegNum<1>;
57 def DX : RegisterWithSubRegs<"DX", [DH,DL]>, DwarfRegNum<2>;
58 def BX : RegisterWithSubRegs<"BX", [BH,BL]>, DwarfRegNum<3>;
59 def SP : RegisterWithSubRegs<"SP", [SPL]>, DwarfRegNum<4>;
60 def BP : RegisterWithSubRegs<"BP", [BPL]>, DwarfRegNum<5>;
61 def SI : RegisterWithSubRegs<"SI", [SIL]>, DwarfRegNum<6>;
62 def DI : RegisterWithSubRegs<"DI", [DIL]>, DwarfRegNum<7>;
63 def IP : Register<"IP">, DwarfRegNum<8>;
66 def R8W : RegisterWithSubRegs<"R8W", [R8B]>, DwarfRegNum<8>;
67 def R9W : RegisterWithSubRegs<"R9W", [R9B]>, DwarfRegNum<9>;
68 def R10W : RegisterWithSubRegs<"R10W", [R10B]>, DwarfRegNum<10>;
69 def R11W : RegisterWithSubRegs<"R11W", [R11B]>, DwarfRegNum<11>;
70 def R12W : RegisterWithSubRegs<"R12W", [R12B]>, DwarfRegNum<12>;
71 def R13W : RegisterWithSubRegs<"R13W", [R13B]>, DwarfRegNum<13>;
72 def R14W : RegisterWithSubRegs<"R14W", [R14B]>, DwarfRegNum<14>;
73 def R15W : RegisterWithSubRegs<"R15W", [R15B]>, DwarfRegNum<15>;
76 def EAX : RegisterWithSubRegs<"EAX", [AX]>, DwarfRegNum<0>;
77 def ECX : RegisterWithSubRegs<"ECX", [CX]>, DwarfRegNum<1>;
78 def EDX : RegisterWithSubRegs<"EDX", [DX]>, DwarfRegNum<2>;
79 def EBX : RegisterWithSubRegs<"EBX", [BX]>, DwarfRegNum<3>;
80 def ESP : RegisterWithSubRegs<"ESP", [SP]>, DwarfRegNum<4>;
81 def EBP : RegisterWithSubRegs<"EBP", [BP]>, DwarfRegNum<5>;
82 def ESI : RegisterWithSubRegs<"ESI", [SI]>, DwarfRegNum<6>;
83 def EDI : RegisterWithSubRegs<"EDI", [DI]>, DwarfRegNum<7>;
84 def EIP : RegisterWithSubRegs<"EIP", [IP]>, DwarfRegNum<8>;
87 def R8D : RegisterWithSubRegs<"R8D", [R8W]>, DwarfRegNum<8>;
88 def R9D : RegisterWithSubRegs<"R9D", [R9W]>, DwarfRegNum<9>;
89 def R10D : RegisterWithSubRegs<"R10D", [R10W]>, DwarfRegNum<10>;
90 def R11D : RegisterWithSubRegs<"R11D", [R11W]>, DwarfRegNum<11>;
91 def R12D : RegisterWithSubRegs<"R12D", [R12W]>, DwarfRegNum<12>;
92 def R13D : RegisterWithSubRegs<"R13D", [R13W]>, DwarfRegNum<13>;
93 def R14D : RegisterWithSubRegs<"R14D", [R14W]>, DwarfRegNum<14>;
94 def R15D : RegisterWithSubRegs<"R15D", [R15W]>, DwarfRegNum<15>;
96 // 64-bit registers, X86-64 only
97 def RAX : RegisterWithSubRegs<"RAX", [EAX]>, DwarfRegNum<0>;
98 def RDX : RegisterWithSubRegs<"RDX", [EDX]>, DwarfRegNum<1>;
99 def RCX : RegisterWithSubRegs<"RCX", [ECX]>, DwarfRegNum<2>;
100 def RBX : RegisterWithSubRegs<"RBX", [EBX]>, DwarfRegNum<3>;
101 def RSI : RegisterWithSubRegs<"RSI", [ESI]>, DwarfRegNum<4>;
102 def RDI : RegisterWithSubRegs<"RDI", [EDI]>, DwarfRegNum<5>;
103 def RBP : RegisterWithSubRegs<"RBP", [EBP]>, DwarfRegNum<6>;
104 def RSP : RegisterWithSubRegs<"RSP", [ESP]>, DwarfRegNum<7>;
106 def R8 : RegisterWithSubRegs<"R8", [R8D]>, DwarfRegNum<8>;
107 def R9 : RegisterWithSubRegs<"R9", [R9D]>, DwarfRegNum<9>;
108 def R10 : RegisterWithSubRegs<"R10", [R10D]>, DwarfRegNum<10>;
109 def R11 : RegisterWithSubRegs<"R11", [R11D]>, DwarfRegNum<11>;
110 def R12 : RegisterWithSubRegs<"R12", [R12D]>, DwarfRegNum<12>;
111 def R13 : RegisterWithSubRegs<"R13", [R13D]>, DwarfRegNum<13>;
112 def R14 : RegisterWithSubRegs<"R14", [R14D]>, DwarfRegNum<14>;
113 def R15 : RegisterWithSubRegs<"R15", [R15D]>, DwarfRegNum<15>;
114 def RIP : RegisterWithSubRegs<"RIP", [EIP]>, DwarfRegNum<16>;
116 // MMX Registers. These are actually aliased to ST0 .. ST7
117 def MM0 : Register<"MM0">, DwarfRegNum<29>;
118 def MM1 : Register<"MM1">, DwarfRegNum<30>;
119 def MM2 : Register<"MM2">, DwarfRegNum<31>;
120 def MM3 : Register<"MM3">, DwarfRegNum<32>;
121 def MM4 : Register<"MM4">, DwarfRegNum<33>;
122 def MM5 : Register<"MM5">, DwarfRegNum<34>;
123 def MM6 : Register<"MM6">, DwarfRegNum<35>;
124 def MM7 : Register<"MM7">, DwarfRegNum<36>;
126 // Pseudo Floating Point registers
127 def FP0 : Register<"FP0">, DwarfRegNum<-1>;
128 def FP1 : Register<"FP1">, DwarfRegNum<-1>;
129 def FP2 : Register<"FP2">, DwarfRegNum<-1>;
130 def FP3 : Register<"FP3">, DwarfRegNum<-1>;
131 def FP4 : Register<"FP4">, DwarfRegNum<-1>;
132 def FP5 : Register<"FP5">, DwarfRegNum<-1>;
133 def FP6 : Register<"FP6">, DwarfRegNum<-1>;
135 // XMM Registers, used by the various SSE instruction set extensions
136 def XMM0: Register<"XMM0">, DwarfRegNum<17>;
137 def XMM1: Register<"XMM1">, DwarfRegNum<18>;
138 def XMM2: Register<"XMM2">, DwarfRegNum<19>;
139 def XMM3: Register<"XMM3">, DwarfRegNum<20>;
140 def XMM4: Register<"XMM4">, DwarfRegNum<21>;
141 def XMM5: Register<"XMM5">, DwarfRegNum<22>;
142 def XMM6: Register<"XMM6">, DwarfRegNum<23>;
143 def XMM7: Register<"XMM7">, DwarfRegNum<24>;
146 def XMM8: Register<"XMM8">, DwarfRegNum<25>;
147 def XMM9: Register<"XMM9">, DwarfRegNum<26>;
148 def XMM10: Register<"XMM10">, DwarfRegNum<27>;
149 def XMM11: Register<"XMM11">, DwarfRegNum<28>;
150 def XMM12: Register<"XMM12">, DwarfRegNum<29>;
151 def XMM13: Register<"XMM13">, DwarfRegNum<30>;
152 def XMM14: Register<"XMM14">, DwarfRegNum<31>;
153 def XMM15: Register<"XMM15">, DwarfRegNum<32>;
155 // Floating point stack registers
156 def ST0 : Register<"ST(0)">, DwarfRegNum<11>;
157 def ST1 : Register<"ST(1)">, DwarfRegNum<12>;
158 def ST2 : Register<"ST(2)">, DwarfRegNum<13>;
159 def ST3 : Register<"ST(3)">, DwarfRegNum<14>;
160 def ST4 : Register<"ST(4)">, DwarfRegNum<15>;
161 def ST5 : Register<"ST(5)">, DwarfRegNum<16>;
162 def ST6 : Register<"ST(6)">, DwarfRegNum<17>;
163 def ST7 : Register<"ST(7)">, DwarfRegNum<18>;
165 // Status flags register
166 def EFLAGS : Register<"EFLAGS">;
170 //===----------------------------------------------------------------------===//
171 // Subregister Set Definitions... now that we have all of the pieces, define the
172 // sub registers for each register.
175 def : SubRegSet<1, [AX, CX, DX, BX, SP, BP, SI, DI,
176 R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W],
177 [AL, CL, DL, BL, SPL, BPL, SIL, DIL,
178 R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B]>;
180 // It's unclear if this subreg set is safe, given that not all registers
181 // in the class have an 'H' subreg.
182 // def : SubRegSet<2, [AX, CX, DX, BX],
183 // [AH, CH, DH, BH]>;
185 def : SubRegSet<1, [EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
186 R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D],
187 [AL, CL, DL, BL, SPL, BPL, SIL, DIL,
188 R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B]>;
190 def : SubRegSet<2, [EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
191 R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D],
192 [AX, CX, DX, BX, SP, BP, SI, DI,
193 R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W]>;
196 def : SubRegSet<1, [RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI,
197 R8, R9, R10, R11, R12, R13, R14, R15],
198 [AL, CL, DL, BL, SPL, BPL, SIL, DIL,
199 R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B]>;
201 def : SubRegSet<2, [RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI,
202 R8, R9, R10, R11, R12, R13, R14, R15],
203 [AX, CX, DX, BX, SP, BP, SI, DI,
204 R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W]>;
206 def : SubRegSet<3, [RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI,
207 R8, R9, R10, R11, R12, R13, R14, R15],
208 [EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI,
209 R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D]>;
211 //===----------------------------------------------------------------------===//
212 // Register Class Definitions... now that we have all of the pieces, define the
213 // top-level register classes. The order specified in the register list is
214 // implicitly defined to be the register allocation order.
217 // List call-clobbered registers before callee-save registers. RBX, RBP, (and
218 // R12, R13, R14, and R15 for X86-64) are callee-save registers.
219 // In 64-mode, there are 12 additional i8 registers, SIL, DIL, BPL, SPL, and
221 // FIXME: Allow AH, CH, DH, BH in 64-mode for non-REX instructions,
222 def GR8 : RegisterClass<"X86", [i8], 8,
223 [AL, CL, DL, BL, AH, CH, DH, BH, SIL, DIL, BPL, SPL,
224 R8B, R9B, R10B, R11B, R12B, R13B, R14B, R15B]> {
225 let MethodProtos = [{
226 iterator allocation_order_begin(const MachineFunction &MF) const;
227 iterator allocation_order_end(const MachineFunction &MF) const;
229 let MethodBodies = [{
230 // Does the function dedicate RBP / EBP to being a frame ptr?
231 // If so, don't allocate SPL or BPL.
232 static const unsigned X86_GR8_AO_64_fp[] =
233 {X86::AL, X86::CL, X86::DL, X86::SIL, X86::DIL,
234 X86::R8B, X86::R9B, X86::R10B, X86::R11B,
235 X86::BL, X86::R14B, X86::R15B, X86::R12B, X86::R13B};
236 // If not, just don't allocate SPL.
237 static const unsigned X86_GR8_AO_64[] =
238 {X86::AL, X86::CL, X86::DL, X86::SIL, X86::DIL,
239 X86::R8B, X86::R9B, X86::R10B, X86::R11B,
240 X86::BL, X86::R14B, X86::R15B, X86::R12B, X86::R13B, X86::BPL};
241 // In 32-mode, none of the 8-bit registers aliases EBP or ESP.
242 static const unsigned X86_GR8_AO_32[] =
243 {X86::AL, X86::CL, X86::DL, X86::AH, X86::CH, X86::DH, X86::BL, X86::BH};
246 GR8Class::allocation_order_begin(const MachineFunction &MF) const {
247 const TargetMachine &TM = MF.getTarget();
248 const MRegisterInfo *RI = TM.getRegisterInfo();
249 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
250 if (!Subtarget.is64Bit())
251 return X86_GR8_AO_32;
252 else if (RI->hasFP(MF))
253 return X86_GR8_AO_64_fp;
255 return X86_GR8_AO_64;
259 GR8Class::allocation_order_end(const MachineFunction &MF) const {
260 const TargetMachine &TM = MF.getTarget();
261 const MRegisterInfo *RI = TM.getRegisterInfo();
262 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
263 if (!Subtarget.is64Bit())
264 return X86_GR8_AO_32 + (sizeof(X86_GR8_AO_32) / sizeof(unsigned));
265 else if (RI->hasFP(MF))
266 return X86_GR8_AO_64_fp + (sizeof(X86_GR8_AO_64_fp) / sizeof(unsigned));
268 return X86_GR8_AO_64 + (sizeof(X86_GR8_AO_64) / sizeof(unsigned));
274 def GR16 : RegisterClass<"X86", [i16], 16,
275 [AX, CX, DX, SI, DI, BX, BP, SP,
276 R8W, R9W, R10W, R11W, R12W, R13W, R14W, R15W]> {
277 let SubRegClassList = [GR8];
278 let MethodProtos = [{
279 iterator allocation_order_begin(const MachineFunction &MF) const;
280 iterator allocation_order_end(const MachineFunction &MF) const;
282 let MethodBodies = [{
283 // Does the function dedicate RBP / EBP to being a frame ptr?
284 // If so, don't allocate SP or BP.
285 static const unsigned X86_GR16_AO_64_fp[] =
286 {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI,
287 X86::R8W, X86::R9W, X86::R10W, X86::R11W,
288 X86::BX, X86::R14W, X86::R15W, X86::R12W, X86::R13W};
289 static const unsigned X86_GR16_AO_32_fp[] =
290 {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, X86::BX};
291 // If not, just don't allocate SPL.
292 static const unsigned X86_GR16_AO_64[] =
293 {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI,
294 X86::R8W, X86::R9W, X86::R10W, X86::R11W,
295 X86::BX, X86::R14W, X86::R15W, X86::R12W, X86::R13W, X86::BP};
296 static const unsigned X86_GR16_AO_32[] =
297 {X86::AX, X86::CX, X86::DX, X86::SI, X86::DI, X86::BX, X86::BP};
300 GR16Class::allocation_order_begin(const MachineFunction &MF) const {
301 const TargetMachine &TM = MF.getTarget();
302 const MRegisterInfo *RI = TM.getRegisterInfo();
303 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
304 if (Subtarget.is64Bit()) {
306 return X86_GR16_AO_64_fp;
308 return X86_GR16_AO_64;
311 return X86_GR16_AO_32_fp;
313 return X86_GR16_AO_32;
318 GR16Class::allocation_order_end(const MachineFunction &MF) const {
319 const TargetMachine &TM = MF.getTarget();
320 const MRegisterInfo *RI = TM.getRegisterInfo();
321 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
322 if (Subtarget.is64Bit()) {
324 return X86_GR16_AO_64_fp+(sizeof(X86_GR16_AO_64_fp)/sizeof(unsigned));
326 return X86_GR16_AO_64 + (sizeof(X86_GR16_AO_64) / sizeof(unsigned));
329 return X86_GR16_AO_32_fp+(sizeof(X86_GR16_AO_32_fp)/sizeof(unsigned));
331 return X86_GR16_AO_32 + (sizeof(X86_GR16_AO_32) / sizeof(unsigned));
338 def GR32 : RegisterClass<"X86", [i32], 32,
339 [EAX, ECX, EDX, ESI, EDI, EBX, EBP, ESP,
340 R8D, R9D, R10D, R11D, R12D, R13D, R14D, R15D]> {
341 let SubRegClassList = [GR8, GR16];
342 let MethodProtos = [{
343 iterator allocation_order_begin(const MachineFunction &MF) const;
344 iterator allocation_order_end(const MachineFunction &MF) const;
346 let MethodBodies = [{
347 // Does the function dedicate RBP / EBP to being a frame ptr?
348 // If so, don't allocate ESP or EBP.
349 static const unsigned X86_GR32_AO_64_fp[] =
350 {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI,
351 X86::R8D, X86::R9D, X86::R10D, X86::R11D,
352 X86::EBX, X86::R14D, X86::R15D, X86::R12D, X86::R13D};
353 static const unsigned X86_GR32_AO_32_fp[] =
354 {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, X86::EBX};
355 // If not, just don't allocate SPL.
356 static const unsigned X86_GR32_AO_64[] =
357 {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI,
358 X86::R8D, X86::R9D, X86::R10D, X86::R11D,
359 X86::EBX, X86::R14D, X86::R15D, X86::R12D, X86::R13D, X86::EBP};
360 static const unsigned X86_GR32_AO_32[] =
361 {X86::EAX, X86::ECX, X86::EDX, X86::ESI, X86::EDI, X86::EBX, X86::EBP};
364 GR32Class::allocation_order_begin(const MachineFunction &MF) const {
365 const TargetMachine &TM = MF.getTarget();
366 const MRegisterInfo *RI = TM.getRegisterInfo();
367 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
368 if (Subtarget.is64Bit()) {
370 return X86_GR32_AO_64_fp;
372 return X86_GR32_AO_64;
375 return X86_GR32_AO_32_fp;
377 return X86_GR32_AO_32;
382 GR32Class::allocation_order_end(const MachineFunction &MF) const {
383 const TargetMachine &TM = MF.getTarget();
384 const MRegisterInfo *RI = TM.getRegisterInfo();
385 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
386 if (Subtarget.is64Bit()) {
388 return X86_GR32_AO_64_fp+(sizeof(X86_GR32_AO_64_fp)/sizeof(unsigned));
390 return X86_GR32_AO_64 + (sizeof(X86_GR32_AO_64) / sizeof(unsigned));
393 return X86_GR32_AO_32_fp+(sizeof(X86_GR32_AO_32_fp)/sizeof(unsigned));
395 return X86_GR32_AO_32 + (sizeof(X86_GR32_AO_32) / sizeof(unsigned));
402 def GR64 : RegisterClass<"X86", [i64], 64,
403 [RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11,
404 RBX, R14, R15, R12, R13, RBP, RSP]> {
405 let SubRegClassList = [GR8, GR16, GR32];
406 let MethodProtos = [{
407 iterator allocation_order_end(const MachineFunction &MF) const;
409 let MethodBodies = [{
411 GR64Class::allocation_order_end(const MachineFunction &MF) const {
412 const TargetMachine &TM = MF.getTarget();
413 const MRegisterInfo *RI = TM.getRegisterInfo();
414 if (RI->hasFP(MF)) // Does the function dedicate RBP to being a frame ptr?
415 return end()-2; // If so, don't allocate RSP or RBP
417 return end()-1; // If not, just don't allocate RSP
423 // GR16, GR32 subclasses which contain registers that have GR8 sub-registers.
424 // These should only be used for 32-bit mode.
425 def GR16_ : RegisterClass<"X86", [i16], 16, [AX, CX, DX, BX]> {
426 let SubRegClassList = [GR8];
428 def GR32_ : RegisterClass<"X86", [i32], 32, [EAX, ECX, EDX, EBX]> {
429 let SubRegClassList = [GR8, GR16];
432 // Scalar SSE2 floating point registers.
433 def FR32 : RegisterClass<"X86", [f32], 32,
434 [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
435 XMM8, XMM9, XMM10, XMM11,
436 XMM12, XMM13, XMM14, XMM15]> {
437 let MethodProtos = [{
438 iterator allocation_order_end(const MachineFunction &MF) const;
440 let MethodBodies = [{
442 FR32Class::allocation_order_end(const MachineFunction &MF) const {
443 const TargetMachine &TM = MF.getTarget();
444 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
445 if (!Subtarget.is64Bit())
446 return end()-8; // Only XMM0 to XMM7 are available in 32-bit mode.
453 def FR64 : RegisterClass<"X86", [f64], 64,
454 [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
455 XMM8, XMM9, XMM10, XMM11,
456 XMM12, XMM13, XMM14, XMM15]> {
457 let MethodProtos = [{
458 iterator allocation_order_end(const MachineFunction &MF) const;
460 let MethodBodies = [{
462 FR64Class::allocation_order_end(const MachineFunction &MF) const {
463 const TargetMachine &TM = MF.getTarget();
464 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
465 if (!Subtarget.is64Bit())
466 return end()-8; // Only XMM0 to XMM7 are available in 32-bit mode.
474 // FIXME: This sets up the floating point register files as though they are f64
475 // values, though they really are f80 values. This will cause us to spill
476 // values as 64-bit quantities instead of 80-bit quantities, which is much much
477 // faster on common hardware. In reality, this should be controlled by a
478 // command line option or something.
480 def RFP32 : RegisterClass<"X86", [f32], 32, [FP0, FP1, FP2, FP3, FP4, FP5, FP6]>;
481 def RFP64 : RegisterClass<"X86", [f64], 32, [FP0, FP1, FP2, FP3, FP4, FP5, FP6]>;
482 def RFP80 : RegisterClass<"X86", [f80], 32, [FP0, FP1, FP2, FP3, FP4, FP5, FP6]>;
484 // Floating point stack registers (these are not allocatable by the
485 // register allocator - the floating point stackifier is responsible
486 // for transforming FPn allocations to STn registers)
487 def RST : RegisterClass<"X86", [f64], 32,
488 [ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7]> {
489 let MethodProtos = [{
490 iterator allocation_order_end(const MachineFunction &MF) const;
492 let MethodBodies = [{
494 RSTClass::allocation_order_end(const MachineFunction &MF) const {
500 // Generic vector registers: VR64 and VR128.
501 def VR64 : RegisterClass<"X86", [v8i8, v4i16, v2i32, v1i64], 64,
502 [MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7]>;
503 def VR128 : RegisterClass<"X86", [v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],128,
504 [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
505 XMM8, XMM9, XMM10, XMM11,
506 XMM12, XMM13, XMM14, XMM15]> {
507 let MethodProtos = [{
508 iterator allocation_order_end(const MachineFunction &MF) const;
510 let MethodBodies = [{
512 VR128Class::allocation_order_end(const MachineFunction &MF) const {
513 const TargetMachine &TM = MF.getTarget();
514 const X86Subtarget &Subtarget = TM.getSubtarget<X86Subtarget>();
515 if (!Subtarget.is64Bit())
516 return end()-8; // Only XMM0 to XMM7 are available in 32-bit mode.
523 // Status flags registers.
524 def CCR : RegisterClass<"X86", [i32], 32, [EFLAGS]>;