OpenASIP  2.0
OperationDAGSelector.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 OperationDAGSelector.hh
26  *
27  * Declaration of OperationDAGSelector.
28  *
29  * @author Mikael Lepistö 2008 (mikael.lepisto-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_OPERATION_DAG_SELECTOR_HH
34 #define TTA_OPERATION_DAG_SELECTOR_HH
35 
36 #include <string>
37 #include <vector>
38 #include <set>
39 
40 #include "OperationDAG.hh"
41 #include "CIStringSet.hh"
42 #include "TCEString.hh"
43 
44 class Operation;
45 class ImmInfo;
46 
47 /**
48  * Class that search DAGs from operation set.
49  */
51 public:
52 
53  /**
54  * STL Container for returning and finding DAGs.
55  */
56  class OperationDAGList : public std::vector<OperationDAG*> {
57  public:
58 
59  /**
60  * Returns DAG that had least nodes.
61  *
62  * @return DAG that had least nodes.
63  */
65 
66  if (empty()) {
67  return OperationDAG::null;
68  }
69 
70  OperationDAG* leastNodes = *begin();
71 
72  for (std::vector<OperationDAG*>::const_iterator i = begin();
73  i != end(); i++) {
74 
75  if ((*i)->nodeCount() < leastNodes->nodeCount()) {
76  leastNodes = *i;
77  }
78  }
79 
80  return *leastNodes;
81  }
82  };
84  bool operator()(const TCEString& s1, const TCEString& s2) const {
85  return s1.ciEqual(s2);
86  }
87  };
89 
91  const std::string& opName,
92  OperationSet opSet,
93  const ImmInfo* immInfo = nullptr);
94 
96  const Operation& op, OperationSet& opSet);
97 
98 private:
100  virtual ~OperationDAGSelector();
101 
102  static int countUnknownOperations(
103  OperationDAG& dag, OperationSet& opSet);
104 
105 };
106 
107 #endif
OperationDAGSelector::CaseInsensitiveCmp::operator()
bool operator()(const TCEString &s1, const TCEString &s2) const
Definition: OperationDAGSelector.hh:84
OperationDAG::null
static OperationDAG null
Definition: OperationDAG.hh:47
OperationDAGSelector::countUnknownOperations
static int countUnknownOperations(OperationDAG &dag, OperationSet &opSet)
Definition: OperationDAGSelector.cc:130
TCEString.hh
TCEString::ciEqual
bool ciEqual(const TCEString &other) const
Definition: TCEString.cc:63
OperationDAGSelector::findDags
static OperationDAGList findDags(const std::string &opName, OperationSet opSet, const ImmInfo *immInfo=nullptr)
Definition: OperationDAGSelector.cc:57
CIStringSet.hh
OperationDAG.hh
OperationDAG
Definition: OperationDAG.hh:43
OperationDAGSelector::OperationDAGList
Definition: OperationDAGSelector.hh:56
TCETools::CIStringSet
std::set< TCEString, CaseInsensitiveCmp > CIStringSet
Definition: CIStringSet.hh:49
OperationDAGSelector::OperationDAGSelector
OperationDAGSelector()
OperationDAGSelector::OperationSet
TCETools::CIStringSet OperationSet
Definition: OperationDAGSelector.hh:88
Operation
Definition: Operation.hh:59
OperationDAGSelector::OperationDAGList::smallestNodeCount
OperationDAG & smallestNodeCount() const
Definition: OperationDAGSelector.hh:64
TCEString
Definition: TCEString.hh:53
OperationDAGSelector
Definition: OperationDAGSelector.hh:50
ImmInfo
Definition: ImmInfo.hh:82
BoostGraph::nodeCount
int nodeCount() const
OperationDAGSelector::~OperationDAGSelector
virtual ~OperationDAGSelector()
OperationDAGSelector::CaseInsensitiveCmp
Definition: OperationDAGSelector.hh:83
OperationDAGSelector::createExpandedDAG
static OperationDAG * createExpandedDAG(const Operation &op, OperationSet &opSet)
Definition: OperationDAGSelector.cc:164