[OperandBundles] Refactor; NFCI.
authorSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 4 Nov 2015 04:31:21 +0000 (04:31 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Wed, 4 Nov 2015 04:31:21 +0000 (04:31 +0000)
Extract out a helper function `operandBundleFromBundleOpInfo`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252038 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/InstrTypes.h

index 55f50d43b5fe7ba1d69d6eb59cecc4a2b303a3c6..412eb83b0f9c7a2e5facdf337f6d53e62bec8027 100644 (file)
@@ -1224,10 +1224,7 @@ public:
   /// \brief Return the operand bundle at a specific index.
   OperandBundleUse getOperandBundle(unsigned Index) const {
     assert(Index < getNumOperandBundles() && "Index out of bounds!");
-    auto *BOI = bundle_op_info_begin() + Index;
-    auto op_begin = static_cast<const InstrTy *>(this)->op_begin();
-    ArrayRef<Use> Inputs(op_begin + BOI->Begin, op_begin + BOI->End);
-    return OperandBundleUse(BOI->Tag->getKey(), Inputs);
+    return operandBundleFromBundleOpInfo(*(bundle_op_info_begin() + Index));
   }
 
   /// \brief Return the number of operand bundles with the tag Name attached to
@@ -1320,6 +1317,15 @@ protected:
     uint32_t End;
   };
 
+  /// \brief Simple helper function to map a BundleOpInfo to an
+  /// OperandBundleUse.
+  OperandBundleUse
+  operandBundleFromBundleOpInfo(const BundleOpInfo &BOI) const {
+    auto op_begin = static_cast<const InstrTy *>(this)->op_begin();
+    ArrayRef<Use> Inputs(op_begin + BOI.Begin, op_begin + BOI.End);
+    return OperandBundleUse(BOI.Tag->getKey(), Inputs);
+  }
+
   typedef BundleOpInfo *bundle_op_iterator;
   typedef const BundleOpInfo *const_bundle_op_iterator;