Exemplo n.º 1
0
  private void computeEdgeRefs(DDEdge edge, RefGroup rg, int level, int dist) {
    if (!edge.isDistanceKnown(level)) return;

    int distance = edge.getDistance(level);
    if (distance < 0) distance = -distance;

    if (distance > dist) return;

    long[] ddinfo = edge.getDDInfo();
    for (int k = 0; k < ddinfo.length; k++)
      if ((k != level)
          && DDInfo.isDistanceKnown(ddinfo[k])
          && (DDInfo.getDistance(ddinfo[k]) != 0)) {
        rg.add(edge);
        break;
      }
  }
Exemplo n.º 2
0
  private int[][] getDDVec(Table<Declaration, SubscriptExpr> arrayRefs, int loopDepth) {
    if (arrayRefs == null) return new int[0][0];

    int numEdges = 0;
    Stack<DDEdge> wl = WorkArea.<DDEdge>getStack("g<SubscriptExpr>etDDVec");

    Enumeration<DDEdge> k = graph.getEdges();
    while (k.hasMoreElements()) { // Check out every array variable in the loop nest.
      DDEdge edge = k.nextElement();
      if (edge.isSpatial()) continue;

      if (edge.isLoopIndependentDependency()) continue;

      if (edge.representsAllInput()) continue;

      wl.push(edge);
      numEdges++;
    }

    int[][] DDVector = new int[numEdges][loopDepth];

    int i = 0;
    while (!wl.empty()) {
      DDEdge edge = wl.pop();
      if (trace) System.out.println("   edge " + edge);

      // Find dependence distance.

      for (int level = 1; level <= loopDepth; level++)
        DDVector[i][level - 1] = edge.getDistance(level);

      if (trace) {
        System.out.print(i);
        System.out.print(" ");
        System.out.println(edge);
      }

      i++;
    }

    WorkArea.<DDEdge>returnStack(wl);

    return DDVector;
  }