@@ -3464,11 +3464,9 @@ bool X86::isX87Instruction(MachineInstr &MI) {
3464
3464
}
3465
3465
3466
3466
int X86::getFirstAddrOperandIdx (const MachineInstr &MI) {
3467
- #ifdef EXPENSIVE_CHECKS
3468
- const auto isMemOp = [](const MCOperandInfo &OpInfo) -> bool {
3467
+ auto IsMemOp = [](const MCOperandInfo &OpInfo) {
3469
3468
return OpInfo.OperandType == MCOI::OPERAND_MEMORY;
3470
3469
};
3471
- #endif
3472
3470
3473
3471
const MCInstrDesc &Desc = MI.getDesc ();
3474
3472
@@ -3479,7 +3477,7 @@ int X86::getFirstAddrOperandIdx(const MachineInstr &MI) {
3479
3477
if (MemRefIdx >= 0 )
3480
3478
return MemRefIdx + X86II::getOperandBias (Desc);
3481
3479
#ifdef EXPENSIVE_CHECKS
3482
- assert (none_of (Desc.operands (), isMemOp ) &&
3480
+ assert (none_of (Desc.operands (), IsMemOp ) &&
3483
3481
" Got false negative from X86II::getMemoryOperandNo()!" );
3484
3482
#endif
3485
3483
return -1 ;
@@ -3488,9 +3486,10 @@ int X86::getFirstAddrOperandIdx(const MachineInstr &MI) {
3488
3486
// Otherwise, handle pseudo instructions by examining the type of their
3489
3487
// operands (slow case). An instruction cannot have a memory reference if it
3490
3488
// has fewer than AddrNumOperands (= 5) explicit operands.
3491
- if (Desc.getNumOperands () < X86::AddrNumOperands) {
3489
+ unsigned NumOps = Desc.getNumOperands ();
3490
+ if (NumOps < X86::AddrNumOperands) {
3492
3491
#ifdef EXPENSIVE_CHECKS
3493
- assert (none_of (Desc.operands (), isMemOp ) &&
3492
+ assert (none_of (Desc.operands (), IsMemOp ) &&
3494
3493
" Expected no operands to have OPERAND_MEMORY type!" );
3495
3494
#endif
3496
3495
return -1 ;
@@ -3499,16 +3498,16 @@ int X86::getFirstAddrOperandIdx(const MachineInstr &MI) {
3499
3498
// The first operand with type OPERAND_MEMORY indicates the start of a memory
3500
3499
// reference. We expect the following AddrNumOperand-1 operands to also have
3501
3500
// OPERAND_MEMORY type.
3502
- for (unsigned i = 0 ; i <= Desc. getNumOperands () - X86::AddrNumOperands; ++i ) {
3503
- if (Desc.operands ()[i]. OperandType == MCOI::OPERAND_MEMORY ) {
3501
+ for (unsigned I = 0 , E = NumOps - X86::AddrNumOperands; I != E; ++I ) {
3502
+ if (IsMemOp ( Desc.operands ()[I]) ) {
3504
3503
#ifdef EXPENSIVE_CHECKS
3505
- assert (std::all_of (Desc.operands ().begin () + i ,
3506
- Desc.operands ().begin () + i + X86::AddrNumOperands,
3507
- isMemOp ) &&
3504
+ assert (std::all_of (Desc.operands ().begin () + I ,
3505
+ Desc.operands ().begin () + I + X86::AddrNumOperands,
3506
+ IsMemOp ) &&
3508
3507
" Expected all five operands in the memory reference to have "
3509
3508
" OPERAND_MEMORY type!" );
3510
3509
#endif
3511
- return i ;
3510
+ return I ;
3512
3511
}
3513
3512
}
3514
3513
0 commit comments