#include "source/opt/loop_dependence.h"
#include <functional>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "source/opt/instruction.h"
#include "source/opt/scalar_analysis_nodes.h"
namespace spvtools {
namespace opt {
SubscriptPair;
namespace {
int64_t GreatestCommonDivisor(int64_t a, int64_t b) { … }
bool IsInCorrectFormForGCDTest(SENode* node) { … }
std::vector<SERecurrentNode*> GetAllTopLevelRecurrences(SENode* node) { … }
std::vector<SEConstantNode*> GetAllTopLevelConstants(SENode* node) { … }
bool AreOffsetsAndCoefficientsConstant(
const std::vector<SERecurrentNode*>& nodes) { … }
int64_t CalculateConstantTerm(const std::vector<SERecurrentNode*>& recurrences,
const std::vector<SEConstantNode*>& constants) { … }
int64_t CalculateGCDFromCoefficients(
const std::vector<SERecurrentNode*>& recurrences, int64_t running_gcd) { … }
bool NormalizeAndCompareFractions(int64_t numerator_0, int64_t denominator_0,
int64_t numerator_1, int64_t denominator_1) { … }
}
bool LoopDependenceAnalysis::GetDependence(const Instruction* source,
const Instruction* destination,
DistanceVector* distance_vector) { … }
bool LoopDependenceAnalysis::ZIVTest(
const std::pair<SENode*, SENode*>& subscript_pair) { … }
bool LoopDependenceAnalysis::SIVTest(
const std::pair<SENode*, SENode*>& subscript_pair,
DistanceVector* distance_vector) { … }
bool LoopDependenceAnalysis::StrongSIVTest(SENode* source, SENode* destination,
SENode* coefficient,
DistanceEntry* distance_entry) { … }
bool LoopDependenceAnalysis::SymbolicStrongSIVTest(
SENode* source, SENode* destination, SENode* coefficient,
DistanceEntry* distance_entry) { … }
bool LoopDependenceAnalysis::WeakZeroSourceSIVTest(
SENode* source, SERecurrentNode* destination, SENode* coefficient,
DistanceEntry* distance_entry) { … }
bool LoopDependenceAnalysis::WeakZeroDestinationSIVTest(
SERecurrentNode* source, SENode* destination, SENode* coefficient,
DistanceEntry* distance_entry) { … }
bool LoopDependenceAnalysis::WeakCrossingSIVTest(
SENode* source, SENode* destination, SENode* coefficient,
DistanceEntry* distance_entry) { … }
bool LoopDependenceAnalysis::GCDMIVTest(
const std::pair<SENode*, SENode*>& subscript_pair) { … }
PartitionedSubscripts;
PartitionedSubscripts LoopDependenceAnalysis::PartitionSubscripts(
const std::vector<Instruction*>& source_subscripts,
const std::vector<Instruction*>& destination_subscripts) { … }
Constraint* LoopDependenceAnalysis::IntersectConstraints(
Constraint* constraint_0, Constraint* constraint_1,
const SENode* lower_bound, const SENode* upper_bound) { … }
SubscriptPair LoopDependenceAnalysis::PropagateConstraints(
const SubscriptPair& subscript_pair,
const std::vector<Constraint*>& constraints) { … }
bool LoopDependenceAnalysis::DeltaTest(
const std::vector<SubscriptPair>& coupled_subscripts,
DistanceVector* dv_entry) { … }
}
}