24#define DEBUG_TYPE "flatten-cfg"
48 bool LocalChange =
true;
52 std::vector<WeakVH> Blocks;
53 Blocks.reserve(
F.size());
55 Blocks.push_back(&BB);
61 for (
WeakVH &BlockHandle : Blocks) {
72char FlattenCFGLegacyPass::ID = 0;
82 return new FlattenCFGLegacyPass();
85bool FlattenCFGLegacyPass::runOnFunction(
Function &
F) {
86 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
87 bool EverChanged =
false;
98 bool EverChanged =
false;
static bool runOnFunction(Function &F, bool PostInlining)
static bool iterativelyFlattenCFG(Function &F, AliasAnalysis *AA)
iterativelyFlattenCFG - Call FlattenCFG on all the blocks in the function, iterating until no more ch...
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.
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.
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
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.
Abstract Attribute helper functions.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI FunctionPass * createFlattenCFGPass()
LLVM_ABI bool FlattenCFG(BasicBlock *BB, AAResults *AA=nullptr)
This function is used to flatten a CFG.
auto cast_or_null(const Y &Val)
LLVM_ABI void initializeFlattenCFGLegacyPassPass(PassRegistry &)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
AAResults AliasAnalysis
Temporary typedef for legacy code that uses a generic AliasAnalysis pointer or reference.
LLVM_ABI bool removeUnreachableBlocks(Function &F, DomTreeUpdater *DTU=nullptr, MemorySSAUpdater *MSSAU=nullptr)
Remove all blocks that can not be reached from the function's entry.
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)