1 //===- X86InstrInfo.cpp - X86 Instruction 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 TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #include "X86InstrInfo.h"
16 #include "X86GenInstrInfo.inc"
17 #include "X86InstrBuilder.h"
18 #include "X86Subtarget.h"
19 #include "X86TargetMachine.h"
20 #include "llvm/ADT/STLExtras.h"
21 #include "llvm/CodeGen/MachineInstrBuilder.h"
22 #include "llvm/CodeGen/LiveVariables.h"
23 #include "llvm/CodeGen/SSARegMap.h"
24 #include "llvm/Target/TargetOptions.h"
25 #include "llvm/Support/CommandLine.h"
30 EnableConvert3Addr("enable-x86-conv-3-addr",
31 cl::desc("Enable convertToThreeAddress for X86"));
34 X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
35 : TargetInstrInfo(X86Insts, array_lengthof(X86Insts)),
36 TM(tm), RI(tm, *this) {
39 bool X86InstrInfo::isMoveInstr(const MachineInstr& MI,
41 unsigned& destReg) const {
42 MachineOpCode oc = MI.getOpcode();
43 if (oc == X86::MOV8rr || oc == X86::MOV16rr ||
44 oc == X86::MOV32rr || oc == X86::MOV64rr ||
45 oc == X86::MOV16to16_ || oc == X86::MOV32to32_ ||
46 oc == X86::MOV_Fp3232 || oc == X86::MOVSSrr || oc == X86::MOVSDrr ||
47 oc == X86::MOV_Fp3264 || oc == X86::MOV_Fp6432 || oc == X86::MOV_Fp6464 ||
48 oc == X86::FsMOVAPSrr || oc == X86::FsMOVAPDrr ||
49 oc == X86::MOVAPSrr || oc == X86::MOVAPDrr ||
50 oc == X86::MOVSS2PSrr || oc == X86::MOVSD2PDrr ||
51 oc == X86::MOVPS2SSrr || oc == X86::MOVPD2SDrr ||
52 oc == X86::MMX_MOVD64rr || oc == X86::MMX_MOVQ64rr) {
53 assert(MI.getNumOperands() >= 2 &&
54 MI.getOperand(0).isRegister() &&
55 MI.getOperand(1).isRegister() &&
56 "invalid register-register move instruction");
57 sourceReg = MI.getOperand(1).getReg();
58 destReg = MI.getOperand(0).getReg();
64 unsigned X86InstrInfo::isLoadFromStackSlot(MachineInstr *MI,
65 int &FrameIndex) const {
66 switch (MI->getOpcode()) {
79 case X86::MMX_MOVD64rm:
80 case X86::MMX_MOVQ64rm:
81 if (MI->getOperand(1).isFrameIndex() && MI->getOperand(2).isImmediate() &&
82 MI->getOperand(3).isRegister() && MI->getOperand(4).isImmediate() &&
83 MI->getOperand(2).getImmedValue() == 1 &&
84 MI->getOperand(3).getReg() == 0 &&
85 MI->getOperand(4).getImmedValue() == 0) {
86 FrameIndex = MI->getOperand(1).getFrameIndex();
87 return MI->getOperand(0).getReg();
94 unsigned X86InstrInfo::isStoreToStackSlot(MachineInstr *MI,
95 int &FrameIndex) const {
96 switch (MI->getOpcode()) {
109 case X86::MMX_MOVD64mr:
110 case X86::MMX_MOVQ64mr:
111 case X86::MMX_MOVNTQmr:
112 if (MI->getOperand(0).isFrameIndex() && MI->getOperand(1).isImmediate() &&
113 MI->getOperand(2).isRegister() && MI->getOperand(3).isImmediate() &&
114 MI->getOperand(1).getImmedValue() == 1 &&
115 MI->getOperand(2).getReg() == 0 &&
116 MI->getOperand(3).getImmedValue() == 0) {
117 FrameIndex = MI->getOperand(0).getFrameIndex();
118 return MI->getOperand(4).getReg();
126 bool X86InstrInfo::isReallyTriviallyReMaterializable(MachineInstr *MI) const {
127 switch (MI->getOpcode()) {
140 case X86::MMX_MOVD64rm:
141 case X86::MMX_MOVQ64rm:
142 // Loads from constant pools are trivially rematerializable.
143 return MI->getOperand(1).isRegister() && MI->getOperand(2).isImmediate() &&
144 MI->getOperand(3).isRegister() && MI->getOperand(4).isConstantPoolIndex() &&
145 MI->getOperand(1).getReg() == 0 &&
146 MI->getOperand(2).getImmedValue() == 1 &&
147 MI->getOperand(3).getReg() == 0;
149 // All other instructions marked M_REMATERIALIZABLE are always trivially
154 /// hasLiveCondCodeDef - True if MI has a condition code def, e.g. EFLAGS, that
155 /// is not marked dead.
156 static bool hasLiveCondCodeDef(MachineInstr *MI) {
157 if (!EnableConvert3Addr)
159 for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
160 MachineOperand &MO = MI->getOperand(i);
161 if (MO.isRegister() && MO.isDef() &&
162 MO.getReg() == X86::EFLAGS && !MO.isDead()) {
169 /// convertToThreeAddress - This method must be implemented by targets that
170 /// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target
171 /// may be able to convert a two-address instruction into a true
172 /// three-address instruction on demand. This allows the X86 target (for
173 /// example) to convert ADD and SHL instructions into LEA instructions if they
174 /// would require register copies due to two-addressness.
176 /// This method returns a null pointer if the transformation cannot be
177 /// performed, otherwise it returns the new instruction.
180 X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI,
181 MachineBasicBlock::iterator &MBBI,
182 LiveVariables &LV) const {
183 MachineInstr *MI = MBBI;
184 // All instructions input are two-addr instructions. Get the known operands.
185 unsigned Dest = MI->getOperand(0).getReg();
186 unsigned Src = MI->getOperand(1).getReg();
188 MachineInstr *NewMI = NULL;
189 // FIXME: 16-bit LEA's are really slow on Athlons, but not bad on P4's. When
190 // we have better subtarget support, enable the 16-bit LEA generation here.
191 bool DisableLEA16 = true;
193 switch (MI->getOpcode()) {
194 default: break; // All others need to check for live condition code defs.
195 case X86::SHUFPSrri: {
196 assert(MI->getNumOperands() == 4 && "Unknown shufps instruction!");
197 if (!TM.getSubtarget<X86Subtarget>().hasSSE2()) return 0;
199 unsigned A = MI->getOperand(0).getReg();
200 unsigned B = MI->getOperand(1).getReg();
201 unsigned C = MI->getOperand(2).getReg();
202 unsigned M = MI->getOperand(3).getImm();
203 if (B != C) return 0;
204 NewMI = BuildMI(get(X86::PSHUFDri), A).addReg(B).addImm(M);
208 assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!");
209 // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses
210 // the flags produced by a shift yet, so this is safe.
211 unsigned Dest = MI->getOperand(0).getReg();
212 unsigned Src = MI->getOperand(1).getReg();
213 unsigned ShAmt = MI->getOperand(2).getImm();
214 if (ShAmt == 0 || ShAmt >= 4) return 0;
216 NewMI = BuildMI(get(X86::LEA64r), Dest)
217 .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0);
221 assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!");
222 // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses
223 // the flags produced by a shift yet, so this is safe.
224 unsigned Dest = MI->getOperand(0).getReg();
225 unsigned Src = MI->getOperand(1).getReg();
226 unsigned ShAmt = MI->getOperand(2).getImm();
227 if (ShAmt == 0 || ShAmt >= 4) return 0;
229 unsigned Opc = TM.getSubtarget<X86Subtarget>().is64Bit() ?
230 X86::LEA64_32r : X86::LEA32r;
231 NewMI = BuildMI(get(Opc), Dest)
232 .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0);
236 assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!");
237 // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses
238 // the flags produced by a shift yet, so this is safe.
239 unsigned Dest = MI->getOperand(0).getReg();
240 unsigned Src = MI->getOperand(1).getReg();
241 unsigned ShAmt = MI->getOperand(2).getImm();
242 if (ShAmt == 0 || ShAmt >= 4) return 0;
245 // If 16-bit LEA is disabled, use 32-bit LEA via subregisters.
246 SSARegMap *RegMap = MFI->getParent()->getSSARegMap();
247 unsigned Opc = TM.getSubtarget<X86Subtarget>().is64Bit()
248 ? X86::LEA64_32r : X86::LEA32r;
249 unsigned leaInReg = RegMap->createVirtualRegister(&X86::GR32RegClass);
250 unsigned leaOutReg = RegMap->createVirtualRegister(&X86::GR32RegClass);
253 BuildMI(get(X86::INSERT_SUBREG), leaInReg).addReg(Src).addImm(2);
254 Ins->copyKillDeadInfo(MI);
256 NewMI = BuildMI(get(Opc), leaOutReg)
257 .addReg(0).addImm(1 << ShAmt).addReg(leaInReg).addImm(0);
260 BuildMI(get(X86::EXTRACT_SUBREG), Dest).addReg(leaOutReg).addImm(2);
261 Ext->copyKillDeadInfo(MI);
263 MFI->insert(MBBI, Ins); // Insert the insert_subreg
264 LV.instructionChanged(MI, NewMI); // Update live variables
265 LV.addVirtualRegisterKilled(leaInReg, NewMI);
266 MFI->insert(MBBI, NewMI); // Insert the new inst
267 LV.addVirtualRegisterKilled(leaOutReg, Ext);
268 MFI->insert(MBBI, Ext); // Insert the extract_subreg
271 NewMI = BuildMI(get(X86::LEA16r), Dest)
272 .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0);
278 if (!hasLiveCondCodeDef(MI))
279 switch (MI->getOpcode()) {
282 case X86::INC64_32r: {
283 assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
284 unsigned Opc = MI->getOpcode() == X86::INC64r ? X86::LEA64r : X86::LEA32r;
285 NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, 1);
290 if (DisableLEA16) return 0;
291 assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!");
292 NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, 1);
296 case X86::DEC64_32r: {
297 assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
298 unsigned Opc = MI->getOpcode() == X86::DEC64r ? X86::LEA64r : X86::LEA32r;
299 NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, -1);
304 if (DisableLEA16) return 0;
305 assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!");
306 NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, -1);
310 assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
311 unsigned Opc = MI->getOpcode() == X86::ADD64rr ? X86::LEA64r : X86::LEA32r;
312 NewMI = addRegReg(BuildMI(get(Opc), Dest), Src, MI->getOperand(2).getReg());
316 if (DisableLEA16) return 0;
317 assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
318 NewMI = addRegReg(BuildMI(get(X86::LEA16r), Dest), Src,
319 MI->getOperand(2).getReg());
323 assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
324 if (MI->getOperand(2).isImmediate())
325 NewMI = addRegOffset(BuildMI(get(X86::LEA64r), Dest), Src,
326 MI->getOperand(2).getImmedValue());
330 assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
331 if (MI->getOperand(2).isImmediate())
332 NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src,
333 MI->getOperand(2).getImmedValue());
337 if (DisableLEA16) return 0;
338 assert(MI->getNumOperands() >= 3 && "Unknown add instruction!");
339 if (MI->getOperand(2).isImmediate())
340 NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src,
341 MI->getOperand(2).getImmedValue());
344 if (DisableLEA16) return 0;
347 assert(MI->getNumOperands() >= 3 && MI->getOperand(2).isImmediate() &&
348 "Unknown shl instruction!");
349 unsigned ShAmt = MI->getOperand(2).getImmedValue();
350 if (ShAmt == 1 || ShAmt == 2 || ShAmt == 3) {
352 AM.Scale = 1 << ShAmt;
354 unsigned Opc = MI->getOpcode() == X86::SHL64ri ? X86::LEA64r
355 : (MI->getOpcode() == X86::SHL32ri ? X86::LEA32r : X86::LEA16r);
356 NewMI = addFullAddress(BuildMI(get(Opc), Dest), AM);
362 NewMI->copyKillDeadInfo(MI);
363 LV.instructionChanged(MI, NewMI); // Update live variables
364 MFI->insert(MBBI, NewMI); // Insert the new inst
369 /// commuteInstruction - We have a few instructions that must be hacked on to
372 MachineInstr *X86InstrInfo::commuteInstruction(MachineInstr *MI) const {
373 // FIXME: Can commute cmoves by changing the condition!
374 switch (MI->getOpcode()) {
375 case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I -> A = SHLD16rri8 C, B, (16-I)
376 case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I -> A = SHRD16rri8 C, B, (16-I)
377 case X86::SHRD32rri8: // A = SHRD32rri8 B, C, I -> A = SHLD32rri8 C, B, (32-I)
378 case X86::SHLD32rri8: // A = SHLD32rri8 B, C, I -> A = SHRD32rri8 C, B, (32-I)
379 case X86::SHRD64rri8: // A = SHRD64rri8 B, C, I -> A = SHLD64rri8 C, B, (64-I)
380 case X86::SHLD64rri8:{// A = SHLD64rri8 B, C, I -> A = SHRD64rri8 C, B, (64-I)
383 switch (MI->getOpcode()) {
384 default: assert(0 && "Unreachable!");
385 case X86::SHRD16rri8: Size = 16; Opc = X86::SHLD16rri8; break;
386 case X86::SHLD16rri8: Size = 16; Opc = X86::SHRD16rri8; break;
387 case X86::SHRD32rri8: Size = 32; Opc = X86::SHLD32rri8; break;
388 case X86::SHLD32rri8: Size = 32; Opc = X86::SHRD32rri8; break;
389 case X86::SHRD64rri8: Size = 64; Opc = X86::SHLD64rri8; break;
390 case X86::SHLD64rri8: Size = 64; Opc = X86::SHRD64rri8; break;
392 unsigned Amt = MI->getOperand(3).getImmedValue();
393 unsigned A = MI->getOperand(0).getReg();
394 unsigned B = MI->getOperand(1).getReg();
395 unsigned C = MI->getOperand(2).getReg();
396 bool BisKill = MI->getOperand(1).isKill();
397 bool CisKill = MI->getOperand(2).isKill();
398 return BuildMI(get(Opc), A).addReg(C, false, false, CisKill)
399 .addReg(B, false, false, BisKill).addImm(Size-Amt);
402 return TargetInstrInfo::commuteInstruction(MI);
406 static X86::CondCode GetCondFromBranchOpc(unsigned BrOpc) {
408 default: return X86::COND_INVALID;
409 case X86::JE: return X86::COND_E;
410 case X86::JNE: return X86::COND_NE;
411 case X86::JL: return X86::COND_L;
412 case X86::JLE: return X86::COND_LE;
413 case X86::JG: return X86::COND_G;
414 case X86::JGE: return X86::COND_GE;
415 case X86::JB: return X86::COND_B;
416 case X86::JBE: return X86::COND_BE;
417 case X86::JA: return X86::COND_A;
418 case X86::JAE: return X86::COND_AE;
419 case X86::JS: return X86::COND_S;
420 case X86::JNS: return X86::COND_NS;
421 case X86::JP: return X86::COND_P;
422 case X86::JNP: return X86::COND_NP;
423 case X86::JO: return X86::COND_O;
424 case X86::JNO: return X86::COND_NO;
428 unsigned X86::GetCondBranchFromCond(X86::CondCode CC) {
430 default: assert(0 && "Illegal condition code!");
431 case X86::COND_E: return X86::JE;
432 case X86::COND_NE: return X86::JNE;
433 case X86::COND_L: return X86::JL;
434 case X86::COND_LE: return X86::JLE;
435 case X86::COND_G: return X86::JG;
436 case X86::COND_GE: return X86::JGE;
437 case X86::COND_B: return X86::JB;
438 case X86::COND_BE: return X86::JBE;
439 case X86::COND_A: return X86::JA;
440 case X86::COND_AE: return X86::JAE;
441 case X86::COND_S: return X86::JS;
442 case X86::COND_NS: return X86::JNS;
443 case X86::COND_P: return X86::JP;
444 case X86::COND_NP: return X86::JNP;
445 case X86::COND_O: return X86::JO;
446 case X86::COND_NO: return X86::JNO;
450 /// GetOppositeBranchCondition - Return the inverse of the specified condition,
451 /// e.g. turning COND_E to COND_NE.
452 X86::CondCode X86::GetOppositeBranchCondition(X86::CondCode CC) {
454 default: assert(0 && "Illegal condition code!");
455 case X86::COND_E: return X86::COND_NE;
456 case X86::COND_NE: return X86::COND_E;
457 case X86::COND_L: return X86::COND_GE;
458 case X86::COND_LE: return X86::COND_G;
459 case X86::COND_G: return X86::COND_LE;
460 case X86::COND_GE: return X86::COND_L;
461 case X86::COND_B: return X86::COND_AE;
462 case X86::COND_BE: return X86::COND_A;
463 case X86::COND_A: return X86::COND_BE;
464 case X86::COND_AE: return X86::COND_B;
465 case X86::COND_S: return X86::COND_NS;
466 case X86::COND_NS: return X86::COND_S;
467 case X86::COND_P: return X86::COND_NP;
468 case X86::COND_NP: return X86::COND_P;
469 case X86::COND_O: return X86::COND_NO;
470 case X86::COND_NO: return X86::COND_O;
474 bool X86InstrInfo::isUnpredicatedTerminator(const MachineInstr *MI) const {
475 const TargetInstrDescriptor *TID = MI->getInstrDescriptor();
476 if (TID->Flags & M_TERMINATOR_FLAG) {
477 // Conditional branch is a special case.
478 if ((TID->Flags & M_BRANCH_FLAG) != 0 && (TID->Flags & M_BARRIER_FLAG) == 0)
480 if ((TID->Flags & M_PREDICABLE) == 0)
482 return !isPredicated(MI);
487 // For purposes of branch analysis do not count FP_REG_KILL as a terminator.
488 static bool isBrAnalysisUnpredicatedTerminator(const MachineInstr *MI,
489 const X86InstrInfo &TII) {
490 if (MI->getOpcode() == X86::FP_REG_KILL)
492 return TII.isUnpredicatedTerminator(MI);
495 bool X86InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
496 MachineBasicBlock *&TBB,
497 MachineBasicBlock *&FBB,
498 std::vector<MachineOperand> &Cond) const {
499 // If the block has no terminators, it just falls into the block after it.
500 MachineBasicBlock::iterator I = MBB.end();
501 if (I == MBB.begin() || !isBrAnalysisUnpredicatedTerminator(--I, *this))
504 // Get the last instruction in the block.
505 MachineInstr *LastInst = I;
507 // If there is only one terminator instruction, process it.
508 if (I == MBB.begin() || !isBrAnalysisUnpredicatedTerminator(--I, *this)) {
509 if (!isBranch(LastInst->getOpcode()))
512 // If the block ends with a branch there are 3 possibilities:
513 // it's an unconditional, conditional, or indirect branch.
515 if (LastInst->getOpcode() == X86::JMP) {
516 TBB = LastInst->getOperand(0).getMachineBasicBlock();
519 X86::CondCode BranchCode = GetCondFromBranchOpc(LastInst->getOpcode());
520 if (BranchCode == X86::COND_INVALID)
521 return true; // Can't handle indirect branch.
523 // Otherwise, block ends with fall-through condbranch.
524 TBB = LastInst->getOperand(0).getMachineBasicBlock();
525 Cond.push_back(MachineOperand::CreateImm(BranchCode));
529 // Get the instruction before it if it's a terminator.
530 MachineInstr *SecondLastInst = I;
532 // If there are three terminators, we don't know what sort of block this is.
533 if (SecondLastInst && I != MBB.begin() &&
534 isBrAnalysisUnpredicatedTerminator(--I, *this))
537 // If the block ends with X86::JMP and a conditional branch, handle it.
538 X86::CondCode BranchCode = GetCondFromBranchOpc(SecondLastInst->getOpcode());
539 if (BranchCode != X86::COND_INVALID && LastInst->getOpcode() == X86::JMP) {
540 TBB = SecondLastInst->getOperand(0).getMachineBasicBlock();
541 Cond.push_back(MachineOperand::CreateImm(BranchCode));
542 FBB = LastInst->getOperand(0).getMachineBasicBlock();
546 // If the block ends with two X86::JMPs, handle it. The second one is not
547 // executed, so remove it.
548 if (SecondLastInst->getOpcode() == X86::JMP &&
549 LastInst->getOpcode() == X86::JMP) {
550 TBB = SecondLastInst->getOperand(0).getMachineBasicBlock();
552 I->eraseFromParent();
556 // Otherwise, can't handle this.
560 unsigned X86InstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
561 MachineBasicBlock::iterator I = MBB.end();
562 if (I == MBB.begin()) return 0;
564 if (I->getOpcode() != X86::JMP &&
565 GetCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID)
568 // Remove the branch.
569 I->eraseFromParent();
573 if (I == MBB.begin()) return 1;
575 if (GetCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID)
578 // Remove the branch.
579 I->eraseFromParent();
584 X86InstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
585 MachineBasicBlock *FBB,
586 const std::vector<MachineOperand> &Cond) const {
587 // Shouldn't be a fall through.
588 assert(TBB && "InsertBranch must not be told to insert a fallthrough");
589 assert((Cond.size() == 1 || Cond.size() == 0) &&
590 "X86 branch conditions have one component!");
592 if (FBB == 0) { // One way branch.
594 // Unconditional branch?
595 BuildMI(&MBB, get(X86::JMP)).addMBB(TBB);
597 // Conditional branch.
598 unsigned Opc = GetCondBranchFromCond((X86::CondCode)Cond[0].getImm());
599 BuildMI(&MBB, get(Opc)).addMBB(TBB);
604 // Two-way Conditional branch.
605 unsigned Opc = GetCondBranchFromCond((X86::CondCode)Cond[0].getImm());
606 BuildMI(&MBB, get(Opc)).addMBB(TBB);
607 BuildMI(&MBB, get(X86::JMP)).addMBB(FBB);
611 bool X86InstrInfo::BlockHasNoFallThrough(MachineBasicBlock &MBB) const {
612 if (MBB.empty()) return false;
614 switch (MBB.back().getOpcode()) {
615 case X86::RET: // Return.
620 case X86::JMP: // Uncond branch.
621 case X86::JMP32r: // Indirect branch.
622 case X86::JMP64r: // Indirect branch (64-bit).
623 case X86::JMP32m: // Indirect branch through mem.
624 case X86::JMP64m: // Indirect branch through mem (64-bit).
626 default: return false;
631 ReverseBranchCondition(std::vector<MachineOperand> &Cond) const {
632 assert(Cond.size() == 1 && "Invalid X86 branch condition!");
633 Cond[0].setImm(GetOppositeBranchCondition((X86::CondCode)Cond[0].getImm()));
637 const TargetRegisterClass *X86InstrInfo::getPointerRegClass() const {
638 const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
639 if (Subtarget->is64Bit())
640 return &X86::GR64RegClass;
642 return &X86::GR32RegClass;