@Override public LoopVertex getClone() { return new LoopVertex(this); }
@Override public LoopVertex getClone() { return new LoopVertex(this); }
/** * @param compositeTransform composite transform. */ void enterCompositeTransform(final TransformHierarchy.Node compositeTransform) { if (compositeTransform.getTransform() instanceof LoopCompositeTransform) { final LoopVertex loopVertex = new LoopVertex(compositeTransform.getFullName()); builder.addVertex(loopVertex, loopVertexStack); builder.removeVertex(loopVertex); loopVertexStack.push(new LoopVertex(compositeTransform.getFullName())); } }
/** * Merge the list of loopVertices into a single LoopVertex. * @param loopVertices list of LoopVertices to merge. * @return the merged single LoopVertex. */ private LoopVertex mergeLoopVertices(final Set<LoopVertex> loopVertices) { final String newName = String.join("+", loopVertices.stream().map(LoopVertex::getName).collect(Collectors.toList())); final LoopVertex mergedLoopVertex = new LoopVertex(newName); loopVertices.forEach(loopVertex -> { final DAG<IRVertex, IREdge> dagToCopy = loopVertex.getDAG(); dagToCopy.topologicalDo(v -> { mergedLoopVertex.getBuilder().addVertex(v); dagToCopy.getIncomingEdgesOf(v).forEach(mergedLoopVertex.getBuilder()::connectVertices); }); loopVertex.getDagIncomingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addDagIncomingEdge)); loopVertex.getIterativeIncomingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addIterativeIncomingEdge)); loopVertex.getNonIterativeIncomingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addNonIterativeIncomingEdge)); loopVertex.getDagOutgoingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addDagOutgoingEdge)); }); return mergedLoopVertex; } }
/** * Merge the list of loopVertices into a single LoopVertex. * @param loopVertices list of LoopVertices to merge. * @return the merged single LoopVertex. */ private LoopVertex mergeLoopVertices(final Set<LoopVertex> loopVertices) { final String newName = String.join("+", loopVertices.stream().map(LoopVertex::getName).collect(Collectors.toList())); final LoopVertex mergedLoopVertex = new LoopVertex(newName); loopVertices.forEach(loopVertex -> { final DAG<IRVertex, IREdge> dagToCopy = loopVertex.getDAG(); dagToCopy.topologicalDo(v -> { mergedLoopVertex.getBuilder().addVertex(v); dagToCopy.getIncomingEdgesOf(v).forEach(mergedLoopVertex.getBuilder()::connectVertices); }); loopVertex.getDagIncomingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addDagIncomingEdge)); loopVertex.getIterativeIncomingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addIterativeIncomingEdge)); loopVertex.getNonIterativeIncomingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addNonIterativeIncomingEdge)); loopVertex.getDagOutgoingEdges().forEach((v, es) -> es.forEach(mergedLoopVertex::addDagOutgoingEdge)); }); return mergedLoopVertex; }