21#include "llvm/Analysis/DominanceFrontier.h"
22#include "llvm/Analysis/LoopInfo.h"
23#include "llvm/Analysis/RegionInfo.h"
24#include "llvm/Analysis/ScalarEvolution.h"
25#include "llvm/InitializePasses.h"
34class CodePreparation final :
public FunctionPass {
35 CodePreparation(
const CodePreparation &) =
delete;
36 const CodePreparation &operator=(
const CodePreparation &) =
delete;
46 explicit CodePreparation() : FunctionPass(ID) {}
51 void getAnalysisUsage(AnalysisUsage &AU)
const override;
52 void releaseMemory()
override;
53 bool runOnFunction(Function &F)
override;
54 void print(raw_ostream &OS,
const Module *)
const override;
60 FunctionAnalysisManager &FAM) {
64 auto &EntryBlock = F.getEntryBlock();
65 BasicBlock::iterator I = EntryBlock.begin();
66 while (isa<AllocaInst>(I))
69 auto &DT = FAM.getResult<DominatorTreeAnalysis>(F);
70 auto &LI = FAM.getResult<LoopAnalysis>(F);
76 PA.preserve<DominatorTreeAnalysis>();
77 PA.preserve<LoopAnalysis>();
81void CodePreparation::clear() {}
83CodePreparation::~CodePreparation() {
clear(); }
85void CodePreparation::getAnalysisUsage(AnalysisUsage &AU)
const {
86 AU.addRequired<LoopInfoWrapperPass>();
87 AU.addRequired<ScalarEvolutionWrapperPass>();
89 AU.addPreserved<LoopInfoWrapperPass>();
90 AU.addPreserved<RegionInfoPass>();
91 AU.addPreserved<DominatorTreeWrapperPass>();
92 AU.addPreserved<DominanceFrontierWrapperPass>();
95bool CodePreparation::runOnFunction(Function &F) {
99 LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
100 SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
107void CodePreparation::releaseMemory() {
clear(); }
109void CodePreparation::print(raw_ostream &OS,
const Module *)
const {}
111char CodePreparation::ID = 0;
117 "Polly - Prepare code for polly",
false,
false)
INITIALIZE_PASS_BEGIN(DependenceInfo, "polly-dependences", "Polly - Calculate dependences", false, false)
INITIALIZE_PASS_END(DependenceInfo, "polly-dependences", "Polly - Calculate dependences", false, false) namespace
INITIALIZE_PASS_DEPENDENCY(ScopInfoRegionPass)
for(int c0=1;c0< 3 *M - 1;c0+=3)
void GMPQAPI() clear(mp_rat x)
This file contains the declaration of the PolyhedralInfo class, which will provide an interface to ex...
llvm::Pass * createCodePreparationPass()
void splitEntryBlockForAlloca(llvm::BasicBlock *EntryBlock, llvm::Pass *P)
Split the entry block of a function to store the newly inserted allocations outside of all Scops.
llvm::PreservedAnalyses run(llvm::Function &F, llvm::FunctionAnalysisManager &FAM)