From 15f9f37223f448c6e306b55552609f53dc07799d Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Wed, 4 Nov 2015 04:31:21 +0000 Subject: [PATCH] [OperandBundles] Refactor; NFCI. 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 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/llvm/IR/InstrTypes.h b/include/llvm/IR/InstrTypes.h index 55f50d43b5f..412eb83b0f9 100644 --- a/include/llvm/IR/InstrTypes.h +++ b/include/llvm/IR/InstrTypes.h @@ -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(this)->op_begin(); - ArrayRef 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(this)->op_begin(); + ArrayRef 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; -- 2.34.1