1 //===- X86RegisterInfo.cpp - X86 Register Information -----------*- 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 contains the X86 implementation of the MRegisterInfo class. This
11 // file is responsible for the frame pointer elimination optimization on X86.
13 //===----------------------------------------------------------------------===//
16 #include "X86RegisterInfo.h"
17 #include "X86InstrBuilder.h"
18 #include "X86MachineFunctionInfo.h"
19 #include "X86Subtarget.h"
20 #include "X86TargetMachine.h"
21 #include "llvm/Constants.h"
22 #include "llvm/Function.h"
23 #include "llvm/Type.h"
24 #include "llvm/CodeGen/ValueTypes.h"
25 #include "llvm/CodeGen/MachineInstrBuilder.h"
26 #include "llvm/CodeGen/MachineFunction.h"
27 #include "llvm/CodeGen/MachineFrameInfo.h"
28 #include "llvm/CodeGen/MachineLocation.h"
29 #include "llvm/Target/TargetAsmInfo.h"
30 #include "llvm/Target/TargetFrameInfo.h"
31 #include "llvm/Target/TargetInstrInfo.h"
32 #include "llvm/Target/TargetMachine.h"
33 #include "llvm/Target/TargetOptions.h"
34 #include "llvm/Support/CommandLine.h"
35 #include "llvm/ADT/BitVector.h"
36 #include "llvm/ADT/STLExtras.h"
41 NoFusing("disable-spill-fusing",
42 cl::desc("Disable fusing of spill code into instructions"));
44 PrintFailedFusing("print-failed-fuse-candidates",
45 cl::desc("Print instructions that the allocator wants to"
46 " fuse, but the X86 backend currently can't"),
50 X86RegisterInfo::X86RegisterInfo(X86TargetMachine &tm,
51 const TargetInstrInfo &tii)
52 : X86GenRegisterInfo(X86::ADJCALLSTACKDOWN, X86::ADJCALLSTACKUP),
54 // Cache some information.
55 const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
56 Is64Bit = Subtarget->is64Bit();
68 bool X86RegisterInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
69 MachineBasicBlock::iterator MI,
70 const std::vector<CalleeSavedInfo> &CSI) const {
74 MachineFunction &MF = *MBB.getParent();
75 X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
76 X86FI->setCalleeSavedFrameSize(CSI.size() * SlotSize);
77 unsigned Opc = Is64Bit ? X86::PUSH64r : X86::PUSH32r;
78 for (unsigned i = CSI.size(); i != 0; --i) {
79 unsigned Reg = CSI[i-1].getReg();
80 // Add the callee-saved register as live-in. It's killed at the spill.
82 BuildMI(MBB, MI, TII.get(Opc)).addReg(Reg);
87 bool X86RegisterInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
88 MachineBasicBlock::iterator MI,
89 const std::vector<CalleeSavedInfo> &CSI) const {
93 unsigned Opc = Is64Bit ? X86::POP64r : X86::POP32r;
94 for (unsigned i = 0, e = CSI.size(); i != e; ++i) {
95 unsigned Reg = CSI[i].getReg();
96 BuildMI(MBB, MI, TII.get(Opc), Reg);
101 void X86RegisterInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
102 MachineBasicBlock::iterator MI,
103 unsigned SrcReg, int FrameIdx,
104 const TargetRegisterClass *RC) const {
106 if (RC == &X86::GR64RegClass) {
108 } else if (RC == &X86::GR32RegClass) {
110 } else if (RC == &X86::GR16RegClass) {
112 } else if (RC == &X86::GR8RegClass) {
114 } else if (RC == &X86::GR32_RegClass) {
116 } else if (RC == &X86::GR16_RegClass) {
118 } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) {
120 } else if (RC == &X86::RFP32RegClass) {
122 } else if (RC == &X86::FR32RegClass) {
124 } else if (RC == &X86::FR64RegClass) {
126 } else if (RC == &X86::VR128RegClass) {
128 } else if (RC == &X86::VR64RegClass) {
129 Opc = X86::MMX_MOVQ64mr;
131 assert(0 && "Unknown regclass");
134 addFrameReference(BuildMI(MBB, MI, TII.get(Opc)), FrameIdx)
135 .addReg(SrcReg, false, false, true);
138 void X86RegisterInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,
139 MachineBasicBlock::iterator MI,
140 unsigned DestReg, int FrameIdx,
141 const TargetRegisterClass *RC) const{
143 if (RC == &X86::GR64RegClass) {
145 } else if (RC == &X86::GR32RegClass) {
147 } else if (RC == &X86::GR16RegClass) {
149 } else if (RC == &X86::GR8RegClass) {
151 } else if (RC == &X86::GR32_RegClass) {
153 } else if (RC == &X86::GR16_RegClass) {
155 } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) {
157 } else if (RC == &X86::RFP32RegClass) {
159 } else if (RC == &X86::FR32RegClass) {
161 } else if (RC == &X86::FR64RegClass) {
163 } else if (RC == &X86::VR128RegClass) {
165 } else if (RC == &X86::VR64RegClass) {
166 Opc = X86::MMX_MOVQ64rm;
168 assert(0 && "Unknown regclass");
171 addFrameReference(BuildMI(MBB, MI, TII.get(Opc), DestReg), FrameIdx);
174 void X86RegisterInfo::copyRegToReg(MachineBasicBlock &MBB,
175 MachineBasicBlock::iterator MI,
176 unsigned DestReg, unsigned SrcReg,
177 const TargetRegisterClass *RC) const {
179 if (RC == &X86::GR64RegClass) {
181 } else if (RC == &X86::GR32RegClass) {
183 } else if (RC == &X86::GR16RegClass) {
185 } else if (RC == &X86::GR8RegClass) {
187 } else if (RC == &X86::GR32_RegClass) {
189 } else if (RC == &X86::GR16_RegClass) {
191 } else if (RC == &X86::RFP32RegClass) {
192 Opc = X86::MOV_Fp3232;
193 } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) {
194 Opc = X86::MOV_Fp6464;
195 } else if (RC == &X86::FR32RegClass) {
196 Opc = X86::FsMOVAPSrr;
197 } else if (RC == &X86::FR64RegClass) {
198 Opc = X86::FsMOVAPDrr;
199 } else if (RC == &X86::VR128RegClass) {
201 } else if (RC == &X86::VR64RegClass) {
202 Opc = X86::MMX_MOVQ64rr;
204 assert(0 && "Unknown regclass");
207 BuildMI(MBB, MI, TII.get(Opc), DestReg).addReg(SrcReg);
211 void X86RegisterInfo::reMaterialize(MachineBasicBlock &MBB,
212 MachineBasicBlock::iterator I,
214 const MachineInstr *Orig) const {
215 MachineInstr *MI = Orig->clone();
216 MI->getOperand(0).setReg(DestReg);
220 static MachineInstr *FuseTwoAddrInst(unsigned Opcode, unsigned FrameIndex,
222 const TargetInstrInfo &TII) {
223 unsigned NumOps = TII.getNumOperands(MI->getOpcode())-2;
224 // Create the base instruction with the memory operand as the first part.
225 MachineInstrBuilder MIB = addFrameReference(BuildMI(TII.get(Opcode)),
228 // Loop over the rest of the ri operands, converting them over.
229 for (unsigned i = 0; i != NumOps; ++i) {
230 MachineOperand &MO = MI->getOperand(i+2);
232 MIB = MIB.addReg(MO.getReg(), false, MO.isImplicit());
234 MIB = MIB.addImm(MO.getImm());
235 else if (MO.isGlobalAddress())
236 MIB = MIB.addGlobalAddress(MO.getGlobal(), MO.getOffset());
237 else if (MO.isJumpTableIndex())
238 MIB = MIB.addJumpTableIndex(MO.getJumpTableIndex());
239 else if (MO.isExternalSymbol())
240 MIB = MIB.addExternalSymbol(MO.getSymbolName());
242 assert(0 && "Unknown operand type!");
247 static MachineInstr *FuseInst(unsigned Opcode, unsigned OpNo,
248 unsigned FrameIndex, MachineInstr *MI,
249 const TargetInstrInfo &TII) {
250 MachineInstrBuilder MIB = BuildMI(TII.get(Opcode));
252 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
253 MachineOperand &MO = MI->getOperand(i);
255 assert(MO.isReg() && "Expected to fold into reg operand!");
256 MIB = addFrameReference(MIB, FrameIndex);
257 } else if (MO.isReg())
258 MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit());
260 MIB = MIB.addImm(MO.getImm());
261 else if (MO.isGlobalAddress())
262 MIB = MIB.addGlobalAddress(MO.getGlobal(), MO.getOffset());
263 else if (MO.isJumpTableIndex())
264 MIB = MIB.addJumpTableIndex(MO.getJumpTableIndex());
265 else if (MO.isExternalSymbol())
266 MIB = MIB.addExternalSymbol(MO.getSymbolName());
268 assert(0 && "Unknown operand for FuseInst!");
273 static MachineInstr *MakeM0Inst(const TargetInstrInfo &TII,
274 unsigned Opcode, unsigned FrameIndex,
276 return addFrameReference(BuildMI(TII.get(Opcode)), FrameIndex).addImm(0);
280 //===----------------------------------------------------------------------===//
281 // Efficient Lookup Table Support
282 //===----------------------------------------------------------------------===//
285 /// TableEntry - Maps the 'from' opcode to a fused form of the 'to' opcode.
288 unsigned from; // Original opcode.
289 unsigned to; // New opcode.
291 // less operators used by STL search.
292 bool operator<(const TableEntry &TE) const { return from < TE.from; }
293 friend bool operator<(const TableEntry &TE, unsigned V) {
296 friend bool operator<(unsigned V, const TableEntry &TE) {
302 /// TableIsSorted - Return true if the table is in 'from' opcode order.
304 static bool TableIsSorted(const TableEntry *Table, unsigned NumEntries) {
305 for (unsigned i = 1; i != NumEntries; ++i)
306 if (!(Table[i-1] < Table[i])) {
307 cerr << "Entries out of order " << Table[i-1].from
308 << " " << Table[i].from << "\n";
314 /// TableLookup - Return the table entry matching the specified opcode.
315 /// Otherwise return NULL.
316 static const TableEntry *TableLookup(const TableEntry *Table, unsigned N,
318 const TableEntry *I = std::lower_bound(Table, Table+N, Opcode);
319 if (I != Table+N && I->from == Opcode)
324 #define ARRAY_SIZE(TABLE) \
325 (sizeof(TABLE)/sizeof(TABLE[0]))
328 #define ASSERT_SORTED(TABLE)
330 #define ASSERT_SORTED(TABLE) \
331 { static bool TABLE##Checked = false; \
332 if (!TABLE##Checked) { \
333 assert(TableIsSorted(TABLE, ARRAY_SIZE(TABLE)) && \
334 "All lookup tables must be sorted for efficient access!"); \
335 TABLE##Checked = true; \
341 MachineInstr* X86RegisterInfo::foldMemoryOperand(MachineInstr *MI,
343 int FrameIndex) const {
345 if (NoFusing) return NULL;
347 // Table (and size) to search
348 const TableEntry *OpcodeTablePtr = NULL;
349 unsigned OpcodeTableSize = 0;
350 bool isTwoAddrFold = false;
351 unsigned NumOps = TII.getNumOperands(MI->getOpcode());
352 bool isTwoAddr = NumOps > 1 &&
353 MI->getInstrDescriptor()->getOperandConstraint(1, TOI::TIED_TO) != -1;
355 MachineInstr *NewMI = NULL;
356 // Folding a memory location into the two-address part of a two-address
357 // instruction is different than folding it other places. It requires
358 // replacing the *two* registers with the memory location.
359 if (isTwoAddr && NumOps >= 2 && i < 2 &&
360 MI->getOperand(0).isReg() &&
361 MI->getOperand(1).isReg() &&
362 MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) {
363 static const TableEntry OpcodeTable[] = {
364 { X86::ADC32ri, X86::ADC32mi },
365 { X86::ADC32ri8, X86::ADC32mi8 },
366 { X86::ADC32rr, X86::ADC32mr },
367 { X86::ADC64ri32, X86::ADC64mi32 },
368 { X86::ADC64ri8, X86::ADC64mi8 },
369 { X86::ADC64rr, X86::ADC64mr },
370 { X86::ADD16ri, X86::ADD16mi },
371 { X86::ADD16ri8, X86::ADD16mi8 },
372 { X86::ADD16rr, X86::ADD16mr },
373 { X86::ADD32ri, X86::ADD32mi },
374 { X86::ADD32ri8, X86::ADD32mi8 },
375 { X86::ADD32rr, X86::ADD32mr },
376 { X86::ADD64ri32, X86::ADD64mi32 },
377 { X86::ADD64ri8, X86::ADD64mi8 },
378 { X86::ADD64rr, X86::ADD64mr },
379 { X86::ADD8ri, X86::ADD8mi },
380 { X86::ADD8rr, X86::ADD8mr },
381 { X86::AND16ri, X86::AND16mi },
382 { X86::AND16ri8, X86::AND16mi8 },
383 { X86::AND16rr, X86::AND16mr },
384 { X86::AND32ri, X86::AND32mi },
385 { X86::AND32ri8, X86::AND32mi8 },
386 { X86::AND32rr, X86::AND32mr },
387 { X86::AND64ri32, X86::AND64mi32 },
388 { X86::AND64ri8, X86::AND64mi8 },
389 { X86::AND64rr, X86::AND64mr },
390 { X86::AND8ri, X86::AND8mi },
391 { X86::AND8rr, X86::AND8mr },
392 { X86::DEC16r, X86::DEC16m },
393 { X86::DEC32r, X86::DEC32m },
394 { X86::DEC64_16r, X86::DEC16m },
395 { X86::DEC64_32r, X86::DEC32m },
396 { X86::DEC64r, X86::DEC64m },
397 { X86::DEC8r, X86::DEC8m },
398 { X86::INC16r, X86::INC16m },
399 { X86::INC32r, X86::INC32m },
400 { X86::INC64_16r, X86::INC16m },
401 { X86::INC64_32r, X86::INC32m },
402 { X86::INC64r, X86::INC64m },
403 { X86::INC8r, X86::INC8m },
404 { X86::NEG16r, X86::NEG16m },
405 { X86::NEG32r, X86::NEG32m },
406 { X86::NEG64r, X86::NEG64m },
407 { X86::NEG8r, X86::NEG8m },
408 { X86::NOT16r, X86::NOT16m },
409 { X86::NOT32r, X86::NOT32m },
410 { X86::NOT64r, X86::NOT64m },
411 { X86::NOT8r, X86::NOT8m },
412 { X86::OR16ri, X86::OR16mi },
413 { X86::OR16ri8, X86::OR16mi8 },
414 { X86::OR16rr, X86::OR16mr },
415 { X86::OR32ri, X86::OR32mi },
416 { X86::OR32ri8, X86::OR32mi8 },
417 { X86::OR32rr, X86::OR32mr },
418 { X86::OR64ri32, X86::OR64mi32 },
419 { X86::OR64ri8, X86::OR64mi8 },
420 { X86::OR64rr, X86::OR64mr },
421 { X86::OR8ri, X86::OR8mi },
422 { X86::OR8rr, X86::OR8mr },
423 { X86::ROL16r1, X86::ROL16m1 },
424 { X86::ROL16rCL, X86::ROL16mCL },
425 { X86::ROL16ri, X86::ROL16mi },
426 { X86::ROL32r1, X86::ROL32m1 },
427 { X86::ROL32rCL, X86::ROL32mCL },
428 { X86::ROL32ri, X86::ROL32mi },
429 { X86::ROL64r1, X86::ROL64m1 },
430 { X86::ROL64rCL, X86::ROL64mCL },
431 { X86::ROL64ri, X86::ROL64mi },
432 { X86::ROL8r1, X86::ROL8m1 },
433 { X86::ROL8rCL, X86::ROL8mCL },
434 { X86::ROL8ri, X86::ROL8mi },
435 { X86::ROR16r1, X86::ROR16m1 },
436 { X86::ROR16rCL, X86::ROR16mCL },
437 { X86::ROR16ri, X86::ROR16mi },
438 { X86::ROR32r1, X86::ROR32m1 },
439 { X86::ROR32rCL, X86::ROR32mCL },
440 { X86::ROR32ri, X86::ROR32mi },
441 { X86::ROR64r1, X86::ROR64m1 },
442 { X86::ROR64rCL, X86::ROR64mCL },
443 { X86::ROR64ri, X86::ROR64mi },
444 { X86::ROR8r1, X86::ROR8m1 },
445 { X86::ROR8rCL, X86::ROR8mCL },
446 { X86::ROR8ri, X86::ROR8mi },
447 { X86::SAR16r1, X86::SAR16m1 },
448 { X86::SAR16rCL, X86::SAR16mCL },
449 { X86::SAR16ri, X86::SAR16mi },
450 { X86::SAR32r1, X86::SAR32m1 },
451 { X86::SAR32rCL, X86::SAR32mCL },
452 { X86::SAR32ri, X86::SAR32mi },
453 { X86::SAR64r1, X86::SAR64m1 },
454 { X86::SAR64rCL, X86::SAR64mCL },
455 { X86::SAR64ri, X86::SAR64mi },
456 { X86::SAR8r1, X86::SAR8m1 },
457 { X86::SAR8rCL, X86::SAR8mCL },
458 { X86::SAR8ri, X86::SAR8mi },
459 { X86::SBB32ri, X86::SBB32mi },
460 { X86::SBB32ri8, X86::SBB32mi8 },
461 { X86::SBB32rr, X86::SBB32mr },
462 { X86::SBB64ri32, X86::SBB64mi32 },
463 { X86::SBB64ri8, X86::SBB64mi8 },
464 { X86::SBB64rr, X86::SBB64mr },
465 { X86::SHL16r1, X86::SHL16m1 },
466 { X86::SHL16rCL, X86::SHL16mCL },
467 { X86::SHL16ri, X86::SHL16mi },
468 { X86::SHL32r1, X86::SHL32m1 },
469 { X86::SHL32rCL, X86::SHL32mCL },
470 { X86::SHL32ri, X86::SHL32mi },
471 { X86::SHL64r1, X86::SHL64m1 },
472 { X86::SHL64rCL, X86::SHL64mCL },
473 { X86::SHL64ri, X86::SHL64mi },
474 { X86::SHL8r1, X86::SHL8m1 },
475 { X86::SHL8rCL, X86::SHL8mCL },
476 { X86::SHL8ri, X86::SHL8mi },
477 { X86::SHLD16rrCL, X86::SHLD16mrCL },
478 { X86::SHLD16rri8, X86::SHLD16mri8 },
479 { X86::SHLD32rrCL, X86::SHLD32mrCL },
480 { X86::SHLD32rri8, X86::SHLD32mri8 },
481 { X86::SHLD64rrCL, X86::SHLD64mrCL },
482 { X86::SHLD64rri8, X86::SHLD64mri8 },
483 { X86::SHR16r1, X86::SHR16m1 },
484 { X86::SHR16rCL, X86::SHR16mCL },
485 { X86::SHR16ri, X86::SHR16mi },
486 { X86::SHR32r1, X86::SHR32m1 },
487 { X86::SHR32rCL, X86::SHR32mCL },
488 { X86::SHR32ri, X86::SHR32mi },
489 { X86::SHR64r1, X86::SHR64m1 },
490 { X86::SHR64rCL, X86::SHR64mCL },
491 { X86::SHR64ri, X86::SHR64mi },
492 { X86::SHR8r1, X86::SHR8m1 },
493 { X86::SHR8rCL, X86::SHR8mCL },
494 { X86::SHR8ri, X86::SHR8mi },
495 { X86::SHRD16rrCL, X86::SHRD16mrCL },
496 { X86::SHRD16rri8, X86::SHRD16mri8 },
497 { X86::SHRD32rrCL, X86::SHRD32mrCL },
498 { X86::SHRD32rri8, X86::SHRD32mri8 },
499 { X86::SHRD64rrCL, X86::SHRD64mrCL },
500 { X86::SHRD64rri8, X86::SHRD64mri8 },
501 { X86::SUB16ri, X86::SUB16mi },
502 { X86::SUB16ri8, X86::SUB16mi8 },
503 { X86::SUB16rr, X86::SUB16mr },
504 { X86::SUB32ri, X86::SUB32mi },
505 { X86::SUB32ri8, X86::SUB32mi8 },
506 { X86::SUB32rr, X86::SUB32mr },
507 { X86::SUB64ri32, X86::SUB64mi32 },
508 { X86::SUB64ri8, X86::SUB64mi8 },
509 { X86::SUB64rr, X86::SUB64mr },
510 { X86::SUB8ri, X86::SUB8mi },
511 { X86::SUB8rr, X86::SUB8mr },
512 { X86::XOR16ri, X86::XOR16mi },
513 { X86::XOR16ri8, X86::XOR16mi8 },
514 { X86::XOR16rr, X86::XOR16mr },
515 { X86::XOR32ri, X86::XOR32mi },
516 { X86::XOR32ri8, X86::XOR32mi8 },
517 { X86::XOR32rr, X86::XOR32mr },
518 { X86::XOR64ri32, X86::XOR64mi32 },
519 { X86::XOR64ri8, X86::XOR64mi8 },
520 { X86::XOR64rr, X86::XOR64mr },
521 { X86::XOR8ri, X86::XOR8mi },
522 { X86::XOR8rr, X86::XOR8mr }
524 ASSERT_SORTED(OpcodeTable);
525 OpcodeTablePtr = OpcodeTable;
526 OpcodeTableSize = ARRAY_SIZE(OpcodeTable);
527 isTwoAddrFold = true;
528 } else if (i == 0) { // If operand 0
529 if (MI->getOpcode() == X86::MOV16r0)
530 NewMI = MakeM0Inst(TII, X86::MOV16mi, FrameIndex, MI);
531 else if (MI->getOpcode() == X86::MOV32r0)
532 NewMI = MakeM0Inst(TII, X86::MOV32mi, FrameIndex, MI);
533 else if (MI->getOpcode() == X86::MOV64r0)
534 NewMI = MakeM0Inst(TII, X86::MOV64mi32, FrameIndex, MI);
535 else if (MI->getOpcode() == X86::MOV8r0)
536 NewMI = MakeM0Inst(TII, X86::MOV8mi, FrameIndex, MI);
538 NewMI->copyKillDeadInfo(MI);
542 static const TableEntry OpcodeTable[] = {
543 { X86::CMP16ri, X86::CMP16mi },
544 { X86::CMP16ri8, X86::CMP16mi8 },
545 { X86::CMP32ri, X86::CMP32mi },
546 { X86::CMP32ri8, X86::CMP32mi8 },
547 { X86::CMP8ri, X86::CMP8mi },
548 { X86::DIV16r, X86::DIV16m },
549 { X86::DIV32r, X86::DIV32m },
550 { X86::DIV64r, X86::DIV64m },
551 { X86::DIV8r, X86::DIV8m },
552 { X86::FsMOVAPDrr, X86::MOVSDmr },
553 { X86::FsMOVAPSrr, X86::MOVSSmr },
554 { X86::IDIV16r, X86::IDIV16m },
555 { X86::IDIV32r, X86::IDIV32m },
556 { X86::IDIV64r, X86::IDIV64m },
557 { X86::IDIV8r, X86::IDIV8m },
558 { X86::IMUL16r, X86::IMUL16m },
559 { X86::IMUL32r, X86::IMUL32m },
560 { X86::IMUL64r, X86::IMUL64m },
561 { X86::IMUL8r, X86::IMUL8m },
562 { X86::MOV16ri, X86::MOV16mi },
563 { X86::MOV16rr, X86::MOV16mr },
564 { X86::MOV32ri, X86::MOV32mi },
565 { X86::MOV32rr, X86::MOV32mr },
566 { X86::MOV64ri32, X86::MOV64mi32 },
567 { X86::MOV64rr, X86::MOV64mr },
568 { X86::MOV8ri, X86::MOV8mi },
569 { X86::MOV8rr, X86::MOV8mr },
570 { X86::MOVAPDrr, X86::MOVAPDmr },
571 { X86::MOVAPSrr, X86::MOVAPSmr },
572 { X86::MOVPDI2DIrr, X86::MOVPDI2DImr },
573 { X86::MOVPQIto64rr,X86::MOVPQIto64mr },
574 { X86::MOVPS2SSrr, X86::MOVPS2SSmr },
575 { X86::MOVSDrr, X86::MOVSDmr },
576 { X86::MOVSDto64rr, X86::MOVSDto64mr },
577 { X86::MOVSS2DIrr, X86::MOVSS2DImr },
578 { X86::MOVSSrr, X86::MOVSSmr },
579 { X86::MOVUPDrr, X86::MOVUPDmr },
580 { X86::MOVUPSrr, X86::MOVUPSmr },
581 { X86::MUL16r, X86::MUL16m },
582 { X86::MUL32r, X86::MUL32m },
583 { X86::MUL64r, X86::MUL64m },
584 { X86::MUL8r, X86::MUL8m },
585 { X86::SETAEr, X86::SETAEm },
586 { X86::SETAr, X86::SETAm },
587 { X86::SETBEr, X86::SETBEm },
588 { X86::SETBr, X86::SETBm },
589 { X86::SETEr, X86::SETEm },
590 { X86::SETGEr, X86::SETGEm },
591 { X86::SETGr, X86::SETGm },
592 { X86::SETLEr, X86::SETLEm },
593 { X86::SETLr, X86::SETLm },
594 { X86::SETNEr, X86::SETNEm },
595 { X86::SETNPr, X86::SETNPm },
596 { X86::SETNSr, X86::SETNSm },
597 { X86::SETPr, X86::SETPm },
598 { X86::SETSr, X86::SETSm },
599 { X86::TEST16ri, X86::TEST16mi },
600 { X86::TEST32ri, X86::TEST32mi },
601 { X86::TEST64ri32, X86::TEST64mi32 },
602 { X86::TEST8ri, X86::TEST8mi },
603 { X86::XCHG16rr, X86::XCHG16mr },
604 { X86::XCHG32rr, X86::XCHG32mr },
605 { X86::XCHG64rr, X86::XCHG64mr },
606 { X86::XCHG8rr, X86::XCHG8mr }
608 ASSERT_SORTED(OpcodeTable);
609 OpcodeTablePtr = OpcodeTable;
610 OpcodeTableSize = ARRAY_SIZE(OpcodeTable);
612 static const TableEntry OpcodeTable[] = {
613 { X86::CMP16rr, X86::CMP16rm },
614 { X86::CMP32rr, X86::CMP32rm },
615 { X86::CMP64ri32, X86::CMP64mi32 },
616 { X86::CMP64ri8, X86::CMP64mi8 },
617 { X86::CMP64rr, X86::CMP64rm },
618 { X86::CMP8rr, X86::CMP8rm },
619 { X86::CMPPDrri, X86::CMPPDrmi },
620 { X86::CMPPSrri, X86::CMPPSrmi },
621 { X86::CMPSDrr, X86::CMPSDrm },
622 { X86::CMPSSrr, X86::CMPSSrm },
623 { X86::CVTSD2SSrr, X86::CVTSD2SSrm },
624 { X86::CVTSI2SD64rr, X86::CVTSI2SD64rm },
625 { X86::CVTSI2SDrr, X86::CVTSI2SDrm },
626 { X86::CVTSI2SS64rr, X86::CVTSI2SS64rm },
627 { X86::CVTSI2SSrr, X86::CVTSI2SSrm },
628 { X86::CVTSS2SDrr, X86::CVTSS2SDrm },
629 { X86::CVTTSD2SI64rr, X86::CVTTSD2SI64rm },
630 { X86::CVTTSD2SIrr, X86::CVTTSD2SIrm },
631 { X86::CVTTSS2SI64rr, X86::CVTTSS2SI64rm },
632 { X86::CVTTSS2SIrr, X86::CVTTSS2SIrm },
633 { X86::FsMOVAPDrr, X86::MOVSDrm },
634 { X86::FsMOVAPSrr, X86::MOVSSrm },
635 { X86::IMUL16rri, X86::IMUL16rmi },
636 { X86::IMUL16rri8, X86::IMUL16rmi8 },
637 { X86::IMUL32rri, X86::IMUL32rmi },
638 { X86::IMUL32rri8, X86::IMUL32rmi8 },
639 { X86::IMUL64rr, X86::IMUL64rm },
640 { X86::IMUL64rri32, X86::IMUL64rmi32 },
641 { X86::IMUL64rri8, X86::IMUL64rmi8 },
642 { X86::Int_CMPSDrr, X86::Int_CMPSDrm },
643 { X86::Int_CMPSSrr, X86::Int_CMPSSrm },
644 { X86::Int_COMISDrr, X86::Int_COMISDrm },
645 { X86::Int_COMISSrr, X86::Int_COMISSrm },
646 { X86::Int_CVTDQ2PDrr, X86::Int_CVTDQ2PDrm },
647 { X86::Int_CVTDQ2PSrr, X86::Int_CVTDQ2PSrm },
648 { X86::Int_CVTPD2DQrr, X86::Int_CVTPD2DQrm },
649 { X86::Int_CVTPD2PSrr, X86::Int_CVTPD2PSrm },
650 { X86::Int_CVTPS2DQrr, X86::Int_CVTPS2DQrm },
651 { X86::Int_CVTPS2PDrr, X86::Int_CVTPS2PDrm },
652 { X86::Int_CVTSD2SI64rr,X86::Int_CVTSD2SI64rm },
653 { X86::Int_CVTSD2SIrr, X86::Int_CVTSD2SIrm },
654 { X86::Int_CVTSD2SSrr, X86::Int_CVTSD2SSrm },
655 { X86::Int_CVTSI2SD64rr,X86::Int_CVTSI2SD64rm },
656 { X86::Int_CVTSI2SDrr, X86::Int_CVTSI2SDrm },
657 { X86::Int_CVTSI2SS64rr,X86::Int_CVTSI2SS64rm },
658 { X86::Int_CVTSI2SSrr, X86::Int_CVTSI2SSrm },
659 { X86::Int_CVTSS2SDrr, X86::Int_CVTSS2SDrm },
660 { X86::Int_CVTSS2SI64rr,X86::Int_CVTSS2SI64rm },
661 { X86::Int_CVTSS2SIrr, X86::Int_CVTSS2SIrm },
662 { X86::Int_CVTTPD2DQrr, X86::Int_CVTTPD2DQrm },
663 { X86::Int_CVTTPS2DQrr, X86::Int_CVTTPS2DQrm },
664 { X86::Int_CVTTSD2SI64rr,X86::Int_CVTTSD2SI64rm },
665 { X86::Int_CVTTSD2SIrr, X86::Int_CVTTSD2SIrm },
666 { X86::Int_CVTTSS2SI64rr,X86::Int_CVTTSS2SI64rm },
667 { X86::Int_CVTTSS2SIrr, X86::Int_CVTTSS2SIrm },
668 { X86::Int_UCOMISDrr, X86::Int_UCOMISDrm },
669 { X86::Int_UCOMISSrr, X86::Int_UCOMISSrm },
670 { X86::MOV16rr, X86::MOV16rm },
671 { X86::MOV32rr, X86::MOV32rm },
672 { X86::MOV64rr, X86::MOV64rm },
673 { X86::MOV64toPQIrr, X86::MOV64toPQIrm },
674 { X86::MOV64toSDrr, X86::MOV64toSDrm },
675 { X86::MOV8rr, X86::MOV8rm },
676 { X86::MOVAPDrr, X86::MOVAPDrm },
677 { X86::MOVAPSrr, X86::MOVAPSrm },
678 { X86::MOVDDUPrr, X86::MOVDDUPrm },
679 { X86::MOVDI2PDIrr, X86::MOVDI2PDIrm },
680 { X86::MOVDI2SSrr, X86::MOVDI2SSrm },
681 { X86::MOVSD2PDrr, X86::MOVSD2PDrm },
682 { X86::MOVSDrr, X86::MOVSDrm },
683 { X86::MOVSHDUPrr, X86::MOVSHDUPrm },
684 { X86::MOVSLDUPrr, X86::MOVSLDUPrm },
685 { X86::MOVSS2PSrr, X86::MOVSS2PSrm },
686 { X86::MOVSSrr, X86::MOVSSrm },
687 { X86::MOVSX16rr8, X86::MOVSX16rm8 },
688 { X86::MOVSX32rr16, X86::MOVSX32rm16 },
689 { X86::MOVSX32rr8, X86::MOVSX32rm8 },
690 { X86::MOVSX64rr16, X86::MOVSX64rm16 },
691 { X86::MOVSX64rr32, X86::MOVSX64rm32 },
692 { X86::MOVSX64rr8, X86::MOVSX64rm8 },
693 { X86::MOVUPDrr, X86::MOVUPDrm },
694 { X86::MOVUPSrr, X86::MOVUPSrm },
695 { X86::MOVZX16rr8, X86::MOVZX16rm8 },
696 { X86::MOVZX32rr16, X86::MOVZX32rm16 },
697 { X86::MOVZX32rr8, X86::MOVZX32rm8 },
698 { X86::MOVZX64rr16, X86::MOVZX64rm16 },
699 { X86::MOVZX64rr8, X86::MOVZX64rm8 },
700 { X86::PSHUFDri, X86::PSHUFDmi },
701 { X86::PSHUFHWri, X86::PSHUFHWmi },
702 { X86::PSHUFLWri, X86::PSHUFLWmi },
703 { X86::PsMOVZX64rr32, X86::PsMOVZX64rm32 },
704 { X86::TEST16rr, X86::TEST16rm },
705 { X86::TEST32rr, X86::TEST32rm },
706 { X86::TEST64rr, X86::TEST64rm },
707 { X86::TEST8rr, X86::TEST8rm },
708 // FIXME: TEST*rr EAX,EAX ---> CMP [mem], 0
709 { X86::UCOMISDrr, X86::UCOMISDrm },
710 { X86::UCOMISSrr, X86::UCOMISSrm },
711 { X86::XCHG16rr, X86::XCHG16rm },
712 { X86::XCHG32rr, X86::XCHG32rm },
713 { X86::XCHG64rr, X86::XCHG64rm },
714 { X86::XCHG8rr, X86::XCHG8rm }
716 ASSERT_SORTED(OpcodeTable);
717 OpcodeTablePtr = OpcodeTable;
718 OpcodeTableSize = ARRAY_SIZE(OpcodeTable);
720 static const TableEntry OpcodeTable[] = {
721 { X86::ADC32rr, X86::ADC32rm },
722 { X86::ADC64rr, X86::ADC64rm },
723 { X86::ADD16rr, X86::ADD16rm },
724 { X86::ADD32rr, X86::ADD32rm },
725 { X86::ADD64rr, X86::ADD64rm },
726 { X86::ADD8rr, X86::ADD8rm },
727 { X86::ADDPDrr, X86::ADDPDrm },
728 { X86::ADDPSrr, X86::ADDPSrm },
729 { X86::ADDSDrr, X86::ADDSDrm },
730 { X86::ADDSSrr, X86::ADDSSrm },
731 { X86::ADDSUBPDrr, X86::ADDSUBPDrm },
732 { X86::ADDSUBPSrr, X86::ADDSUBPSrm },
733 { X86::AND16rr, X86::AND16rm },
734 { X86::AND32rr, X86::AND32rm },
735 { X86::AND64rr, X86::AND64rm },
736 { X86::AND8rr, X86::AND8rm },
737 { X86::ANDNPDrr, X86::ANDNPDrm },
738 { X86::ANDNPSrr, X86::ANDNPSrm },
739 { X86::ANDPDrr, X86::ANDPDrm },
740 { X86::ANDPSrr, X86::ANDPSrm },
741 { X86::CMOVA16rr, X86::CMOVA16rm },
742 { X86::CMOVA32rr, X86::CMOVA32rm },
743 { X86::CMOVA64rr, X86::CMOVA64rm },
744 { X86::CMOVAE16rr, X86::CMOVAE16rm },
745 { X86::CMOVAE32rr, X86::CMOVAE32rm },
746 { X86::CMOVAE64rr, X86::CMOVAE64rm },
747 { X86::CMOVB16rr, X86::CMOVB16rm },
748 { X86::CMOVB32rr, X86::CMOVB32rm },
749 { X86::CMOVB64rr, X86::CMOVB64rm },
750 { X86::CMOVBE16rr, X86::CMOVBE16rm },
751 { X86::CMOVBE32rr, X86::CMOVBE32rm },
752 { X86::CMOVBE64rr, X86::CMOVBE64rm },
753 { X86::CMOVE16rr, X86::CMOVE16rm },
754 { X86::CMOVE32rr, X86::CMOVE32rm },
755 { X86::CMOVE64rr, X86::CMOVE64rm },
756 { X86::CMOVG16rr, X86::CMOVG16rm },
757 { X86::CMOVG32rr, X86::CMOVG32rm },
758 { X86::CMOVG64rr, X86::CMOVG64rm },
759 { X86::CMOVGE16rr, X86::CMOVGE16rm },
760 { X86::CMOVGE32rr, X86::CMOVGE32rm },
761 { X86::CMOVGE64rr, X86::CMOVGE64rm },
762 { X86::CMOVL16rr, X86::CMOVL16rm },
763 { X86::CMOVL32rr, X86::CMOVL32rm },
764 { X86::CMOVL64rr, X86::CMOVL64rm },
765 { X86::CMOVLE16rr, X86::CMOVLE16rm },
766 { X86::CMOVLE32rr, X86::CMOVLE32rm },
767 { X86::CMOVLE64rr, X86::CMOVLE64rm },
768 { X86::CMOVNE16rr, X86::CMOVNE16rm },
769 { X86::CMOVNE32rr, X86::CMOVNE32rm },
770 { X86::CMOVNE64rr, X86::CMOVNE64rm },
771 { X86::CMOVNP16rr, X86::CMOVNP16rm },
772 { X86::CMOVNP32rr, X86::CMOVNP32rm },
773 { X86::CMOVNP64rr, X86::CMOVNP64rm },
774 { X86::CMOVNS16rr, X86::CMOVNS16rm },
775 { X86::CMOVNS32rr, X86::CMOVNS32rm },
776 { X86::CMOVNS64rr, X86::CMOVNS64rm },
777 { X86::CMOVP16rr, X86::CMOVP16rm },
778 { X86::CMOVP32rr, X86::CMOVP32rm },
779 { X86::CMOVP64rr, X86::CMOVP64rm },
780 { X86::CMOVS16rr, X86::CMOVS16rm },
781 { X86::CMOVS32rr, X86::CMOVS32rm },
782 { X86::CMOVS64rr, X86::CMOVS64rm },
783 { X86::DIVPDrr, X86::DIVPDrm },
784 { X86::DIVPSrr, X86::DIVPSrm },
785 { X86::DIVSDrr, X86::DIVSDrm },
786 { X86::DIVSSrr, X86::DIVSSrm },
787 { X86::HADDPDrr, X86::HADDPDrm },
788 { X86::HADDPSrr, X86::HADDPSrm },
789 { X86::HSUBPDrr, X86::HSUBPDrm },
790 { X86::HSUBPSrr, X86::HSUBPSrm },
791 { X86::IMUL16rr, X86::IMUL16rm },
792 { X86::IMUL32rr, X86::IMUL32rm },
793 { X86::MAXPDrr, X86::MAXPDrm },
794 { X86::MAXPDrr_Int, X86::MAXPDrm_Int },
795 { X86::MAXPSrr, X86::MAXPSrm },
796 { X86::MAXPSrr_Int, X86::MAXPSrm_Int },
797 { X86::MAXSDrr, X86::MAXSDrm },
798 { X86::MAXSDrr_Int, X86::MAXSDrm_Int },
799 { X86::MAXSSrr, X86::MAXSSrm },
800 { X86::MAXSSrr_Int, X86::MAXSSrm_Int },
801 { X86::MINPDrr, X86::MINPDrm },
802 { X86::MINPDrr_Int, X86::MINPDrm_Int },
803 { X86::MINPSrr, X86::MINPSrm },
804 { X86::MINPSrr_Int, X86::MINPSrm_Int },
805 { X86::MINSDrr, X86::MINSDrm },
806 { X86::MINSDrr_Int, X86::MINSDrm_Int },
807 { X86::MINSSrr, X86::MINSSrm },
808 { X86::MINSSrr_Int, X86::MINSSrm_Int },
809 { X86::MULPDrr, X86::MULPDrm },
810 { X86::MULPSrr, X86::MULPSrm },
811 { X86::MULSDrr, X86::MULSDrm },
812 { X86::MULSSrr, X86::MULSSrm },
813 { X86::OR16rr, X86::OR16rm },
814 { X86::OR32rr, X86::OR32rm },
815 { X86::OR64rr, X86::OR64rm },
816 { X86::OR8rr, X86::OR8rm },
817 { X86::ORPDrr, X86::ORPDrm },
818 { X86::ORPSrr, X86::ORPSrm },
819 { X86::PACKSSDWrr, X86::PACKSSDWrm },
820 { X86::PACKSSWBrr, X86::PACKSSWBrm },
821 { X86::PACKUSWBrr, X86::PACKUSWBrm },
822 { X86::PADDBrr, X86::PADDBrm },
823 { X86::PADDDrr, X86::PADDDrm },
824 { X86::PADDQrr, X86::PADDQrm },
825 { X86::PADDSBrr, X86::PADDSBrm },
826 { X86::PADDSWrr, X86::PADDSWrm },
827 { X86::PADDWrr, X86::PADDWrm },
828 { X86::PANDNrr, X86::PANDNrm },
829 { X86::PANDrr, X86::PANDrm },
830 { X86::PAVGBrr, X86::PAVGBrm },
831 { X86::PAVGWrr, X86::PAVGWrm },
832 { X86::PCMPEQBrr, X86::PCMPEQBrm },
833 { X86::PCMPEQDrr, X86::PCMPEQDrm },
834 { X86::PCMPEQWrr, X86::PCMPEQWrm },
835 { X86::PCMPGTBrr, X86::PCMPGTBrm },
836 { X86::PCMPGTDrr, X86::PCMPGTDrm },
837 { X86::PCMPGTWrr, X86::PCMPGTWrm },
838 { X86::PINSRWrri, X86::PINSRWrmi },
839 { X86::PMADDWDrr, X86::PMADDWDrm },
840 { X86::PMAXSWrr, X86::PMAXSWrm },
841 { X86::PMAXUBrr, X86::PMAXUBrm },
842 { X86::PMINSWrr, X86::PMINSWrm },
843 { X86::PMINUBrr, X86::PMINUBrm },
844 { X86::PMULHUWrr, X86::PMULHUWrm },
845 { X86::PMULHWrr, X86::PMULHWrm },
846 { X86::PMULLWrr, X86::PMULLWrm },
847 { X86::PMULUDQrr, X86::PMULUDQrm },
848 { X86::PORrr, X86::PORrm },
849 { X86::PSADBWrr, X86::PSADBWrm },
850 { X86::PSLLDrr, X86::PSLLDrm },
851 { X86::PSLLQrr, X86::PSLLQrm },
852 { X86::PSLLWrr, X86::PSLLWrm },
853 { X86::PSRADrr, X86::PSRADrm },
854 { X86::PSRAWrr, X86::PSRAWrm },
855 { X86::PSRLDrr, X86::PSRLDrm },
856 { X86::PSRLQrr, X86::PSRLQrm },
857 { X86::PSRLWrr, X86::PSRLWrm },
858 { X86::PSUBBrr, X86::PSUBBrm },
859 { X86::PSUBDrr, X86::PSUBDrm },
860 { X86::PSUBSBrr, X86::PSUBSBrm },
861 { X86::PSUBSWrr, X86::PSUBSWrm },
862 { X86::PSUBWrr, X86::PSUBWrm },
863 { X86::PUNPCKHBWrr, X86::PUNPCKHBWrm },
864 { X86::PUNPCKHDQrr, X86::PUNPCKHDQrm },
865 { X86::PUNPCKHQDQrr, X86::PUNPCKHQDQrm },
866 { X86::PUNPCKHWDrr, X86::PUNPCKHWDrm },
867 { X86::PUNPCKLBWrr, X86::PUNPCKLBWrm },
868 { X86::PUNPCKLDQrr, X86::PUNPCKLDQrm },
869 { X86::PUNPCKLQDQrr, X86::PUNPCKLQDQrm },
870 { X86::PUNPCKLWDrr, X86::PUNPCKLWDrm },
871 { X86::PXORrr, X86::PXORrm },
872 { X86::RCPPSr, X86::RCPPSm },
873 { X86::RCPPSr_Int, X86::RCPPSm_Int },
874 { X86::RSQRTPSr, X86::RSQRTPSm },
875 { X86::RSQRTPSr_Int, X86::RSQRTPSm_Int },
876 { X86::RSQRTSSr, X86::RSQRTSSm },
877 { X86::RSQRTSSr_Int, X86::RSQRTSSm_Int },
878 { X86::SBB32rr, X86::SBB32rm },
879 { X86::SBB64rr, X86::SBB64rm },
880 { X86::SHUFPDrri, X86::SHUFPDrmi },
881 { X86::SHUFPSrri, X86::SHUFPSrmi },
882 { X86::SQRTPDr, X86::SQRTPDm },
883 { X86::SQRTPDr_Int, X86::SQRTPDm_Int },
884 { X86::SQRTPSr, X86::SQRTPSm },
885 { X86::SQRTPSr_Int, X86::SQRTPSm_Int },
886 { X86::SQRTSDr, X86::SQRTSDm },
887 { X86::SQRTSDr_Int, X86::SQRTSDm_Int },
888 { X86::SQRTSSr, X86::SQRTSSm },
889 { X86::SQRTSSr_Int, X86::SQRTSSm_Int },
890 { X86::SUB16rr, X86::SUB16rm },
891 { X86::SUB32rr, X86::SUB32rm },
892 { X86::SUB64rr, X86::SUB64rm },
893 { X86::SUB8rr, X86::SUB8rm },
894 { X86::SUBPDrr, X86::SUBPDrm },
895 { X86::SUBPSrr, X86::SUBPSrm },
896 { X86::SUBSDrr, X86::SUBSDrm },
897 { X86::SUBSSrr, X86::SUBSSrm },
898 // FIXME: TEST*rr -> swapped operand of TEST*mr.
899 { X86::UNPCKHPDrr, X86::UNPCKHPDrm },
900 { X86::UNPCKHPSrr, X86::UNPCKHPSrm },
901 { X86::UNPCKLPDrr, X86::UNPCKLPDrm },
902 { X86::UNPCKLPSrr, X86::UNPCKLPSrm },
903 { X86::XOR16rr, X86::XOR16rm },
904 { X86::XOR32rr, X86::XOR32rm },
905 { X86::XOR64rr, X86::XOR64rm },
906 { X86::XOR8rr, X86::XOR8rm },
907 { X86::XORPDrr, X86::XORPDrm },
908 { X86::XORPSrr, X86::XORPSrm }
910 ASSERT_SORTED(OpcodeTable);
911 OpcodeTablePtr = OpcodeTable;
912 OpcodeTableSize = ARRAY_SIZE(OpcodeTable);
915 // If table selected...
916 if (OpcodeTablePtr) {
917 // Find the Opcode to fuse
918 unsigned fromOpcode = MI->getOpcode();
919 // Lookup fromOpcode in table
920 if (const TableEntry *Entry = TableLookup(OpcodeTablePtr, OpcodeTableSize,
923 NewMI = FuseTwoAddrInst(Entry->to, FrameIndex, MI, TII);
925 NewMI = FuseInst(Entry->to, i, FrameIndex, MI, TII);
926 NewMI->copyKillDeadInfo(MI);
932 if (PrintFailedFusing)
933 cerr << "We failed to fuse ("
934 << ((i == 1) ? "r" : "s") << "): " << *MI;
939 const unsigned *X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
941 static const unsigned CalleeSavedRegs32Bit[] = {
942 X86::ESI, X86::EDI, X86::EBX, X86::EBP, 0
945 static const unsigned CalleeSavedRegs32EHRet[] = {
946 X86::EAX, X86::EDX, X86::ESI, X86::EDI, X86::EBX, X86::EBP, 0
949 static const unsigned CalleeSavedRegs64Bit[] = {
950 X86::RBX, X86::R12, X86::R13, X86::R14, X86::R15, X86::RBP, 0
954 return CalleeSavedRegs64Bit;
957 MachineFrameInfo *MFI = MF->getFrameInfo();
958 MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
959 if (MMI && MMI->callsEHReturn())
960 return CalleeSavedRegs32EHRet;
962 return CalleeSavedRegs32Bit;
966 const TargetRegisterClass* const*
967 X86RegisterInfo::getCalleeSavedRegClasses(const MachineFunction *MF) const {
968 static const TargetRegisterClass * const CalleeSavedRegClasses32Bit[] = {
969 &X86::GR32RegClass, &X86::GR32RegClass,
970 &X86::GR32RegClass, &X86::GR32RegClass, 0
972 static const TargetRegisterClass * const CalleeSavedRegClasses32EHRet[] = {
973 &X86::GR32RegClass, &X86::GR32RegClass,
974 &X86::GR32RegClass, &X86::GR32RegClass,
975 &X86::GR32RegClass, &X86::GR32RegClass, 0
977 static const TargetRegisterClass * const CalleeSavedRegClasses64Bit[] = {
978 &X86::GR64RegClass, &X86::GR64RegClass,
979 &X86::GR64RegClass, &X86::GR64RegClass,
980 &X86::GR64RegClass, &X86::GR64RegClass, 0
984 return CalleeSavedRegClasses64Bit;
987 MachineFrameInfo *MFI = MF->getFrameInfo();
988 MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
989 if (MMI && MMI->callsEHReturn())
990 return CalleeSavedRegClasses32EHRet;
992 return CalleeSavedRegClasses32Bit;
997 BitVector X86RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
998 BitVector Reserved(getNumRegs());
999 Reserved.set(X86::RSP);
1000 Reserved.set(X86::ESP);
1001 Reserved.set(X86::SP);
1002 Reserved.set(X86::SPL);
1004 Reserved.set(X86::RBP);
1005 Reserved.set(X86::EBP);
1006 Reserved.set(X86::BP);
1007 Reserved.set(X86::BPL);
1012 //===----------------------------------------------------------------------===//
1013 // Stack Frame Processing methods
1014 //===----------------------------------------------------------------------===//
1016 // hasFP - Return true if the specified function should have a dedicated frame
1017 // pointer register. This is true if the function has variable sized allocas or
1018 // if frame pointer elimination is disabled.
1020 bool X86RegisterInfo::hasFP(const MachineFunction &MF) const {
1021 MachineFrameInfo *MFI = MF.getFrameInfo();
1022 MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
1024 return (NoFramePointerElim ||
1025 MF.getFrameInfo()->hasVarSizedObjects() ||
1026 MF.getInfo<X86MachineFunctionInfo>()->getForceFramePointer() ||
1027 (MMI && MMI->callsUnwindInit()));
1030 void X86RegisterInfo::
1031 eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
1032 MachineBasicBlock::iterator I) const {
1034 // If we have a frame pointer, turn the adjcallstackup instruction into a
1035 // 'sub ESP, <amt>' and the adjcallstackdown instruction into 'add ESP,
1037 MachineInstr *Old = I;
1038 uint64_t Amount = Old->getOperand(0).getImm();
1040 // We need to keep the stack aligned properly. To do this, we round the
1041 // amount of space needed for the outgoing arguments up to the next
1042 // alignment boundary.
1043 unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
1044 Amount = (Amount+Align-1)/Align*Align;
1046 MachineInstr *New = 0;
1047 if (Old->getOpcode() == X86::ADJCALLSTACKDOWN) {
1048 New=BuildMI(TII.get(Is64Bit ? X86::SUB64ri32 : X86::SUB32ri), StackPtr)
1049 .addReg(StackPtr).addImm(Amount);
1051 assert(Old->getOpcode() == X86::ADJCALLSTACKUP);
1052 // factor out the amount the callee already popped.
1053 uint64_t CalleeAmt = Old->getOperand(1).getImm();
1054 Amount -= CalleeAmt;
1056 unsigned Opc = (Amount < 128) ?
1057 (Is64Bit ? X86::ADD64ri8 : X86::ADD32ri8) :
1058 (Is64Bit ? X86::ADD64ri32 : X86::ADD32ri);
1059 New = BuildMI(TII.get(Opc), StackPtr)
1060 .addReg(StackPtr).addImm(Amount);
1064 // Replace the pseudo instruction with a new instruction...
1065 if (New) MBB.insert(I, New);
1067 } else if (I->getOpcode() == X86::ADJCALLSTACKUP) {
1068 // If we are performing frame pointer elimination and if the callee pops
1069 // something off the stack pointer, add it back. We do this until we have
1070 // more advanced stack pointer tracking ability.
1071 if (uint64_t CalleeAmt = I->getOperand(1).getImm()) {
1072 unsigned Opc = (CalleeAmt < 128) ?
1073 (Is64Bit ? X86::SUB64ri8 : X86::SUB32ri8) :
1074 (Is64Bit ? X86::SUB64ri32 : X86::SUB32ri);
1076 BuildMI(TII.get(Opc), StackPtr).addReg(StackPtr).addImm(CalleeAmt);
1084 void X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
1085 int SPAdj, RegScavenger *RS) const{
1086 assert(SPAdj == 0 && "Unexpected");
1089 MachineInstr &MI = *II;
1090 MachineFunction &MF = *MI.getParent()->getParent();
1091 while (!MI.getOperand(i).isFrameIndex()) {
1093 assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!");
1096 int FrameIndex = MI.getOperand(i).getFrameIndex();
1097 // This must be part of a four operand memory reference. Replace the
1098 // FrameIndex with base register with EBP. Add an offset to the offset.
1099 MI.getOperand(i).ChangeToRegister(hasFP(MF) ? FramePtr : StackPtr, false);
1101 // Now add the frame object offset to the offset from EBP.
1102 int64_t Offset = MF.getFrameInfo()->getObjectOffset(FrameIndex) +
1103 MI.getOperand(i+3).getImm()+SlotSize;
1106 Offset += MF.getFrameInfo()->getStackSize();
1108 Offset += SlotSize; // Skip the saved EBP
1110 MI.getOperand(i+3).ChangeToImmediate(Offset);
1114 X86RegisterInfo::processFunctionBeforeFrameFinalized(MachineFunction &MF) const{
1116 // Create a frame entry for the EBP register that must be saved.
1117 int FrameIdx = MF.getFrameInfo()->CreateFixedObject(SlotSize,
1118 (int)SlotSize * -2);
1119 assert(FrameIdx == MF.getFrameInfo()->getObjectIndexBegin() &&
1120 "Slot for EBP register must be last in order to be found!");
1124 /// emitSPUpdate - Emit a series of instructions to increment / decrement the
1125 /// stack pointer by a constant value.
1127 void emitSPUpdate(MachineBasicBlock &MBB, MachineBasicBlock::iterator &MBBI,
1128 unsigned StackPtr, int64_t NumBytes, bool Is64Bit,
1129 const TargetInstrInfo &TII) {
1130 bool isSub = NumBytes < 0;
1131 uint64_t Offset = isSub ? -NumBytes : NumBytes;
1132 unsigned Opc = isSub
1134 (Is64Bit ? X86::SUB64ri8 : X86::SUB32ri8) :
1135 (Is64Bit ? X86::SUB64ri32 : X86::SUB32ri))
1137 (Is64Bit ? X86::ADD64ri8 : X86::ADD32ri8) :
1138 (Is64Bit ? X86::ADD64ri32 : X86::ADD32ri));
1139 uint64_t Chunk = (1LL << 31) - 1;
1142 uint64_t ThisVal = (Offset > Chunk) ? Chunk : Offset;
1143 BuildMI(MBB, MBBI, TII.get(Opc), StackPtr).addReg(StackPtr).addImm(ThisVal);
1148 void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
1149 MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
1150 MachineFrameInfo *MFI = MF.getFrameInfo();
1151 unsigned Align = MF.getTarget().getFrameInfo()->getStackAlignment();
1152 const Function* Fn = MF.getFunction();
1153 const X86Subtarget* Subtarget = &MF.getTarget().getSubtarget<X86Subtarget>();
1154 MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
1155 X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
1156 MachineBasicBlock::iterator MBBI = MBB.begin();
1158 // Prepare for frame info.
1159 unsigned FrameLabelId = 0, StartLabelId = 0;
1161 // Get the number of bytes to allocate from the FrameInfo
1162 uint64_t StackSize = MFI->getStackSize();
1163 uint64_t NumBytes = StackSize - X86FI->getCalleeSavedFrameSize();
1165 if (MMI && MMI->needsFrameInfo()) {
1166 // Mark function start
1167 StartLabelId = MMI->NextLabelID();
1168 BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(StartLabelId);
1172 // Get the offset of the stack slot for the EBP register... which is
1173 // guaranteed to be the last slot by processFunctionBeforeFrameFinalized.
1174 // Update the frame offset adjustment.
1175 MFI->setOffsetAdjustment(SlotSize-NumBytes);
1177 // Save EBP into the appropriate stack slot...
1178 BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::PUSH64r : X86::PUSH32r))
1180 NumBytes -= SlotSize;
1182 if (MMI && MMI->needsFrameInfo()) {
1183 // Mark effective beginning of when frame pointer becomes valid.
1184 FrameLabelId = MMI->NextLabelID();
1185 BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(FrameLabelId);
1188 // Update EBP with the new base value...
1189 BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr), FramePtr)
1193 unsigned ReadyLabelId = 0;
1194 if (MMI && MMI->needsFrameInfo()) {
1195 // Mark effective beginning of when frame pointer is ready.
1196 ReadyLabelId = MMI->NextLabelID();
1197 BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(ReadyLabelId);
1200 // Skip the callee-saved push instructions.
1201 while (MBBI != MBB.end() &&
1202 (MBBI->getOpcode() == X86::PUSH32r ||
1203 MBBI->getOpcode() == X86::PUSH64r))
1206 if (NumBytes) { // adjust stack pointer: ESP -= numbytes
1207 if (NumBytes >= 4096 && Subtarget->isTargetCygMing()) {
1208 // Check, whether EAX is livein for this function
1209 bool isEAXAlive = false;
1210 for (MachineFunction::livein_iterator II = MF.livein_begin(),
1211 EE = MF.livein_end(); (II != EE) && !isEAXAlive; ++II) {
1212 unsigned Reg = II->first;
1213 isEAXAlive = (Reg == X86::EAX || Reg == X86::AX ||
1214 Reg == X86::AH || Reg == X86::AL);
1217 // Function prologue calls _alloca to probe the stack when allocating
1218 // more than 4k bytes in one go. Touching the stack at 4K increments is
1219 // necessary to ensure that the guard pages used by the OS virtual memory
1220 // manager are allocated in correct sequence.
1222 BuildMI(MBB, MBBI, TII.get(X86::MOV32ri), X86::EAX).addImm(NumBytes);
1223 BuildMI(MBB, MBBI, TII.get(X86::CALLpcrel32))
1224 .addExternalSymbol("_alloca");
1227 BuildMI(MBB, MBBI, TII.get(X86::PUSH32r), X86::EAX);
1228 // Allocate NumBytes-4 bytes on stack. We'll also use 4 already
1229 // allocated bytes for EAX.
1230 BuildMI(MBB, MBBI, TII.get(X86::MOV32ri), X86::EAX).addImm(NumBytes-4);
1231 BuildMI(MBB, MBBI, TII.get(X86::CALLpcrel32))
1232 .addExternalSymbol("_alloca");
1234 MachineInstr *MI = addRegOffset(BuildMI(TII.get(X86::MOV32rm),X86::EAX),
1235 StackPtr, NumBytes-4);
1236 MBB.insert(MBBI, MI);
1239 emitSPUpdate(MBB, MBBI, StackPtr, -(int64_t)NumBytes, Is64Bit, TII);
1243 if (MMI && MMI->needsFrameInfo()) {
1244 std::vector<MachineMove> &Moves = MMI->getFrameMoves();
1245 const TargetAsmInfo *TAI = MF.getTarget().getTargetAsmInfo();
1247 // Calculate amount of bytes used for return address storing
1249 (MF.getTarget().getFrameInfo()->getStackGrowthDirection() ==
1250 TargetFrameInfo::StackGrowsUp ?
1251 TAI->getAddressSize() : -TAI->getAddressSize());
1254 // Show update of SP.
1257 MachineLocation SPDst(MachineLocation::VirtualFP);
1258 MachineLocation SPSrc(MachineLocation::VirtualFP, 2*stackGrowth);
1259 Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
1261 MachineLocation SPDst(MachineLocation::VirtualFP);
1262 MachineLocation SPSrc(MachineLocation::VirtualFP, -StackSize+stackGrowth);
1263 Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
1266 //FIXME: Verify & implement for FP
1267 MachineLocation SPDst(StackPtr);
1268 MachineLocation SPSrc(StackPtr, stackGrowth);
1269 Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
1272 // Add callee saved registers to move list.
1273 const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
1274 for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
1275 int64_t Offset = MFI->getObjectOffset(CSI[I].getFrameIdx());
1276 unsigned Reg = CSI[I].getReg();
1277 MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
1278 MachineLocation CSSrc(Reg);
1279 Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc));
1284 MachineLocation FPDst(MachineLocation::VirtualFP, 2*stackGrowth);
1285 MachineLocation FPSrc(FramePtr);
1286 Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc));
1289 MachineLocation FPDst(hasFP(MF) ? FramePtr : StackPtr);
1290 MachineLocation FPSrc(MachineLocation::VirtualFP);
1291 Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc));
1294 // If it's main() on Cygwin\Mingw32 we should align stack as well
1295 if (Fn->hasExternalLinkage() && Fn->getName() == "main" &&
1296 Subtarget->isTargetCygMing()) {
1297 BuildMI(MBB, MBBI, TII.get(X86::AND32ri), X86::ESP)
1298 .addReg(X86::ESP).addImm(-Align);
1301 BuildMI(MBB, MBBI, TII.get(X86::MOV32ri), X86::EAX).addImm(Align);
1302 BuildMI(MBB, MBBI, TII.get(X86::CALLpcrel32)).addExternalSymbol("_alloca");
1306 void X86RegisterInfo::emitEpilogue(MachineFunction &MF,
1307 MachineBasicBlock &MBB) const {
1308 const MachineFrameInfo *MFI = MF.getFrameInfo();
1309 X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
1310 MachineBasicBlock::iterator MBBI = prior(MBB.end());
1311 unsigned RetOpcode = MBBI->getOpcode();
1313 switch (RetOpcode) {
1316 case X86::EH_RETURN:
1319 case X86::TAILJMPm: break; // These are ok
1321 assert(0 && "Can only insert epilog into returning blocks");
1324 // Get the number of bytes to allocate from the FrameInfo
1325 uint64_t StackSize = MFI->getStackSize();
1326 unsigned CSSize = X86FI->getCalleeSavedFrameSize();
1327 uint64_t NumBytes = StackSize - CSSize;
1331 BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::POP64r : X86::POP32r), FramePtr);
1332 NumBytes -= SlotSize;
1335 // We're returning from function via eh_return.
1336 if (RetOpcode == X86::EH_RETURN) {
1337 MachineOperand &DestAddr = MBBI->getOperand(0);
1338 assert(DestAddr.isReg() && "Offset should be in register!");
1339 BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr),StackPtr).
1340 addReg(DestAddr.getReg());
1343 // Skip the callee-saved pop instructions.
1344 while (MBBI != MBB.begin()) {
1345 MachineBasicBlock::iterator PI = prior(MBBI);
1346 if (PI->getOpcode() != X86::POP32r && PI->getOpcode() != X86::POP64r)
1351 // If dynamic alloca is used, then reset esp to point to the last
1352 // callee-saved slot before popping them off!
1353 if (MFI->hasVarSizedObjects()) {
1354 unsigned Opc = Is64Bit ? X86::LEA64r : X86::LEA32r;
1355 MachineInstr *MI = addRegOffset(BuildMI(TII.get(Opc), StackPtr),
1357 MBB.insert(MBBI, MI);
1361 if (NumBytes) { // adjust stack pointer back: ESP += numbytes
1362 // If there is an ADD32ri or SUB32ri of ESP immediately before this
1363 // instruction, merge the two instructions.
1364 if (MBBI != MBB.begin()) {
1365 MachineBasicBlock::iterator PI = prior(MBBI);
1366 unsigned Opc = PI->getOpcode();
1367 if ((Opc == X86::ADD64ri32 || Opc == X86::ADD64ri8 ||
1368 Opc == X86::ADD32ri || Opc == X86::ADD32ri8) &&
1369 PI->getOperand(0).getReg() == StackPtr) {
1370 NumBytes += PI->getOperand(2).getImm();
1372 } else if ((Opc == X86::SUB64ri32 || Opc == X86::SUB64ri8 ||
1373 Opc == X86::SUB32ri || Opc == X86::SUB32ri8) &&
1374 PI->getOperand(0).getReg() == StackPtr) {
1375 NumBytes -= PI->getOperand(2).getImm();
1381 emitSPUpdate(MBB, MBBI, StackPtr, NumBytes, Is64Bit, TII);
1385 unsigned X86RegisterInfo::getRARegister() const {
1387 return X86::RIP; // Should have dwarf #16
1389 return X86::EIP; // Should have dwarf #8
1392 unsigned X86RegisterInfo::getFrameRegister(MachineFunction &MF) const {
1393 return hasFP(MF) ? FramePtr : StackPtr;
1396 void X86RegisterInfo::getInitialFrameState(std::vector<MachineMove> &Moves)
1398 // Calculate amount of bytes used for return address storing
1399 int stackGrowth = (Is64Bit ? -8 : -4);
1401 // Initial state of the frame pointer is esp+4.
1402 MachineLocation Dst(MachineLocation::VirtualFP);
1403 MachineLocation Src(StackPtr, stackGrowth);
1404 Moves.push_back(MachineMove(0, Dst, Src));
1406 // Add return address to move list
1407 MachineLocation CSDst(StackPtr, stackGrowth);
1408 MachineLocation CSSrc(getRARegister());
1409 Moves.push_back(MachineMove(0, CSDst, CSSrc));
1412 unsigned X86RegisterInfo::getEHExceptionRegister() const {
1413 assert(0 && "What is the exception register");
1417 unsigned X86RegisterInfo::getEHHandlerRegister() const {
1418 assert(0 && "What is the exception handler register");
1423 unsigned getX86SubSuperRegister(unsigned Reg, MVT::ValueType VT, bool High) {
1425 default: return Reg;
1430 case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
1432 case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
1434 case X86::CH: case X86::CL: case X86::CX: case X86::ECX: case X86::RCX:
1436 case X86::BH: case X86::BL: case X86::BX: case X86::EBX: case X86::RBX:
1442 case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
1444 case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
1446 case X86::CH: case X86::CL: case X86::CX: case X86::ECX: case X86::RCX:
1448 case X86::BH: case X86::BL: case X86::BX: case X86::EBX: case X86::RBX:
1450 case X86::SIL: case X86::SI: case X86::ESI: case X86::RSI:
1452 case X86::DIL: case X86::DI: case X86::EDI: case X86::RDI:
1454 case X86::BPL: case X86::BP: case X86::EBP: case X86::RBP:
1456 case X86::SPL: case X86::SP: case X86::ESP: case X86::RSP:
1458 case X86::R8B: case X86::R8W: case X86::R8D: case X86::R8:
1460 case X86::R9B: case X86::R9W: case X86::R9D: case X86::R9:
1462 case X86::R10B: case X86::R10W: case X86::R10D: case X86::R10:
1464 case X86::R11B: case X86::R11W: case X86::R11D: case X86::R11:
1466 case X86::R12B: case X86::R12W: case X86::R12D: case X86::R12:
1468 case X86::R13B: case X86::R13W: case X86::R13D: case X86::R13:
1470 case X86::R14B: case X86::R14W: case X86::R14D: case X86::R14:
1472 case X86::R15B: case X86::R15W: case X86::R15D: case X86::R15:
1478 default: return Reg;
1479 case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
1481 case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
1483 case X86::CH: case X86::CL: case X86::CX: case X86::ECX: case X86::RCX:
1485 case X86::BH: case X86::BL: case X86::BX: case X86::EBX: case X86::RBX:
1487 case X86::SIL: case X86::SI: case X86::ESI: case X86::RSI:
1489 case X86::DIL: case X86::DI: case X86::EDI: case X86::RDI:
1491 case X86::BPL: case X86::BP: case X86::EBP: case X86::RBP:
1493 case X86::SPL: case X86::SP: case X86::ESP: case X86::RSP:
1495 case X86::R8B: case X86::R8W: case X86::R8D: case X86::R8:
1497 case X86::R9B: case X86::R9W: case X86::R9D: case X86::R9:
1499 case X86::R10B: case X86::R10W: case X86::R10D: case X86::R10:
1501 case X86::R11B: case X86::R11W: case X86::R11D: case X86::R11:
1503 case X86::R12B: case X86::R12W: case X86::R12D: case X86::R12:
1505 case X86::R13B: case X86::R13W: case X86::R13D: case X86::R13:
1507 case X86::R14B: case X86::R14W: case X86::R14D: case X86::R14:
1509 case X86::R15B: case X86::R15W: case X86::R15D: case X86::R15:
1514 default: return Reg;
1515 case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
1517 case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
1519 case X86::CH: case X86::CL: case X86::CX: case X86::ECX: case X86::RCX:
1521 case X86::BH: case X86::BL: case X86::BX: case X86::EBX: case X86::RBX:
1523 case X86::SIL: case X86::SI: case X86::ESI: case X86::RSI:
1525 case X86::DIL: case X86::DI: case X86::EDI: case X86::RDI:
1527 case X86::BPL: case X86::BP: case X86::EBP: case X86::RBP:
1529 case X86::SPL: case X86::SP: case X86::ESP: case X86::RSP:
1531 case X86::R8B: case X86::R8W: case X86::R8D: case X86::R8:
1533 case X86::R9B: case X86::R9W: case X86::R9D: case X86::R9:
1535 case X86::R10B: case X86::R10W: case X86::R10D: case X86::R10:
1537 case X86::R11B: case X86::R11W: case X86::R11D: case X86::R11:
1539 case X86::R12B: case X86::R12W: case X86::R12D: case X86::R12:
1541 case X86::R13B: case X86::R13W: case X86::R13D: case X86::R13:
1543 case X86::R14B: case X86::R14W: case X86::R14D: case X86::R14:
1545 case X86::R15B: case X86::R15W: case X86::R15D: case X86::R15:
1550 default: return Reg;
1551 case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
1553 case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
1555 case X86::CH: case X86::CL: case X86::CX: case X86::ECX: case X86::RCX:
1557 case X86::BH: case X86::BL: case X86::BX: case X86::EBX: case X86::RBX:
1559 case X86::SIL: case X86::SI: case X86::ESI: case X86::RSI:
1561 case X86::DIL: case X86::DI: case X86::EDI: case X86::RDI:
1563 case X86::BPL: case X86::BP: case X86::EBP: case X86::RBP:
1565 case X86::SPL: case X86::SP: case X86::ESP: case X86::RSP:
1567 case X86::R8B: case X86::R8W: case X86::R8D: case X86::R8:
1569 case X86::R9B: case X86::R9W: case X86::R9D: case X86::R9:
1571 case X86::R10B: case X86::R10W: case X86::R10D: case X86::R10:
1573 case X86::R11B: case X86::R11W: case X86::R11D: case X86::R11:
1575 case X86::R12B: case X86::R12W: case X86::R12D: case X86::R12:
1577 case X86::R13B: case X86::R13W: case X86::R13D: case X86::R13:
1579 case X86::R14B: case X86::R14W: case X86::R14D: case X86::R14:
1581 case X86::R15B: case X86::R15W: case X86::R15D: case X86::R15:
1590 #include "X86GenRegisterInfo.inc"