mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
[PM] Split the AssumptionTracker immutable pass into two separate APIs:
a cache of assumptions for a single function, and an immutable pass that manages those caches. The motivation for this change is two fold. Immutable analyses are really hacks around the current pass manager design and don't exist in the new design. This is usually OK, but it requires that the core logic of an immutable pass be reasonably partitioned off from the pass logic. This change does precisely that. As a consequence it also paves the way for the *many* utility functions that deal in the assumptions to live in both pass manager worlds by creating an separate non-pass object with its own independent API that they all rely on. Now, the only bits of the system that deal with the actual pass mechanics are those that actually need to deal with the pass mechanics. Once this separation is made, several simplifications become pretty obvious in the assumption cache itself. Rather than using a set and callback value handles, it can just be a vector of weak value handles. The callers can easily skip the handles that are null, and eventually we can wrap all of this up behind a filter iterator. For now, this adds boiler plate to the various passes, but this kind of boiler plate will end up making it possible to port these passes to the new pass manager, and so it will end up factored away pretty reasonably. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225131 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -44,7 +44,7 @@ class Loop;
|
||||
class LoopInfo;
|
||||
class AllocaInst;
|
||||
class AliasAnalysis;
|
||||
class AssumptionTracker;
|
||||
class AssumptionCacheTracker;
|
||||
|
||||
/// CloneModule - Return an exact copy of the specified module
|
||||
///
|
||||
@@ -162,15 +162,15 @@ public:
|
||||
explicit InlineFunctionInfo(CallGraph *cg = nullptr,
|
||||
const DataLayout *DL = nullptr,
|
||||
AliasAnalysis *AA = nullptr,
|
||||
AssumptionTracker *AT = nullptr)
|
||||
: CG(cg), DL(DL), AA(AA), AT(AT) {}
|
||||
AssumptionCacheTracker *ACT = nullptr)
|
||||
: CG(cg), DL(DL), AA(AA), ACT(ACT) {}
|
||||
|
||||
/// CG - If non-null, InlineFunction will update the callgraph to reflect the
|
||||
/// changes it makes.
|
||||
CallGraph *CG;
|
||||
const DataLayout *DL;
|
||||
AliasAnalysis *AA;
|
||||
AssumptionTracker *AT;
|
||||
AssumptionCacheTracker *ACT;
|
||||
|
||||
/// StaticAllocas - InlineFunction fills this in with all static allocas that
|
||||
/// get copied into the caller.
|
||||
|
@@ -34,7 +34,7 @@ class Value;
|
||||
class Pass;
|
||||
class PHINode;
|
||||
class AllocaInst;
|
||||
class AssumptionTracker;
|
||||
class AssumptionCache;
|
||||
class ConstantExpr;
|
||||
class DataLayout;
|
||||
class TargetLibraryInfo;
|
||||
@@ -138,9 +138,8 @@ bool EliminateDuplicatePHINodes(BasicBlock *BB);
|
||||
/// the basic block that was pointed to.
|
||||
///
|
||||
bool SimplifyCFG(BasicBlock *BB, const TargetTransformInfo &TTI,
|
||||
unsigned BonusInstThreshold,
|
||||
const DataLayout *TD = nullptr,
|
||||
AssumptionTracker *AT = nullptr);
|
||||
unsigned BonusInstThreshold, const DataLayout *TD = nullptr,
|
||||
AssumptionCache *AC = nullptr);
|
||||
|
||||
/// FlatternCFG - This function is used to flatten a CFG. For
|
||||
/// example, it uses parallel-and and parallel-or mode to collapse
|
||||
@@ -176,17 +175,17 @@ AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = nullptr);
|
||||
/// increase the alignment of the ultimate object, making this check succeed.
|
||||
unsigned getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
|
||||
const DataLayout *TD = nullptr,
|
||||
AssumptionTracker *AT = nullptr,
|
||||
AssumptionCache *AC = nullptr,
|
||||
const Instruction *CxtI = nullptr,
|
||||
const DominatorTree *DT = nullptr);
|
||||
|
||||
/// getKnownAlignment - Try to infer an alignment for the specified pointer.
|
||||
static inline unsigned getKnownAlignment(Value *V,
|
||||
const DataLayout *TD = nullptr,
|
||||
AssumptionTracker *AT = nullptr,
|
||||
AssumptionCache *AC = nullptr,
|
||||
const Instruction *CxtI = nullptr,
|
||||
const DominatorTree *DT = nullptr) {
|
||||
return getOrEnforceKnownAlignment(V, 0, TD, AT, CxtI, DT);
|
||||
return getOrEnforceKnownAlignment(V, 0, TD, AC, CxtI, DT);
|
||||
}
|
||||
|
||||
/// EmitGEPOffset - Given a getelementptr instruction/constantexpr, emit the
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace llvm {
|
||||
class AliasAnalysis;
|
||||
class AssumptionTracker;
|
||||
class AssumptionCache;
|
||||
class BasicBlock;
|
||||
class DataLayout;
|
||||
class DominatorTree;
|
||||
@@ -36,7 +36,7 @@ BasicBlock *InsertPreheaderForLoop(Loop *L, Pass *P);
|
||||
bool simplifyLoop(Loop *L, DominatorTree *DT, LoopInfo *LI, Pass *PP,
|
||||
AliasAnalysis *AA = nullptr, ScalarEvolution *SE = nullptr,
|
||||
const DataLayout *DL = nullptr,
|
||||
AssumptionTracker *AT = nullptr);
|
||||
AssumptionCache *AC = nullptr);
|
||||
|
||||
/// \brief Put loop into LCSSA form.
|
||||
///
|
||||
|
@@ -22,7 +22,7 @@ namespace llvm {
|
||||
class AllocaInst;
|
||||
class DominatorTree;
|
||||
class AliasSetTracker;
|
||||
class AssumptionTracker;
|
||||
class AssumptionCache;
|
||||
|
||||
/// \brief Return true if this alloca is legal for promotion.
|
||||
///
|
||||
@@ -43,7 +43,7 @@ bool isAllocaPromotable(const AllocaInst *AI);
|
||||
/// made to the IR.
|
||||
void PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
|
||||
AliasSetTracker *AST = nullptr,
|
||||
AssumptionTracker *AT = nullptr);
|
||||
AssumptionCache *AC = nullptr);
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class AssumptionTracker;
|
||||
class AssumptionCache;
|
||||
class Loop;
|
||||
class LoopInfo;
|
||||
class LPPassManager;
|
||||
@@ -26,7 +26,7 @@ class Pass;
|
||||
|
||||
bool UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, bool AllowRuntime,
|
||||
unsigned TripMultiple, LoopInfo *LI, Pass *PP,
|
||||
LPPassManager *LPM, AssumptionTracker *AT);
|
||||
LPPassManager *LPM, AssumptionCache *AC);
|
||||
|
||||
bool UnrollRuntimeLoopProlog(Loop *L, unsigned Count, LoopInfo *LI,
|
||||
LPPassManager* LPM);
|
||||
|
Reference in New Issue
Block a user