|
LLVM 23.0.0git
|
#include "llvm/SandboxIR/Region.h"
Public Types | |
| using | iterator = decltype(Insts.begin()) |
Public Member Functions | |
| LLVM_ABI | Region (Context &Ctx) |
| virtual LLVM_ABI | ~Region () |
| Region (const Region &)=delete | |
| Region (Region &&)=default | |
| Context & | getContext () const |
| bool | contains (Instruction *I) const |
| Returns true if I is in the Region. | |
| bool | empty () const |
| Returns true if the Region has no instructions. | |
| LLVM_ABI void | setAux (ArrayRef< Instruction * > Aux) |
| Set the auxiliary vector. | |
| const SmallVector< Instruction * > & | getAux () const |
| \Returns the auxiliary vector. | |
| LLVM_ABI void | clearAux () |
| Clears all auxiliary data. | |
| iterator | begin () |
| iterator | end () |
| iterator_range< iterator > | insts () |
| RegionClassID | getSubclassID () const |
| LLVM_ABI_FOR_TEST bool | operator== (const Region &Other) const |
| This is an expensive check, meant for testing. | |
| bool | operator!= (const Region &other) const |
| LLVM_ABI_FOR_TEST void | dump (raw_ostream &OS) const |
| void | dump () const |
Static Public Member Functions | |
| static LLVM_ABI SmallVector< std::unique_ptr< Region > > | createRegionsFromMD (Function &F) |
Protected Member Functions | |
| void | addRaw (Instruction *I) |
Adds I to the set. | |
| virtual void | add (Instruction *I) |
| Adds I to the set. | |
| virtual LLVM_ABI void | remove (Instruction *I) |
| Removes I from the set. | |
| void | setAux (unsigned Idx, Instruction *I) |
Set I as the Idx'th element in the auxiliary vector. | |
| void | dropAuxMetadata (Instruction *I) |
Helper for dropping Aux metadata for I. | |
| void | removeFromAux (Instruction *I) |
Remove instruction I from Aux and drop metadata. | |
| LLVM_ABI | Region (Context &Ctx, RegionClassID ID) |
Static Protected Member Functions | |
| template<typename RegionT, typename RegionFactoryT> | |
| static SmallVector< std::unique_ptr< RegionT > > | createRegionsFromMD (Function &F, RegionFactoryT Factory) |
Protected Attributes | |
| SetVector< Instruction * > | Insts |
| All the instructions in the Region. | |
| SmallVector< Instruction * > | Aux |
| An auxiliary sequence of Instruction-Index pairs. | |
| MDNode * | RegionMDN |
| MDNode that we'll use to mark instructions as being part of the region. | |
| Context & | Ctx |
| RegionClassID | ID |
| Context::CallbackID | CreateInstCB |
| ID (for later deregistration) of the "create instruction" callback. | |
| Context::CallbackID | EraseInstCB |
| ID (for later deregistration) of the "erase instruction" callback. | |
Static Protected Attributes | |
| static constexpr const char * | MDKind = "sandboxvec" |
| static constexpr const char * | RegionStr = "sandboxregion" |
| static constexpr const char * | AuxMDKind = "sandboxaux" |
Friends | |
| class | Context |
| class | RegionInternalsAttorney |
| raw_ostream & | operator<< (raw_ostream &OS, const Region &Rgn) |
| using llvm::sandboxir::Region::iterator = decltype(Insts.begin()) |
|
protected |
Definition at line 13 of file Region.cpp.
References addRaw(), Context, CreateInstCB, Ctx, EraseInstCB, llvm::MDString::get(), llvm::MDNode::getDistinct(), ID, RegionMDN, RegionStr, remove(), and removeFromAux().
Referenced by llvm::sandboxir::RegionWithScore::classof(), operator!=(), operator<<, operator==(), Region(), Region(), Region(), llvm::sandboxir::RegionWithScore::RegionWithScore(), and llvm::sandboxir::RegionWithScore::RegionWithScore().
|
virtual |
Definition at line 26 of file Region.cpp.
References CreateInstCB, Ctx, and EraseInstCB.
|
inlineprotectedvirtual |
Adds I to the set.
This is the main API for adding an instruction to the region.
Definition at line 104 of file Region.h.
Referenced by llvm::sandboxir::RegionInternalsAttorney::add().
|
inlineprotected |
Adds I to the set.
Only to be used when we want to avoid the additional functionality provided by the subclass, e.g., to avoid score counting when adding instrs to the aux vector. NOTE: When an instruction is added to the region we track it cost in the scoreboard, which currently resides in the region class. However, when we add an instruction to the auxiliary vector it does get tagged as being a member of the region (for ownership reasons), but its cost does not get counted because the instruction hasn't been added in the "normal" way.
Definition at line 97 of file Region.h.
References llvm::cast(), I, Insts, MDKind, and RegionMDN.
|
inline |
| void llvm::sandboxir::Region::clearAux | ( | ) |
Clears all auxiliary data.
Definition at line 75 of file Region.cpp.
References Aux, dropAuxMetadata(), and llvm::seq().
Referenced by llvm::sandboxir::SeedCollection::runOnFunction().
|
inline |
|
static |
Definition at line 115 of file Region.cpp.
References createRegionsFromMD(), and F.
|
inlinestaticprotected |
Definition at line 122 of file Region.h.
References assert(), AuxMDKind, llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::sandboxir::BasicBlock(), llvm::cast(), llvm::dyn_cast(), llvm::errs(), F, I, MDKind, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::reportFatalUsageError(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::try_emplace().
Referenced by createRegionsFromMD(), and llvm::sandboxir::RegionWithScore::createRegionsFromMD().
|
protected |
Helper for dropping Aux metadata for I.
Definition at line 62 of file Region.cpp.
References AuxMDKind, llvm::cast(), and I.
Referenced by clearAux(), and removeFromAux().
| void llvm::sandboxir::Region::dump | ( | ) | const |
Definition at line 109 of file Region.cpp.
References llvm::dbgs(), and dump().
Referenced by dump().
| void llvm::sandboxir::Region::dump | ( | raw_ostream & | OS | ) | const |
|
inline |
Returns true if the Region has no instructions.
Definition at line 173 of file Region.h.
References Insts.
Referenced by llvm::sandboxir::PackReuse::runOnRegion().
|
inline |
|
inline |
\Returns the auxiliary vector.
Definition at line 177 of file Region.h.
References Aux.
Referenced by llvm::sandboxir::BottomUpVec::runOnRegion(), and llvm::sandboxir::LoadStoreVec::runOnRegion().
|
inline |
Definition at line 169 of file Region.h.
Referenced by llvm::sandboxir::TransactionAcceptOrRevert::runOnRegion(), and llvm::sandboxir::TransactionSave::runOnRegion().
|
inline |
Definition at line 189 of file Region.h.
References ID.
Referenced by llvm::sandboxir::RegionWithScore::classof().
|
inline |
Definition at line 184 of file Region.h.
References begin(), end(), and llvm::make_range().
This is an expensive check, meant for testing.
Definition at line 87 of file Region.cpp.
References Insts, llvm::Other, and Region().
|
protectedvirtual |
Removes I from the set.
Definition at line 81 of file Region.cpp.
References llvm::cast(), I, Insts, and MDKind.
Referenced by Region(), and llvm::sandboxir::RegionInternalsAttorney::remove().
|
protected |
Remove instruction I from Aux and drop metadata.
Definition at line 67 of file Region.cpp.
References Aux, dropAuxMetadata(), llvm::find(), and I.
Referenced by Region().
| void llvm::sandboxir::Region::setAux | ( | ArrayRef< Instruction * > | Aux | ) |
Set the auxiliary vector.
Definition at line 31 of file Region.cpp.
References addRaw(), assert(), Aux, AuxMDKind, llvm::cast(), Ctx, llvm::enumerate(), llvm::ConstantAsMetadata::get(), llvm::MDNode::get(), llvm::Type::getInt32Ty(), I, and llvm::SmallVector.
|
protected |
Set I as the Idx'th element in the auxiliary vector.
NOTE: This is for internal use, it does not set the metadata.
Definition at line 46 of file Region.cpp.
References addRaw(), assert(), Aux, and I.
Referenced by llvm::sandboxir::SeedCollection::runOnFunction().
|
friend |
Definition at line 107 of file Region.h.
References Context.
Referenced by Context, getContext(), Region(), Region(), RegionInternalsAttorney, and llvm::sandboxir::RegionWithScore::RegionWithScore().
|
friend |
|
friend |
Definition at line 108 of file Region.h.
References Context, Ctx, I, ID, LLVM_ABI, and RegionInternalsAttorney.
Referenced by RegionInternalsAttorney.
|
protected |
An auxiliary sequence of Instruction-Index pairs.
Definition at line 72 of file Region.h.
Referenced by clearAux(), dump(), getAux(), removeFromAux(), setAux(), and setAux().
Definition at line 78 of file Region.h.
Referenced by createRegionsFromMD(), dropAuxMetadata(), and setAux().
|
protected |
|
protected |
Definition at line 80 of file Region.h.
Referenced by getContext(), Region(), Region(), RegionInternalsAttorney, llvm::sandboxir::RegionWithScore::RegionWithScore(), setAux(), and ~Region().
|
protected |
|
protected |
Definition at line 82 of file Region.h.
Referenced by getSubclassID(), Region(), and RegionInternalsAttorney.
|
protected |
Definition at line 76 of file Region.h.
Referenced by addRaw(), createRegionsFromMD(), and remove().
|
protected |