LLVM 20.0.0git
|
The main job of the Region is to point to new instructions generated by vectorization passes. More...
#include "llvm/SandboxIR/Region.h"
Public Types | |
using | iterator = decltype(Insts.begin()) |
Public Member Functions | |
Region (Context &Ctx, TargetTransformInfo &TTI) | |
~Region () | |
Context & | getContext () const |
void | add (Instruction *I) |
Adds I to the set. | |
void | remove (Instruction *I) |
Removes I from the set. | |
bool | contains (Instruction *I) const |
Returns true if I is in the Region. | |
bool | empty () const |
Returns true if the Region has no instructions. | |
iterator | begin () |
iterator | end () |
iterator_range< iterator > | insts () |
const ScoreBoard & | getScoreboard () const |
\Returns the ScoreBoard data structure that keeps track of instr costs. | |
bool | operator== (const Region &Other) const |
This is an expensive check, meant for testing. | |
bool | operator!= (const Region &other) const |
void | dump (raw_ostream &OS) const |
void | dump () const |
Static Public Member Functions | |
static SmallVector< std::unique_ptr< Region > > | createRegionsFromMD (Function &F, TargetTransformInfo &TTI) |
Friends | |
raw_ostream & | operator<< (raw_ostream &OS, const Region &Rgn) |
The main job of the Region is to point to new instructions generated by vectorization passes.
It is the unit that RegionPasses operate on with their runOnRegion() function.
The region allows us to stack transformations horizontally, meaning that each transformation operates on a single region and the resulting region is the input to the next transformation, as opposed to vertically, which is the common way of applying a transformation across the whole function. This enables us to check for profitability and decide whether we accept or rollback at a region granularity, which is much better than doing this at the function level.
using llvm::sandboxir::Region::iterator = decltype(Insts.begin()) |
llvm::sandboxir::Region::Region | ( | Context & | Ctx, |
TargetTransformInfo & | TTI | ||
) |
Definition at line 35 of file Region.cpp.
References add(), llvm::MDString::get(), llvm::MDNode::getDistinct(), llvm::sandboxir::Context::LLVMCtx, llvm::sandboxir::Context::registerCreateInstrCallback(), llvm::sandboxir::Context::registerEraseInstrCallback(), and remove().
llvm::sandboxir::Region::~Region | ( | ) |
Definition at line 47 of file Region.cpp.
References llvm::sandboxir::Context::unregisterCreateInstrCallback(), and llvm::sandboxir::Context::unregisterEraseInstrCallback().
void llvm::sandboxir::Region::add | ( | Instruction * | I | ) |
Adds I to the set.
Definition at line 52 of file Region.cpp.
References llvm::sandboxir::ScoreBoard::add(), and I.
Referenced by Region().
|
inline |
Definition at line 129 of file Region.h.
References llvm::SetVector< T, Vector, Set, N >::begin().
Referenced by insts().
|
inline |
Returns true if I is in the Region.
Definition at line 124 of file Region.h.
References llvm::SetVector< T, Vector, Set, N >::contains(), and I.
Referenced by llvm::sandboxir::ScoreBoard::remove().
|
static |
Definition at line 90 of file Region.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::back(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), F, llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by llvm::sandboxir::RegionsFromMetadata::runOnFunction().
void llvm::sandboxir::Region::dump | ( | ) | const |
Definition at line 83 of file Region.cpp.
References llvm::dbgs(), and dump().
Referenced by dump().
void llvm::sandboxir::Region::dump | ( | raw_ostream & | OS | ) | const |
Definition at line 78 of file Region.cpp.
|
inline |
Returns true if the Region has no instructions.
Definition at line 126 of file Region.h.
References llvm::SetVector< T, Vector, Set, N >::empty().
|
inline |
Definition at line 130 of file Region.h.
References llvm::SetVector< T, Vector, Set, N >::end().
Referenced by insts().
|
inline |
|
inline |
\Returns the ScoreBoard data structure that keeps track of instr costs.
|
inline |
Definition at line 131 of file Region.h.
References begin(), end(), and llvm::make_range().
This is an expensive check, meant for testing.
Definition at line 70 of file Region.cpp.
References llvm::Other.
void llvm::sandboxir::Region::remove | ( | Instruction * | I | ) |
Removes I from the set.
Definition at line 60 of file Region.cpp.
References I, and llvm::sandboxir::ScoreBoard::remove().
Referenced by Region().
|
friend |