[OperandBundles] Refactor; NFCI.

Extract out a helper function `operandBundleFromBundleOpInfo`.

llvm-svn: 252038
This commit is contained in:
Sanjoy Das 2015-11-04 04:31:21 +00:00
parent 3c95d5d28e
commit bf9d76d62e
1 changed files with 10 additions and 4 deletions

View 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;