[llvm] 2ee218f - [llvm-exegesis][NFC] Simplify code.

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 24 03:45:34 PST 2020


Author: Clement Courbet
Date: 2020-01-24T12:45:20+01:00
New Revision: 2ee218f3653fcfd135fc5087a698424f90a9a499

URL: https://github.com/llvm/llvm-project/commit/2ee218f3653fcfd135fc5087a698424f90a9a499
DIFF: https://github.com/llvm/llvm-project/commit/2ee218f3653fcfd135fc5087a698424f90a9a499.diff

LOG: [llvm-exegesis][NFC] Simplify code.

Summary:
What we're redoing already exists in the X86 backend, it's called
`X86II::getOperandBias`.

Reviewers: gchatelet

Subscribers: tschuett, mstojanovic, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D73340

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/X86/Target.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
index a76e590cfa2c..4daf42201a1d 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -673,12 +673,7 @@ void ExegesisX86Target::fillMemoryOperands(InstructionTemplate &IT,
   int MemOpIdx = X86II::getMemoryOperandNo(IT.getInstr().Description.TSFlags);
   assert(MemOpIdx >= 0 && "invalid memory operand index");
   // getMemoryOperandNo() ignores tied operands, so we have to add them back.
-  for (unsigned I = 0; I <= static_cast<unsigned>(MemOpIdx); ++I) {
-    const auto &Op = IT.getInstr().Operands[I];
-    if (Op.isTied() && Op.getTiedToIndex() < I) {
-      ++MemOpIdx;
-    }
-  }
+  MemOpIdx += X86II::getOperandBias(IT.getInstr().Description);
   setMemOp(IT, MemOpIdx + 0, MCOperand::createReg(Reg));    // BaseReg
   setMemOp(IT, MemOpIdx + 1, MCOperand::createImm(1));      // ScaleAmt
   setMemOp(IT, MemOpIdx + 2, MCOperand::createReg(0));      // IndexReg


        


More information about the llvm-commits mailing list