CodeExtractor::CodeExtractor(DominatorTree &DT, Loop &L, bool AggregateArgs, BlockFrequencyInfo *BFI, BranchProbabilityInfo *BPI) : DT(&DT), AggregateArgs(AggregateArgs || AggregateArgsOpt), BFI(BFI), BPI(BPI), AllowVarArgs(false), Blocks(buildExtractionBlockSet(L.getBlocks(), &DT, /* AllowVarArgs */ false)) {}
RegionExtractor::RegionExtractor(DominatorTree &DT, Loop &L, std::string regionName, bool profileApp, bool pcere, bool AggregateArgs) : DT(&DT), AggregateArgs(AggregateArgs || AggregateArgsOpt), Separator("_"), LoopFileInfos(RegionsFile), Blocks(buildExtractionBlockSet(L.getBlocks())), NumExitBlocks(~0U), RegionName(regionName), ProfileApp(profileApp), Pcere(pcere) { if (regionName.empty()) RegionName = "all"; }
// Visit all loads the loop L, and for those that, after complete loop // unrolling, would have a constant address and it will point to a known // constant initializer, record its base address for future use. It is used // when we estimate number of potentially simplified instructions. void FindConstFoldableLoads() { for (auto BB : L->getBlocks()) { for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { if (LoadInst *LI = dyn_cast<LoadInst>(I)) { if (!LI->isSimple()) continue; Value *AddrOp = LI->getPointerOperand(); const SCEV *S = SE.getSCEV(AddrOp); FindConstantPointers Visitor(L, SE); SCEVTraversal<FindConstantPointers> T(Visitor); T.visitAll(S); if (Visitor.IndexIsConstant && Visitor.LoadCanBeConstantFolded) { LoadBaseAddresses[LI] = Visitor.BaseAddress; } } } } }
CodeExtractor::CodeExtractor(DominatorTree &DT, Loop &L, bool AggregateArgs, BlockFrequencyInfo *BFI, BranchProbabilityInfo *BPI) : DT(&DT), AggregateArgs(AggregateArgs || AggregateArgsOpt), BFI(BFI), BPI(BPI), Blocks(buildExtractionBlockSet(L.getBlocks(), &DT)), NumExitBlocks(~0U) {}
CodeExtractor::CodeExtractor(DominatorTree &DT, Loop &L, bool AggregateArgs) : DT(&DT), AggregateArgs(AggregateArgs||AggregateArgsOpt), Blocks(buildExtractionBlockSet(L.getBlocks())), NumExitBlocks(~0U) {}