[LAA] LLE 4/6: APIs to access the dependent instructions for a dependence, NFC

Summary:
The functions use LAI and MemoryDepChecker classes so they need to be
defined after those definitions outside of the Dependence class.

Will be used by the LoopLoadElimination pass.

Reviewers: hfinkel

Subscribers: rengolin, llvm-commits

Differential Revision: http://reviews.llvm.org/D13257

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252015 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Adam Nemet 2015-11-03 23:49:58 +00:00
parent 05f66f37e6
commit 9a04d22714

View File

@ -33,6 +33,7 @@ class ScalarEvolution;
class Loop;
class SCEV;
class SCEVUnionPredicate;
class LoopAccessInfo;
/// Optimization analysis message produced during vectorization. Messages inform
/// the user why vectorization did not occur.
@ -170,6 +171,11 @@ public:
Dependence(unsigned Source, unsigned Destination, DepType Type)
: Source(Source), Destination(Destination), Type(Type) {}
/// \brief Return the source instruction of the dependence.
Instruction *getSource(const LoopAccessInfo &LAI) const;
/// \brief Return the destination instruction of the dependence.
Instruction *getDestination(const LoopAccessInfo &LAI) const;
/// \brief Dependence types that don't prevent vectorization.
static bool isSafeForVectorization(DepType Type);
@ -679,6 +685,17 @@ private:
DominatorTree *DT;
LoopInfo *LI;
};
inline Instruction *MemoryDepChecker::Dependence::getSource(
const LoopAccessInfo &LAI) const {
return LAI.getDepChecker().getMemoryInstructions()[Source];
}
inline Instruction *MemoryDepChecker::Dependence::getDestination(
const LoopAccessInfo &LAI) const {
return LAI.getDepChecker().getMemoryInstructions()[Destination];
}
} // End llvm namespace
#endif