#undef CALLSITE_DELEGATE_GETTER
#undef CALLSITE_DELEGATE_SETTER
+ void getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const {
+ const Instruction *II = getInstruction();
+ // Since this is actually a getter that "looks like" a setter, don't use the
+ // above macros to avoid confusion.
+ if (isCall())
+ cast<CallInst>(II)->getOperandBundlesAsDefs(Defs);
+ else
+ cast<InvokeInst>(II)->getOperandBundlesAsDefs(Defs);
+ }
+
/// @brief Determine whether this data operand is not captured.
bool doesNotCapture(unsigned OpNo) const {
return dataOperandHasImpliedAttr(OpNo + 1, Attribute::NoCapture);
return None;
}
+ /// \brief Return the list of operand bundles attached to this instruction as
+ /// a vector of OperandBundleDefs.
+ ///
+ /// This function copies the OperandBundeUse instances associated with this
+ /// OperandBundleUser to a vector of OperandBundleDefs. Note:
+ /// OperandBundeUses and OperandBundleDefs are non-trivially *different*
+ /// representations of operand bundles (see documentation above).
+ void getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const {
+ for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i)
+ Defs.emplace_back(getOperandBundleAt(i));
+ }
+
/// \brief Return the operand bundle for the operand at index OpIdx.
///
/// It is an error to call this with an OpIdx that does not correspond to an
attrVec);
SmallVector<OperandBundleDef, 1> OpBundles;
-
- // Convert the operand bundle uses to operand bundle defs. See InstrTypes.h
- // for details on how these differ.
- for (unsigned i = 0, e = CS.getNumOperandBundles(); i != e; ++i)
- OpBundles.emplace_back(CS.getOperandBundleAt(i));
+ CS.getOperandBundlesAsDefs(OpBundles);
Instruction *NC;
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
SmallVector<Value*, 8> InvokeArgs(CS.arg_begin(), CS.arg_end());
SmallVector<OperandBundleDef, 1> OpBundles;
- // Copy the OperandBundeUse instances to OperandBundleDefs. These two are
- // *different* representations of operand bundles: see the documentation in
- // InstrTypes.h for more details.
- for (unsigned i = 0, e = CS.getNumOperandBundles(); i != e; ++i)
- OpBundles.emplace_back(CS.getOperandBundleAt(i));
+ CS.getOperandBundlesAsDefs(OpBundles);
// Note: we're round tripping operand bundles through memory here, and that
// can potentially be avoided with a cleverer API design that we do not have