OpenASIP  2.0
InstructionReferenceImpl.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 InstructionReferenceImpl.hh
26  *
27  * Declaration of InstructionReferenceImpl class.
28  *
29  * This class provides the internal tracking of instruction references to
30  * a single instruction. This class contains information about
31  * all references pointing to this instructions. When the reference count
32  * reaches 0, this class is automatically deleted.
33  *
34  * @author Heikki Kultala 2009 (heikki.kultala-no.spam-tut.fi)
35  * @note rating: red
36  */
37 
38 #ifndef TTA_INSTRUCTION_REFERENCE_IMPL_HH
39 #define TTA_INSTRUCTION_REFERENCE_IMPL_HH
40 
41 #include <set>
42 
43 namespace TTAProgram {
44  class Instruction;
45  class InstructionReference;
46  class InstructionReferenceManager;
47 
49 public:
53 
55  void nullify();
59  void setInstruction(Instruction& ins);
60  void merge(InstructionReferenceImpl& other);
61  inline Instruction& instruction();
62  inline unsigned int count();
63  const InstructionReference& ref();
64 private:
66  std::set<InstructionReference*> refs_;
70 };
71 
73 }
74 #endif
TTAProgram::InstructionReferenceImpl::ref
const InstructionReference & ref()
Definition: InstructionReferenceImpl.cc:161
TTAProgram
Definition: Estimator.hh:65
TTAProgram::InstructionReferenceImpl::setInstruction
void setInstruction(Instruction &ins)
Definition: InstructionReferenceImpl.cc:151
TTAProgram::InstructionReferenceImpl::nullify
void nullify()
Definition: InstructionReferenceImpl.cc:81
TTAProgram::InstructionReferenceImpl::refMan_
InstructionReferenceManager * refMan_
Definition: InstructionReferenceImpl.hh:67
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAProgram::InstructionReferenceImpl::addRef
void addRef(InstructionReference &ref)
Definition: InstructionReferenceImpl.cc:100
TTAProgram::InstructionReferenceImpl::InstructionReferenceImpl
InstructionReferenceImpl()
InstructionReferenceImpl.icc
TTAProgram::InstructionReferenceImpl::referencemanager
InstructionReferenceManager & referencemanager()
TTAProgram::InstructionReferenceImpl::ins_
Instruction * ins_
Definition: InstructionReferenceImpl.hh:65
TTAProgram::InstructionReferenceImpl::instruction
Instruction & instruction()
TTAProgram::InstructionReferenceImpl::refs_
std::set< InstructionReference * > refs_
Definition: InstructionReferenceImpl.hh:66
TTAProgram::InstructionReferenceImpl::~InstructionReferenceImpl
~InstructionReferenceImpl()
Definition: InstructionReferenceImpl.cc:70
TTAProgram::InstructionReferenceManager
Definition: InstructionReferenceManager.hh:82
TTAProgram::InstructionReferenceImpl::removeRef
bool removeRef(InstructionReference &ref)
Definition: InstructionReferenceImpl.cc:114
TTAProgram::InstructionReferenceImpl::merge
void merge(InstructionReferenceImpl &other)
Definition: InstructionReferenceImpl.cc:134
TTAProgram::InstructionReference
Definition: InstructionReference.hh:49
TTAProgram::InstructionReferenceImpl
Definition: InstructionReferenceImpl.hh:48
TTAProgram::InstructionReferenceImpl::count
unsigned int count()