24#define DEBUG_TYPE "flatten-cfg"
47 bool LocalChange =
true;
51 std::vector<WeakVH> Blocks;
52 Blocks.reserve(
F.size());
54 Blocks.push_back(&BB);
60 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;
89 while (iterativelyFlattenCFG(
F,
AA)) {
98 bool EverChanged =
false;
101 while (iterativelyFlattenCFG(
F,
AA)) {
static bool runOnFunction(Function &F, bool PostInlining)
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.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
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.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)