From bff810cc371a38f493d688c54f71013f5a7d53bf Mon Sep 17 00:00:00 2001 From: dhuth Date: Wed, 27 Aug 2014 09:52:06 -0600 Subject: Initial commit --- dep.hh | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 dep.hh (limited to 'dep.hh') diff --git a/dep.hh b/dep.hh new file mode 100644 index 0000000..1fa1280 --- /dev/null +++ b/dep.hh @@ -0,0 +1,85 @@ +#ifndef DEP_HH +#define DEP_HH + +#include +#include "graph.hh" +#include "ir_code.hh" +#include "chill_error.hh" + +enum DependenceType { DEP_W2R, DEP_R2W, DEP_W2W, DEP_R2R, DEP_CONTROL, DEP_UNKNOWN }; + +class DependenceVector; +typedef std::vector DependenceList; + +struct DependenceVector { + DependenceType type; + IR_Symbol *sym; + + bool is_reduction; // used to identify a class of flow dependence + // that can be broken + std::vector lbounds; + std::vector ubounds; + + bool quasi; + bool is_scalar_dependence; + DependenceVector() { + type = DEP_UNKNOWN; + sym = NULL; + is_reduction = false; + quasi = false; + is_scalar_dependence = false; + } + // DependenceVector(int size); + DependenceVector(const DependenceVector &that); + ~DependenceVector() {delete sym;} + DependenceVector &operator=(const DependenceVector &that); + + bool is_data_dependence() const; + bool is_control_dependence() const; + bool has_negative_been_carried_at(int dim) const; + bool has_been_carried_at(int dim) const; + bool has_been_carried_before(int dim) const; + + // the following functions will be cleaned up or removed later + bool isZero() const; + bool isPositive() const; + bool isNegative() const; + bool isAllPositive() const; + bool isAllNegative() const; + bool isZero(int dim) const; + bool hasPositive(int dim) const; + bool hasNegative(int dim) const; + bool isCarried(int dim, omega::coef_t distance = posInfinity) const; + bool canPermute(const std::vector &pi) const; + + std::vector normalize() const; + std::vector permute(const std::vector &pi) const; + DependenceVector reverse() const; + // std::vector matrix(const std::vector > &M) const; + DependenceType getType() const; + friend std::ostream& operator<<(std::ostream &os, const DependenceVector &d); +}; + + + +class DependenceGraph: public Graph { + +protected: + int num_dim_; + +public: + DependenceGraph(int n) { num_dim_ = n; } + DependenceGraph() { num_dim_ = 0; } + ~DependenceGraph() {} + int num_dim() const { return num_dim_; } +// DependenceGraph permute(const std::vector &pi) const; + DependenceGraph permute(const std::vector &pi, + const std::set &active = std::set()) const; + // DependenceGraph matrix(const std::vector > &M) const; + DependenceGraph subspace(int dim) const; + bool isPositive() const; + bool hasPositive(int dim) const; + bool hasNegative(int dim) const; +}; + +#endif -- cgit v1.2.3-70-g09d2