From: Craig Topper Date: Thu, 28 Apr 2016 05:58:46 +0000 (+0000) Subject: [X86] Remove unused operand from a function and all its callers. NFC X-Git-Tag: llvmorg-3.9.0-rc1~7640 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=477649a4c014fe2f47d5224c023055772315b072;p=platform%2Fupstream%2Fllvm.git [X86] Remove unused operand from a function and all its callers. NFC llvm-svn: 267854 --- diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h index a532b0d..a1fa6b7 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h +++ b/llvm/lib/Target/X86/MCTargetDesc/X86BaseInfo.h @@ -667,7 +667,7 @@ namespace X86II { /// is duplicated in the MCInst (e.g. "EAX = addl EAX, [mem]") it is only /// counted as one operand. /// - inline int getMemoryOperandNo(uint64_t TSFlags, unsigned Opcode) { + inline int getMemoryOperandNo(uint64_t TSFlags) { bool HasVEX_4V = TSFlags & X86II::VEX_4V; bool HasMemOp4 = TSFlags & X86II::MemOp4; bool HasEVEX_K = TSFlags & X86II::EVEX_K; diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp index a450019..d06d1a6 100644 --- a/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp +++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp @@ -1120,7 +1120,7 @@ encodeInstruction(const MCInst &MI, raw_ostream &OS, unsigned I8RegNum = 0; // Determine where the memory operand starts, if present. - int MemoryOperand = X86II::getMemoryOperandNo(TSFlags, Opcode); + int MemoryOperand = X86II::getMemoryOperandNo(TSFlags); if (MemoryOperand != -1) MemoryOperand += CurOp; // Emit segment override opcode prefix as needed. diff --git a/llvm/lib/Target/X86/X86FixupLEAs.cpp b/llvm/lib/Target/X86/X86FixupLEAs.cpp index 5af91de..9cd2370 100644 --- a/llvm/lib/Target/X86/X86FixupLEAs.cpp +++ b/llvm/lib/Target/X86/X86FixupLEAs.cpp @@ -300,9 +300,8 @@ void FixupLEAPass::processInstruction(MachineBasicBlock::iterator &I, MachineFunction::iterator MFI) { // Process a load, store, or LEA instruction. MachineInstr *MI = I; - int opcode = MI->getOpcode(); const MCInstrDesc &Desc = MI->getDesc(); - int AddrOffset = X86II::getMemoryOperandNo(Desc.TSFlags, opcode); + int AddrOffset = X86II::getMemoryOperandNo(Desc.TSFlags); if (AddrOffset >= 0) { AddrOffset += X86II::getOperandBias(Desc); MachineOperand &p = MI->getOperand(AddrOffset + X86::AddrBaseReg); diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index cbd515a..186b9bb 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -4665,7 +4665,7 @@ bool X86InstrInfo::getMemOpBaseRegImmOfs(MachineInstr *MemOp, unsigned &BaseReg, int64_t &Offset, const TargetRegisterInfo *TRI) const { const MCInstrDesc &Desc = MemOp->getDesc(); - int MemRefBegin = X86II::getMemoryOperandNo(Desc.TSFlags, MemOp->getOpcode()); + int MemRefBegin = X86II::getMemoryOperandNo(Desc.TSFlags); if (MemRefBegin < 0) return false; diff --git a/llvm/lib/Target/X86/X86OptimizeLEAs.cpp b/llvm/lib/Target/X86/X86OptimizeLEAs.cpp index 2ec9941..89f50cb 100644 --- a/llvm/lib/Target/X86/X86OptimizeLEAs.cpp +++ b/llvm/lib/Target/X86/X86OptimizeLEAs.cpp @@ -308,7 +308,7 @@ bool OptimizeLEAPass::chooseBestLEA(const SmallVectorImpl &List, int64_t &AddrDispShift, int &Dist) { const MachineFunction *MF = MI.getParent()->getParent(); const MCInstrDesc &Desc = MI.getDesc(); - int MemOpNo = X86II::getMemoryOperandNo(Desc.TSFlags, MI.getOpcode()) + + int MemOpNo = X86II::getMemoryOperandNo(Desc.TSFlags) + X86II::getOperandBias(Desc); BestLEA = nullptr; @@ -410,7 +410,7 @@ bool OptimizeLEAPass::isReplaceable(const MachineInstr &First, // Get the number of the first memory operand. const MCInstrDesc &Desc = MI.getDesc(); - int MemOpNo = X86II::getMemoryOperandNo(Desc.TSFlags, MI.getOpcode()); + int MemOpNo = X86II::getMemoryOperandNo(Desc.TSFlags); // If the use instruction has no memory operand - the LEA is not // replaceable. @@ -468,7 +468,6 @@ bool OptimizeLEAPass::removeRedundantAddrCalc(MemOpMap &LEAs) { // Process all instructions in basic block. for (auto I = MBB->begin(), E = MBB->end(); I != E;) { MachineInstr &MI = *I++; - unsigned Opcode = MI.getOpcode(); // Instruction must be load or store. if (!MI.mayLoadOrStore()) @@ -476,7 +475,7 @@ bool OptimizeLEAPass::removeRedundantAddrCalc(MemOpMap &LEAs) { // Get the number of the first memory operand. const MCInstrDesc &Desc = MI.getDesc(); - int MemOpNo = X86II::getMemoryOperandNo(Desc.TSFlags, Opcode); + int MemOpNo = X86II::getMemoryOperandNo(Desc.TSFlags); // If instruction has no memory operand - skip it. if (MemOpNo < 0) @@ -574,7 +573,7 @@ bool OptimizeLEAPass::removeRedundantLEAs(MemOpMap &LEAs) { // Get the number of the first memory operand. const MCInstrDesc &Desc = MI.getDesc(); int MemOpNo = - X86II::getMemoryOperandNo(Desc.TSFlags, MI.getOpcode()) + + X86II::getMemoryOperandNo(Desc.TSFlags) + X86II::getOperandBias(Desc); // Update address base.