LLVM  6.0.0svn
Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | List of all members
llvm::OperandBundleUser< InstrTy, OpIteratorTy > Class Template Reference

A mixin to add operand bundle functionality to llvm instruction classes. More...

#include "llvm/IR/InstrTypes.h"

Inheritance diagram for llvm::OperandBundleUser< InstrTy, OpIteratorTy >:
Inheritance graph
[legend]

Classes

struct  BundleOpInfo
 Used to keep track of an operand bundle. More...
 

Public Member Functions

unsigned getNumOperandBundles () const
 Return the number of operand bundles associated with this User. More...
 
bool hasOperandBundles () const
 Return true if this User has any operand bundles. More...
 
unsigned getBundleOperandsStartIndex () const
 Return the index of the first bundle operand in the Use array. More...
 
unsigned getBundleOperandsEndIndex () const
 Return the index of the last bundle operand in the Use array. More...
 
bool isBundleOperand (unsigned Idx) const
 Return true if the operand at index Idx is a bundle operand. More...
 
unsigned getNumTotalBundleOperands () const
 Return the total number operands (not operand bundles) used by every operand bundle in this OperandBundleUser. More...
 
OperandBundleUse getOperandBundleAt (unsigned Index) const
 Return the operand bundle at a specific index. More...
 
unsigned countOperandBundlesOfType (StringRef Name) const
 Return the number of operand bundles with the tag Name attached to this instruction. More...
 
unsigned countOperandBundlesOfType (uint32_t ID) const
 Return the number of operand bundles with the tag ID attached to this instruction. More...
 
Optional< OperandBundleUsegetOperandBundle (StringRef Name) const
 Return an operand bundle by name, if present. More...
 
Optional< OperandBundleUsegetOperandBundle (uint32_t ID) const
 Return an operand bundle by tag ID, if present. More...
 
void getOperandBundlesAsDefs (SmallVectorImpl< OperandBundleDef > &Defs) const
 Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs. More...
 
OperandBundleUse getOperandBundleForOperand (unsigned OpIdx) const
 Return the operand bundle for the operand at index OpIdx. More...
 
bool hasReadingOperandBundles () const
 Return true if this operand bundle user has operand bundles that may read from the heap. More...
 
bool hasClobberingOperandBundles () const
 Return true if this operand bundle user has operand bundles that may write to the heap. More...
 
bool bundleOperandHasAttr (unsigned OpIdx, Attribute::AttrKind A) const
 Return true if the bundle operand at index OpIdx has the attribute A. More...
 
bool hasIdenticalOperandBundleSchema (const OperandBundleUser< InstrTy, OpIteratorTy > &Other) const
 Return true if Other has the same sequence of operand bundle tags with the same number of operands on each one of them as this OperandBundleUser. More...
 
bool hasOperandBundlesOtherThan (ArrayRef< uint32_t > IDs) const
 Return true if this operand bundle user contains operand bundles with tags other than those specified in IDs. More...
 

Protected Types

using bundle_op_iterator = BundleOpInfo *
 
using const_bundle_op_iterator = const BundleOpInfo *
 

Protected Member Functions

bool isFnAttrDisallowedByOpBundle (StringRef S) const
 Is the function attribute S disallowed by some operand bundle on this operand bundle user? More...
 
bool isFnAttrDisallowedByOpBundle (Attribute::AttrKind A) const
 Is the function attribute A disallowed by some operand bundle on this operand bundle user? More...
 
OperandBundleUse operandBundleFromBundleOpInfo (const BundleOpInfo &BOI) const
 Simple helper function to map a BundleOpInfo to an OperandBundleUse. More...
 
bundle_op_iterator bundle_op_info_begin ()
 Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser. More...
 
const_bundle_op_iterator bundle_op_info_begin () const
 Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser. More...
 
bundle_op_iterator bundle_op_info_end ()
 Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser. More...
 
const_bundle_op_iterator bundle_op_info_end () const
 Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser. More...
 
iterator_range< bundle_op_iteratorbundle_op_infos ()
 Return the range [bundle_op_info_begin, bundle_op_info_end). More...
 
iterator_range< const_bundle_op_iteratorbundle_op_infos () const
 Return the range [bundle_op_info_begin, bundle_op_info_end). More...
 
OpIteratorTy populateBundleOperandInfos (ArrayRef< OperandBundleDef > Bundles, const unsigned BeginIndex)
 Populate the BundleOpInfo instances and the Use& vector from Bundles. More...
 
const BundleOpInfogetBundleOpInfoForOperand (unsigned OpIdx) const
 Return the BundleOpInfo for the operand at index OpIdx. More...
 

Static Protected Member Functions

static unsigned CountBundleInputs (ArrayRef< OperandBundleDef > Bundles)
 Return the total number of values used in Bundles. More...
 

Detailed Description

template<typename InstrTy, typename OpIteratorTy>
class llvm::OperandBundleUser< InstrTy, OpIteratorTy >

A mixin to add operand bundle functionality to llvm instruction classes.

OperandBundleUser uses the descriptor area co-allocated with the host User to store some meta information about which operands are "normal" operands, and which ones belong to some operand bundle.

The layout of an operand bundle user is

     +-----------uint32_t End-------------------------------------+
     |                                                            |
     |  +--------uint32_t Begin--------------------+              |
     |  |                                          |              |
     ^  ^                                          v              v

|---—|---—|-—|-—|-—|-—|-—|------—|-—|------—|-—|--— | BOI0 | BOI1 | .. | DU | U0 | U1 | .. | BOI0_U0 | .. | BOI1_U0 | .. | Un |---—|---—|-—|-—|-—|-—|-—|------—|-—|------—|-—|--— v v ^ ^ | | | | | +-----—uint32_t Begin---------—+ | | | +--------—uint32_t End--------------------------—+

BOI0, BOI1 ... are descriptions of operand bundles in this User's use list. These descriptions are installed and managed by this class, and they're all instances of OperandBundleUser<T>::BundleOpInfo.

DU is an additional descriptor installed by User's 'operator new' to keep track of the 'BOI0 ... BOIN' co-allocation. OperandBundleUser does not access or modify DU in any way, it's an implementation detail private to User.

The regular Use& vector for the User starts at U0. The operand bundle uses are part of the Use& vector, just like normal uses. In the diagram above, the operand bundle uses start at BOI0_U0. Each instance of BundleOpInfo has information about a contiguous set of uses constituting an operand bundle, and the total set of operand bundle uses themselves form a contiguous set of uses (i.e. there are no gaps between uses corresponding to individual operand bundles).

This class does not know the location of the set of operand bundle uses within the use list – that is decided by the User using this class via the BeginIdx argument in populateBundleOperandInfos.

Currently operand bundle users with hung-off operands are not supported.

Definition at line 1290 of file InstrTypes.h.

Member Typedef Documentation

◆ bundle_op_iterator

template<typename InstrTy, typename OpIteratorTy>
using llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundle_op_iterator = BundleOpInfo *
protected

Definition at line 1525 of file InstrTypes.h.

◆ const_bundle_op_iterator

template<typename InstrTy, typename OpIteratorTy>
using llvm::OperandBundleUser< InstrTy, OpIteratorTy >::const_bundle_op_iterator = const BundleOpInfo *
protected

Definition at line 1526 of file InstrTypes.h.

Member Function Documentation

◆ bundle_op_info_begin() [1/2]

template<typename InstrTy, typename OpIteratorTy>
bundle_op_iterator llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundle_op_info_begin ( )
inlineprotected

◆ bundle_op_info_begin() [2/2]

template<typename InstrTy, typename OpIteratorTy>
const_bundle_op_iterator llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundle_op_info_begin ( ) const
inlineprotected

Return the start of the list of BundleOpInfo instances associated with this OperandBundleUser.

Definition at line 1540 of file InstrTypes.h.

◆ bundle_op_info_end() [1/2]

template<typename InstrTy, typename OpIteratorTy>
bundle_op_iterator llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundle_op_info_end ( )
inlineprotected

◆ bundle_op_info_end() [2/2]

template<typename InstrTy, typename OpIteratorTy>
const_bundle_op_iterator llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundle_op_info_end ( ) const
inlineprotected

Return the end of the list of BundleOpInfo instances associated with this OperandBundleUser.

Definition at line 1558 of file InstrTypes.h.

◆ bundle_op_infos() [1/2]

template<typename InstrTy, typename OpIteratorTy>
iterator_range<bundle_op_iterator> llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundle_op_infos ( )
inlineprotected

Return the range [bundle_op_info_begin, bundle_op_info_end).

Definition at line 1565 of file InstrTypes.h.

◆ bundle_op_infos() [2/2]

template<typename InstrTy, typename OpIteratorTy>
iterator_range<const_bundle_op_iterator> llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundle_op_infos ( ) const
inlineprotected

Return the range [bundle_op_info_begin, bundle_op_info_end).

Definition at line 1570 of file InstrTypes.h.

◆ bundleOperandHasAttr()

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::bundleOperandHasAttr ( unsigned  OpIdx,
Attribute::AttrKind  A 
) const
inline

Return true if the bundle operand at index OpIdx has the attribute A.

Definition at line 1438 of file InstrTypes.h.

◆ CountBundleInputs()

template<typename InstrTy, typename OpIteratorTy>
static unsigned llvm::OperandBundleUser< InstrTy, OpIteratorTy >::CountBundleInputs ( ArrayRef< OperandBundleDef Bundles)
inlinestaticprotected

Return the total number of values used in Bundles.

Definition at line 1618 of file InstrTypes.h.

◆ countOperandBundlesOfType() [1/2]

template<typename InstrTy, typename OpIteratorTy>
unsigned llvm::OperandBundleUser< InstrTy, OpIteratorTy >::countOperandBundlesOfType ( StringRef  Name) const
inline

Return the number of operand bundles with the tag Name attached to this instruction.

Definition at line 1339 of file InstrTypes.h.

Referenced by llvm::IRTranslator::getAnalysisUsage(), getMemCmpLoad(), and llvm::SelectionDAGBuilder::visitBitTestCase().

◆ countOperandBundlesOfType() [2/2]

template<typename InstrTy, typename OpIteratorTy>
unsigned llvm::OperandBundleUser< InstrTy, OpIteratorTy >::countOperandBundlesOfType ( uint32_t  ID) const
inline

Return the number of operand bundles with the tag ID attached to this instruction.

Definition at line 1350 of file InstrTypes.h.

◆ getBundleOperandsEndIndex()

template<typename InstrTy, typename OpIteratorTy>
unsigned llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getBundleOperandsEndIndex ( ) const
inline

Return the index of the last bundle operand in the Use array.

Definition at line 1307 of file InstrTypes.h.

Referenced by llvm::DOTGraphTraits< BoUpSLP * >::getNodeAttributes().

◆ getBundleOperandsStartIndex()

template<typename InstrTy, typename OpIteratorTy>
unsigned llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getBundleOperandsStartIndex ( ) const
inline

Return the index of the first bundle operand in the Use array.

Definition at line 1301 of file InstrTypes.h.

Referenced by llvm::DOTGraphTraits< BoUpSLP * >::getNodeAttributes().

◆ getBundleOpInfoForOperand()

template<typename InstrTy, typename OpIteratorTy>
const BundleOpInfo& llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getBundleOpInfoForOperand ( unsigned  OpIdx) const
inlineprotected

Return the BundleOpInfo for the operand at index OpIdx.

It is an error to call this with an OpIdx that does not correspond to an bundle operand.

Definition at line 1609 of file InstrTypes.h.

◆ getNumOperandBundles()

template<typename InstrTy, typename OpIteratorTy>
unsigned llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getNumOperandBundles ( ) const
inline

Return the number of operand bundles associated with this User.

Definition at line 1293 of file InstrTypes.h.

Referenced by llvm::OperandBundleUser< InvokeInst, User::op_iterator >::hasIdenticalOperandBundleSchema().

◆ getNumTotalBundleOperands()

template<typename InstrTy, typename OpIteratorTy>
unsigned llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getNumTotalBundleOperands ( ) const
inline

Return the total number operands (not operand bundles) used by every operand bundle in this OperandBundleUser.

Definition at line 1320 of file InstrTypes.h.

◆ getOperandBundle() [1/2]

template<typename InstrTy, typename OpIteratorTy>
Optional<OperandBundleUse> llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getOperandBundle ( StringRef  Name) const
inline

Return an operand bundle by name, if present.

It is an error to call this for operand bundle types that may have multiple instances of them on the same instruction.

Definition at line 1363 of file InstrTypes.h.

Referenced by getParentPad(), HandleCallsInBlockInlinedThroughInvoke(), and MakeGuardControlFlowExplicit().

◆ getOperandBundle() [2/2]

template<typename InstrTy, typename OpIteratorTy>
Optional<OperandBundleUse> llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getOperandBundle ( uint32_t  ID) const
inline

Return an operand bundle by tag ID, if present.

It is an error to call this for operand bundle types that may have multiple instances of them on the same instruction.

Definition at line 1379 of file InstrTypes.h.

◆ getOperandBundleAt()

template<typename InstrTy, typename OpIteratorTy>
OperandBundleUse llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getOperandBundleAt ( unsigned  Index) const
inline

Return the operand bundle at a specific index.

Definition at line 1332 of file InstrTypes.h.

◆ getOperandBundleForOperand()

template<typename InstrTy, typename OpIteratorTy>
OperandBundleUse llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getOperandBundleForOperand ( unsigned  OpIdx) const
inline

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 bundle operand.

Definition at line 1407 of file InstrTypes.h.

◆ getOperandBundlesAsDefs()

template<typename InstrTy, typename OpIteratorTy>
void llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getOperandBundlesAsDefs ( SmallVectorImpl< OperandBundleDef > &  Defs) const
inline

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).

Definition at line 1398 of file InstrTypes.h.

Referenced by changeToCall(), llvm::changeToInvokeAndSplitBasicBlock(), llvm::InlineFunction(), llvm::FortifiedLibCallSimplifier::optimizeCall(), llvm::LibCallSimplifier::optimizeCall(), PerformHeapAllocSRoA(), shouldReorderOperands(), and tryToOptimizeStoreOfMallocToGlobal().

◆ hasClobberingOperandBundles()

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::hasClobberingOperandBundles ( ) const
inline

Return true if this operand bundle user has operand bundles that may write to the heap.

Definition at line 1422 of file InstrTypes.h.

◆ hasIdenticalOperandBundleSchema()

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::hasIdenticalOperandBundleSchema ( const OperandBundleUser< InstrTy, OpIteratorTy > &  Other) const
inline

Return true if Other has the same sequence of operand bundle tags with the same number of operands on each one of them as this OperandBundleUser.

Definition at line 1447 of file InstrTypes.h.

Referenced by llvm::DOTGraphTraits< BoUpSLP * >::getNodeAttributes().

◆ hasOperandBundles()

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::hasOperandBundles ( ) const
inline

Return true if this User has any operand bundles.

Definition at line 1298 of file InstrTypes.h.

Referenced by emitSignedInt64(), llvm::DOTGraphTraits< BoUpSLP * >::getNodeAttributes(), and markTails().

◆ hasOperandBundlesOtherThan()

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::hasOperandBundlesOtherThan ( ArrayRef< uint32_t IDs) const
inline

Return true if this operand bundle user contains operand bundles with tags other than those specified in IDs.

Definition at line 1458 of file InstrTypes.h.

Referenced by getMemCmpLoad(), and llvm::SelectionDAGBuilder::visitBitTestCase().

◆ hasReadingOperandBundles()

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::hasReadingOperandBundles ( ) const
inline

Return true if this operand bundle user has operand bundles that may read from the heap.

Definition at line 1413 of file InstrTypes.h.

◆ isBundleOperand()

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::isBundleOperand ( unsigned  Idx) const
inline

Return true if the operand at index Idx is a bundle operand.

Definition at line 1313 of file InstrTypes.h.

◆ isFnAttrDisallowedByOpBundle() [1/2]

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::isFnAttrDisallowedByOpBundle ( StringRef  S) const
inlineprotected

Is the function attribute S disallowed by some operand bundle on this operand bundle user?

Definition at line 1470 of file InstrTypes.h.

◆ isFnAttrDisallowedByOpBundle() [2/2]

template<typename InstrTy, typename OpIteratorTy>
bool llvm::OperandBundleUser< InstrTy, OpIteratorTy >::isFnAttrDisallowedByOpBundle ( Attribute::AttrKind  A) const
inlineprotected

Is the function attribute A disallowed by some operand bundle on this operand bundle user?

Definition at line 1478 of file InstrTypes.h.

◆ operandBundleFromBundleOpInfo()

template<typename InstrTy, typename OpIteratorTy>
OperandBundleUse llvm::OperandBundleUser< InstrTy, OpIteratorTy >::operandBundleFromBundleOpInfo ( const BundleOpInfo BOI) const
inlineprotected

Simple helper function to map a BundleOpInfo to an OperandBundleUse.

Definition at line 1519 of file InstrTypes.h.

◆ populateBundleOperandInfos()

template<typename InstrTy, typename OpIteratorTy>
OpIteratorTy llvm::OperandBundleUser< InstrTy, OpIteratorTy >::populateBundleOperandInfos ( ArrayRef< OperandBundleDef Bundles,
const unsigned  BeginIndex 
)
inlineprotected

Populate the BundleOpInfo instances and the Use& vector from Bundles.

Return the op_iterator pointing to the Use& one past the last last bundle operand use.

Each OperandBundleDef instance is tracked by a OperandBundleInfo instance allocated in this User's descriptor.

Definition at line 1580 of file InstrTypes.h.


The documentation for this class was generated from the following file: