[llvm] r252038 - [OperandBundles] Refactor; NFCI.

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 20:31:21 PST 2015


Author: sanjoy
Date: Tue Nov  3 22:31:21 2015
New Revision: 252038

URL: http://llvm.org/viewvc/llvm-project?rev=252038&view=rev
Log:
[OperandBundles] Refactor; NFCI.

Extract out a helper function `operandBundleFromBundleOpInfo`.

Modified:
    llvm/trunk/include/llvm/IR/InstrTypes.h

Modified: llvm/trunk/include/llvm/IR/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/InstrTypes.h?rev=252038&r1=252037&r2=252038&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/IR/InstrTypes.h Tue Nov  3 22:31:21 2015
@@ -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;
 




More information about the llvm-commits mailing list