1 // 2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 #include "compiler/depgraph/DependencyGraphOutput.h" 8 outputIndentation()9void TDependencyGraphOutput::outputIndentation() 10 { 11 for (int i = 0; i < getDepth(); ++i) 12 mSink << " "; 13 } 14 visitArgument(TGraphArgument * parameter)15void TDependencyGraphOutput::visitArgument(TGraphArgument* parameter) 16 { 17 outputIndentation(); 18 mSink << "argument " << parameter->getArgumentNumber() << " of call to " 19 << parameter->getIntermFunctionCall()->getName() << "\n"; 20 } 21 visitFunctionCall(TGraphFunctionCall * functionCall)22void TDependencyGraphOutput::visitFunctionCall(TGraphFunctionCall* functionCall) 23 { 24 outputIndentation(); 25 mSink << "function call " << functionCall->getIntermFunctionCall()->getName() << "\n"; 26 } 27 visitSymbol(TGraphSymbol * symbol)28void TDependencyGraphOutput::visitSymbol(TGraphSymbol* symbol) 29 { 30 outputIndentation(); 31 mSink << symbol->getIntermSymbol()->getSymbol() << " (symbol id: " 32 << symbol->getIntermSymbol()->getId() << ")\n"; 33 } 34 visitSelection(TGraphSelection * selection)35void TDependencyGraphOutput::visitSelection(TGraphSelection* selection) 36 { 37 outputIndentation(); 38 mSink << "selection\n"; 39 } 40 visitLoop(TGraphLoop * loop)41void TDependencyGraphOutput::visitLoop(TGraphLoop* loop) 42 { 43 outputIndentation(); 44 mSink << "loop condition\n"; 45 } 46 visitLogicalOp(TGraphLogicalOp * logicalOp)47void TDependencyGraphOutput::visitLogicalOp(TGraphLogicalOp* logicalOp) 48 { 49 outputIndentation(); 50 mSink << "logical " << logicalOp->getOpString() << "\n"; 51 } 52 outputAllSpanningTrees(TDependencyGraph & graph)53void TDependencyGraphOutput::outputAllSpanningTrees(TDependencyGraph& graph) 54 { 55 mSink << "\n"; 56 57 for (TGraphNodeVector::const_iterator iter = graph.begin(); iter != graph.end(); ++iter) 58 { 59 TGraphNode* symbol = *iter; 60 mSink << "--- Dependency graph spanning tree ---\n"; 61 clearVisited(); 62 symbol->traverse(this); 63 mSink << "\n"; 64 } 65 } 66