Home | History | Annotate | Download | only in depgraph
      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/translator/depgraph/DependencyGraphOutput.h"
      8 
      9 void TDependencyGraphOutput::outputIndentation()
     10 {
     11     for (int i = 0; i < getDepth(); ++i)
     12         mSink << "  ";
     13 }
     14 
     15 void TDependencyGraphOutput::visitArgument(TGraphArgument* parameter)
     16 {
     17     outputIndentation();
     18     mSink << "argument " << parameter->getArgumentNumber() << " of call to "
     19           << parameter->getIntermFunctionCall()->getName() << "\n";
     20 }
     21 
     22 void TDependencyGraphOutput::visitFunctionCall(TGraphFunctionCall* functionCall)
     23 {
     24     outputIndentation();
     25     mSink << "function call " <<  functionCall->getIntermFunctionCall()->getName() << "\n";
     26 }
     27 
     28 void TDependencyGraphOutput::visitSymbol(TGraphSymbol* symbol)
     29 {
     30     outputIndentation();
     31     mSink << symbol->getIntermSymbol()->getSymbol() << " (symbol id: "
     32           << symbol->getIntermSymbol()->getId() << ")\n";
     33 }
     34 
     35 void TDependencyGraphOutput::visitSelection(TGraphSelection* selection)
     36 {
     37     outputIndentation();
     38     mSink << "selection\n";
     39 }
     40 
     41 void TDependencyGraphOutput::visitLoop(TGraphLoop* loop)
     42 {
     43     outputIndentation();
     44     mSink << "loop condition\n";
     45 }
     46 
     47 void TDependencyGraphOutput::visitLogicalOp(TGraphLogicalOp* logicalOp)
     48 {
     49     outputIndentation();
     50     mSink << "logical " << logicalOp->getOpString() << "\n";
     51 }
     52 
     53 void 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