[PATCH] D23067: TargetInstrInfo: add two new target hooks to analyse branch offsets

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 11:51:28 PDT 2016


SjoerdMeijer added inline comments.

================
Comment at: include/llvm/Target/TargetInstrInfo.h:495-506
@@ -483,1 +494,14 @@
+
+  /// Return the upperbound value of the supported branch range, or -1 if
+  /// it is not implemented.
+  virtual int64_t getBranchRangeUpperbound(unsigned Opcode) const {
+    return -1;
+  }
+
+  /// Return the lowerbound value of the supported branch range, or 1 if
+  /// it is not implemented.
+  virtual int64_t getBranchRangeLowerbound(unsigned Opcode) const {
+    return 1;
+  }
+
   /// Represents a predicate at the MachineFunction level.  The control flow a
----------------
arsenm wrote:
> Why do you need these? I don't think these are the right API, and the isBranchOffsetInRange is better
I think I need both the isBranchOffsetInRange and the getBranchRange (or similar) functions. A check to see if a branch is in range is one thing, but for moving a block in range actual values are needed. Looking at BranchRelaxation and AArch64InstrInfo.cpp, I now see I probably want to have this in the base class: 

static unsigned getBranchDisplacementBits(unsigned Opc)

because that's what I am trying to do.


https://reviews.llvm.org/D23067





More information about the llvm-commits mailing list