24#define DEBUG_TYPE "flatten-cfg"
47 bool LocalChange =
true;
51 std::vector<WeakVH>
Blocks;
62 if (
auto *BB = cast_or_null<BasicBlock>(BlockHandle))
66 Changed |= LocalChange;
72char FlattenCFGLegacyPass::ID = 0;
82 return new FlattenCFGLegacyPass();
85bool FlattenCFGLegacyPass::runOnFunction(
Function &
F) {
86 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
87 bool EverChanged =
false;
89 while (iterativelyFlattenCFG(
F, AA)) {
98 bool EverChanged =
false;
101 while (iterativelyFlattenCFG(
F, AA)) {
DenseMap< Block *, BlockRelaxAux > Blocks
This header defines various interfaces for pass management in LLVM.
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
A manager for alias analyses.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
A container for analyses that lazily runs them and caches their results.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
FunctionPass class - This class is used to implement most global optimizations.
virtual bool runOnFunction(Function &F)=0
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
A nullable Value handle that is nullable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
FunctionPass * createFlattenCFGPass()
bool FlattenCFG(BasicBlock *BB, AAResults *AA=nullptr)
This function is used to flatten a CFG.
void initializeFlattenCFGLegacyPassPass(PassRegistry &)
bool removeUnreachableBlocks(Function &F, DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr)
Remove all blocks that can not be reached from the function's entry.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)