OpenASIP  2.0
OperationDAG.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file OperationDAG.hh
26  *
27  * Declaration of operation directed acyclic graph class
28  *
29  * @author Mikael Lepistö 2007 (mikael.lepisto-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_OPERATION_DAG_HH
34 #define TTA_OPERATION_DAG_HH
35 
36 #include "BoostGraph.hh"
37 
38 #include "OperationDAGNode.hh"
39 #include "OperationDAGEdge.hh"
40 
41 class TerminalNode;
42 
43 class OperationDAG :
44  public BoostGraph<OperationDAGNode, OperationDAGEdge> {
45 
46 public:
47  static OperationDAG null;
48  bool isNull() const { return this == &null; }
49 
50  OperationDAG();
51  OperationDAG(const class OperationPimpl& op);
52  OperationDAG(const OperationDAG& other);
53  virtual ~OperationDAG();
54  bool isTrivial() const;
55 
56  int stepsToRoot(const OperationDAGNode& node) const;
57  const OperationDAG::NodeSet& endNodes() const;
58 
59  const class OperationPimpl& operation() const { assert(op_ != nullptr); return *op_; }
60  void setOperation(const class OperationPimpl& op) { op_ = &op; }
61 private:
62  const class OperationPimpl* op_;
63 
64  /// Map of known step counts, if dag is changed this must be cleared.
65  mutable std::map<const OperationDAGNode*, int,
67  /// Set of root nodes of DAG, must be cleared if dag is changed.
69 
70 };
71 
72 #endif
OperationDAGNode.hh
OperationDAG::isNull
bool isNull() const
Definition: OperationDAG.hh:48
BoostGraph< OperationDAGNode, OperationDAGEdge >::node
Node & node(const int index) const
OperationPimpl
Definition: OperationPimpl.hh:54
BoostGraph< OperationDAGNode, OperationDAGEdge >::NodeSet
std::set< OperationDAGNode *, typename OperationDAGNode ::Comparator > NodeSet
Definition: BoostGraph.hh:86
BoostGraph.hh
TerminalNode
Definition: TerminalNode.hh:47
OperationDAG::endNodes
const OperationDAG::NodeSet & endNodes() const
Definition: OperationDAG.cc:137
assert
#define assert(condition)
Definition: Application.hh:86
OperationDAG::OperationDAG
OperationDAG()
Definition: OperationDAG.cc:43
OperationDAGEdge.hh
OperationDAG::setOperation
void setOperation(const class OperationPimpl &op)
Definition: OperationDAG.hh:60
OperationDAGNode
Definition: OperationDAGNode.hh:45
OperationDAG::op_
const class OperationPimpl * op_
Definition: OperationDAG.hh:62
OperationDAG
Definition: OperationDAG.hh:43
GraphNode::Comparator
Definition: GraphNode.hh:56
OperationDAG::isTrivial
bool isTrivial() const
Definition: OperationDAG.cc:72
OperationDAG::~OperationDAG
virtual ~OperationDAG()
Definition: OperationDAG.cc:91
OperationDAG::stepMap_
std::map< const OperationDAGNode *, int, OperationDAGNode::Comparator > stepMap_
Map of known step counts, if dag is changed this must be cleared.
Definition: OperationDAG.hh:66
OperationDAG::stepsToRoot
int stepsToRoot(const OperationDAGNode &node) const
Definition: OperationDAG.cc:108
BoostGraph
Definition: BoostGraph.hh:83
OperationDAG::operation
const class OperationPimpl & operation() const
Definition: OperationDAG.hh:59
OperationDAG::endNodes_
OperationDAG::NodeSet endNodes_
Set of root nodes of DAG, must be cleared if dag is changed.
Definition: OperationDAG.hh:68