mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-31 10:34:17 +00:00
Add new constructors for LoopInfo/DominatorTree/BFI/BPI
Those new constructors make it more natural to construct an object for a function. For example, previously to build a LoopInfo for a function, we need four statements: DominatorTree DT; LoopInfo LI; DT.recalculate(F); LI.analyze(DT); Now we only need one statement: LoopInfo LI(DominatorTree(F)); http://reviews.llvm.org/D11274 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242486 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
650d9427f0
commit
1dd3d83c5e
@ -31,6 +31,10 @@ class BlockFrequencyInfo {
|
||||
std::unique_ptr<ImplType> BFI;
|
||||
|
||||
public:
|
||||
BlockFrequencyInfo();
|
||||
BlockFrequencyInfo(const Function &F, const BranchProbabilityInfo &BPI,
|
||||
const LoopInfo &LI);
|
||||
|
||||
const Function *getFunction() const;
|
||||
void view() const;
|
||||
|
||||
|
@ -39,6 +39,9 @@ class raw_ostream;
|
||||
/// value 10.
|
||||
class BranchProbabilityInfo {
|
||||
public:
|
||||
BranchProbabilityInfo() {}
|
||||
BranchProbabilityInfo(Function &F, const LoopInfo &LI) { calculate(F, LI); }
|
||||
|
||||
void releaseMemory();
|
||||
|
||||
void print(raw_ostream &OS) const;
|
||||
|
@ -642,6 +642,7 @@ class LoopInfo : public LoopInfoBase<BasicBlock, Loop> {
|
||||
LoopInfo(const LoopInfo &) = delete;
|
||||
public:
|
||||
LoopInfo() {}
|
||||
explicit LoopInfo(const DominatorTreeBase<BasicBlock> &DomTree);
|
||||
|
||||
LoopInfo(LoopInfo &&Arg) : BaseT(std::move(static_cast<BaseT &>(Arg))) {}
|
||||
LoopInfo &operator=(LoopInfo &&RHS) {
|
||||
|
@ -69,6 +69,9 @@ public:
|
||||
typedef DominatorTreeBase<BasicBlock> Base;
|
||||
|
||||
DominatorTree() : DominatorTreeBase<BasicBlock>(false) {}
|
||||
explicit DominatorTree(Function &F) : DominatorTreeBase<BasicBlock>(false) {
|
||||
recalculate(F);
|
||||
}
|
||||
|
||||
DominatorTree(DominatorTree &&Arg)
|
||||
: Base(std::move(static_cast<Base &>(Arg))) {}
|
||||
|
@ -105,6 +105,14 @@ struct DOTGraphTraits<BlockFrequencyInfo*> : public DefaultDOTGraphTraits {
|
||||
} // end namespace llvm
|
||||
#endif
|
||||
|
||||
BlockFrequencyInfo::BlockFrequencyInfo() {}
|
||||
|
||||
BlockFrequencyInfo::BlockFrequencyInfo(const Function &F,
|
||||
const BranchProbabilityInfo &BPI,
|
||||
const LoopInfo &LI) {
|
||||
calculate(F, BPI, LI);
|
||||
}
|
||||
|
||||
void BlockFrequencyInfo::calculate(const Function &F,
|
||||
const BranchProbabilityInfo &BPI,
|
||||
const LoopInfo &LI) {
|
||||
|
@ -602,6 +602,10 @@ Loop *UnloopUpdater::getNearestLoop(BasicBlock *BB, Loop *BBLoop) {
|
||||
return NearLoop;
|
||||
}
|
||||
|
||||
LoopInfo::LoopInfo(const DominatorTreeBase<BasicBlock> &DomTree) {
|
||||
analyze(DomTree);
|
||||
}
|
||||
|
||||
/// updateUnloop - The last backedge has been removed from a loop--now the
|
||||
/// "unloop". Find a new parent for the blocks contained within unloop and
|
||||
/// update the loop tree. We don't necessarily have valid dominators at this
|
||||
|
Loading…
x
Reference in New Issue
Block a user