OpenASIP
2.0
src
base
osal
OperationPool.cc
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 OperationPool.cc
26
*
27
* Definition of OperationPool class.
28
*
29
* @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30
* @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
31
* @author Miakel Lepistö 2007 (mikael.lepisto-no.spam-tut.fi)
32
* @note rating: yellow
33
* @note reviewed 19 August 2004 by pj, jn, ao, ac
34
*/
35
36
#include <string>
37
#include <vector>
38
39
#include "
OperationPool.hh
"
40
#include "
OperationModule.hh
"
41
#include "
Operation.hh
"
42
#include "
OperationBehaviorProxy.hh
"
43
#include "
OperationDAGBehavior.hh
"
44
#include "
OperationBehaviorLoader.hh
"
45
#include "
Environment.hh
"
46
#include "
FileSystem.hh
"
47
#include "
Application.hh
"
48
#include "
AssocTools.hh
"
49
#include "
SequenceTools.hh
"
50
#include "
StringTools.hh
"
51
#include "
Application.hh
"
52
#include "
OperationIndex.hh
"
53
#include "
OperationPoolPimpl.hh
"
54
55
using
std::string;
56
using
std::vector;
57
58
59
/**
60
* Constructor.
61
*
62
* Records the search paths of the operation modules.
63
*/
64
OperationPool::OperationPool
() : pimpl_(new
OperationPoolPimpl
()) {
65
}
66
67
/**
68
* Destructor.
69
*
70
* Cleans proxies and operations.
71
*/
72
OperationPool::~OperationPool
() {
73
delete
pimpl_
;
74
pimpl_
= NULL;
75
}
76
77
/**
78
* Cleans up the static Operation cache.
79
*
80
* Deletes also the Operation instances, so be sure you are not using
81
* them after calling this!
82
*/
83
void
84
OperationPool::cleanupCache
() {
85
OperationPoolPimpl::cleanupCache
();
86
}
87
88
89
/**
90
* Looks up an operation identified by its name and returns a reference to it.
91
*
92
* The first found operation is returned. If operation is not found, a null
93
* operation is returned.
94
*
95
* @param name The name of the operation.
96
* @return The wanted operation.
97
*/
98
Operation
&
99
OperationPool::operation
(
const
char
* name) {
100
return
pimpl_
->
operation
(name);
101
}
102
103
/**
104
* Returns the operation index of operation pool.
105
*
106
* @return The operation index.
107
*/
108
OperationIndex
&
109
OperationPool::index
() {
110
return
pimpl_
->
index
();
111
}
112
113
/**
114
* Checks globally from all the loaded operations whether
115
* the given operation shares state with any of them.
116
*
117
* In case another operation affects this operation or
118
* vice-versa, they are assumed to share state. The
119
* shares-property has to be in only one of the operation's
120
* description.
121
*/
122
bool
123
OperationPool::sharesState
(
const
Operation
& op) {
124
return
pimpl_
->
sharesState
(op);
125
}
126
127
/**
128
* Used to force loading of OSAL data straight from LLVM backend data
129
* instead of the .opp XML files.
130
*/
131
void
132
OperationPool::setLLVMTargetInstrInfo
(
const
llvm::MCInstrInfo* tid) {
133
OperationPoolPimpl::setLLVMTargetInstrInfo
(tid);
134
}
OperationPool::OperationPool
OperationPool()
Definition:
OperationPool.cc:64
OperationBehaviorProxy.hh
OperationPoolPimpl::index
OperationIndex & index()
Definition:
OperationPoolPimpl.cc:213
OperationPool::operation
Operation & operation(const char *name)
Definition:
OperationPool.cc:99
FileSystem.hh
OperationDAGBehavior.hh
OperationPoolPimpl::cleanupCache
static void cleanupCache()
Definition:
OperationPoolPimpl.cc:100
SequenceTools.hh
OperationPool::index
OperationIndex & index()
Definition:
OperationPool.cc:109
OperationBehaviorLoader.hh
StringTools.hh
OperationPoolPimpl::sharesState
bool sharesState(const Operation &op)
Definition:
OperationPoolPimpl.cc:219
OperationPool::~OperationPool
virtual ~OperationPool()
Definition:
OperationPool.cc:72
OperationPool::setLLVMTargetInstrInfo
static void setLLVMTargetInstrInfo(const llvm::MCInstrInfo *tid)
Definition:
OperationPool.cc:132
OperationPool::cleanupCache
static void cleanupCache()
Definition:
OperationPool.cc:84
OperationPool::sharesState
bool sharesState(const Operation &op)
Definition:
OperationPool.cc:123
OperationIndex.hh
Application.hh
OperationPoolPimpl::setLLVMTargetInstrInfo
static void setLLVMTargetInstrInfo(const llvm::MCInstrInfo *tid)
Definition:
OperationPoolPimpl.hh:64
OperationPoolPimpl
Definition:
OperationPoolPimpl.hh:53
Operation.hh
Environment.hh
Operation
Definition:
Operation.hh:59
OperationPoolPimpl::operation
Operation & operation(const char *name)
Definition:
OperationPoolPimpl.cc:116
OperationPoolPimpl.hh
AssocTools.hh
OperationPool::pimpl_
OperationPoolPimpl * pimpl_
Private implementation in a separate source file.
Definition:
OperationPool.hh:71
OperationIndex
Definition:
OperationIndex.hh:58
OperationPool.hh
OperationModule.hh
Generated by
1.8.17