michael@0: // michael@0: // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: #include "compiler/depgraph/DependencyGraphOutput.h" michael@0: michael@0: void TDependencyGraphOutput::outputIndentation() michael@0: { michael@0: for (int i = 0; i < getDepth(); ++i) michael@0: mSink << " "; michael@0: } michael@0: michael@0: void TDependencyGraphOutput::visitArgument(TGraphArgument* parameter) michael@0: { michael@0: outputIndentation(); michael@0: mSink << "argument " << parameter->getArgumentNumber() << " of call to " michael@0: << parameter->getIntermFunctionCall()->getName() << "\n"; michael@0: } michael@0: michael@0: void TDependencyGraphOutput::visitFunctionCall(TGraphFunctionCall* functionCall) michael@0: { michael@0: outputIndentation(); michael@0: mSink << "function call " << functionCall->getIntermFunctionCall()->getName() << "\n"; michael@0: } michael@0: michael@0: void TDependencyGraphOutput::visitSymbol(TGraphSymbol* symbol) michael@0: { michael@0: outputIndentation(); michael@0: mSink << symbol->getIntermSymbol()->getSymbol() << " (symbol id: " michael@0: << symbol->getIntermSymbol()->getId() << ")\n"; michael@0: } michael@0: michael@0: void TDependencyGraphOutput::visitSelection(TGraphSelection* selection) michael@0: { michael@0: outputIndentation(); michael@0: mSink << "selection\n"; michael@0: } michael@0: michael@0: void TDependencyGraphOutput::visitLoop(TGraphLoop* loop) michael@0: { michael@0: outputIndentation(); michael@0: mSink << "loop condition\n"; michael@0: } michael@0: michael@0: void TDependencyGraphOutput::visitLogicalOp(TGraphLogicalOp* logicalOp) michael@0: { michael@0: outputIndentation(); michael@0: mSink << "logical " << logicalOp->getOpString() << "\n"; michael@0: } michael@0: michael@0: void TDependencyGraphOutput::outputAllSpanningTrees(TDependencyGraph& graph) michael@0: { michael@0: mSink << "\n"; michael@0: michael@0: for (TGraphNodeVector::const_iterator iter = graph.begin(); iter != graph.end(); ++iter) michael@0: { michael@0: TGraphNode* symbol = *iter; michael@0: mSink << "--- Dependency graph spanning tree ---\n"; michael@0: clearVisited(); michael@0: symbol->traverse(this); michael@0: mSink << "\n"; michael@0: } michael@0: }