summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-11-04 04:31:06 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-11-04 04:31:06 +0000
commit3c95d5d28ec2b006da2df9e0669d41aba56b4451 (patch)
tree057e0611072634e5e5af0d92c8f4dde7a432e760 /llvm/include
parentd9b1a4fb710d45b2acba65d6248d91af22788c6e (diff)
downloadbcm5719-llvm-3c95d5d28ec2b006da2df9e0669d41aba56b4451.tar.gz
bcm5719-llvm-3c95d5d28ec2b006da2df9e0669d41aba56b4451.zip
[OperandBundles] Refactor; NFCI
Intended to make later changes simpler. Exposes `getBundleOperandsStartIndex` and `getBundleOperandsEndIndex`, and uses them for the computation in `getNumTotalBundleOperands`. llvm-svn: 252037
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/IR/InstrTypes.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 19106114880..55f50d43b5f 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -1196,18 +1196,29 @@ public:
/// \brief Return true if this User has any operand bundles.
bool hasOperandBundles() const { return getNumOperandBundles() != 0; }
+ /// \brief Return the index of the first bundle operand in the Use array.
+ unsigned getBundleOperandsStartIndex() const {
+ assert(hasOperandBundles() && "Don't call otherwise!");
+ return bundle_op_info_begin()->Begin;
+ }
+
+ /// \brief Return the index of the last bundle operand in the Use array.
+ unsigned getBundleOperandsEndIndex() const {
+ assert(hasOperandBundles() && "Don't call otherwise!");
+ return bundle_op_info_end()[-1].End;
+ }
+
/// \brief Return the total number operands (not operand bundles) used by
/// every operand bundle in this OperandBundleUser.
unsigned getNumTotalBundleOperands() const {
if (!hasOperandBundles())
return 0;
- auto *Begin = bundle_op_info_begin();
- auto *Back = bundle_op_info_end() - 1;
-
- assert(Begin <= Back && "hasOperandBundles() returned true!");
+ unsigned Begin = getBundleOperandsStartIndex();
+ unsigned End = getBundleOperandsEndIndex();
- return Back->End - Begin->Begin;
+ assert(Begin <= End && "Should be!");
+ return End - Begin;
}
/// \brief Return the operand bundle at a specific index.
OpenPOWER on IntegriCloud