[PATCH] D141983: [BOLT][NFC] Remove AArch64 override for evaluateBranch

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 13:23:15 PST 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG706606a7df60: [BOLT][NFC] Remove AArch64 override for evaluateBranch (authored by Amir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141983/new/

https://reviews.llvm.org/D141983

Files:
  bolt/include/bolt/Core/MCPlusBuilder.h
  bolt/lib/Core/MCPlusBuilder.cpp
  bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp


Index: bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
===================================================================
--- bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
+++ bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp
@@ -435,34 +435,6 @@
     return getTargetAddend(Op.getExpr());
   }
 
-  bool evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
-                      uint64_t &Target) const override {
-    size_t OpNum = 0;
-
-    if (isConditionalBranch(Inst)) {
-      assert(MCPlus::getNumPrimeOperands(Inst) >= 2 &&
-             "Invalid number of operands");
-      OpNum = 1;
-    }
-
-    if (isTB(Inst)) {
-      assert(MCPlus::getNumPrimeOperands(Inst) >= 3 &&
-             "Invalid number of operands");
-      OpNum = 2;
-    }
-
-    if (Info->get(Inst.getOpcode()).OpInfo[OpNum].OperandType !=
-        MCOI::OPERAND_PCREL) {
-      assert((isIndirectBranch(Inst) || isIndirectCall(Inst)) &&
-             "FAILED evaluateBranch");
-      return false;
-    }
-
-    int64_t Imm = Inst.getOperand(OpNum).getImm() << 2;
-    Target = Addr + Imm;
-    return true;
-  }
-
   bool replaceBranchTarget(MCInst &Inst, const MCSymbol *TBB,
                            MCContext *Ctx) const override {
     assert((isCall(Inst) || isBranch(Inst)) && !isIndirectBranch(Inst) &&
Index: bolt/lib/Core/MCPlusBuilder.cpp
===================================================================
--- bolt/lib/Core/MCPlusBuilder.cpp
+++ bolt/lib/Core/MCPlusBuilder.cpp
@@ -321,11 +321,6 @@
   }
 }
 
-bool MCPlusBuilder::evaluateBranch(const MCInst &Inst, uint64_t Addr,
-                                   uint64_t Size, uint64_t &Target) const {
-  return Analysis->evaluateBranch(Inst, Addr, Size, Target);
-}
-
 void MCPlusBuilder::getClobberedRegs(const MCInst &Inst,
                                      BitVector &Regs) const {
   if (isPrefix(Inst) || isCFI(Inst))
Index: bolt/include/bolt/Core/MCPlusBuilder.h
===================================================================
--- bolt/include/bolt/Core/MCPlusBuilder.h
+++ bolt/include/bolt/Core/MCPlusBuilder.h
@@ -822,7 +822,9 @@
   /// \brief Given a branch instruction try to get the address the branch
   /// targets. Return true on success, and the address in Target.
   virtual bool evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
-                              uint64_t &Target) const;
+                              uint64_t &Target) const {
+    return Analysis->evaluateBranch(Inst, Addr, Size, Target);
+  }
 
   /// Return true if one of the operands of the \p Inst instruction uses
   /// PC-relative addressing.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141983.490276.patch
Type: text/x-patch
Size: 2631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230118/2ee22afd/attachment.bin>


More information about the llvm-commits mailing list