OpenASIP 2.2
Loading...
Searching...
No Matches
TerminalProgramOperation.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2011 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 TerminalProgramOperation.cc
26 *
27 * Implementation of the TerminalProgramOperation class.
28 *
29 * @author Pekka Jääskeläinen 2011
30 * @note rating: red
31 */
32
34#include "Instruction.hh"
35#include "ProgramOperation.hh"
36#include "MoveNode.hh"
37#include "Move.hh"
38
39using namespace TTAMachine;
40
41namespace TTAProgram {
42
43/**
44 * The constructor.
45 *
46 * @param po The ProgramOperation to track.
47 */
49 std::shared_ptr<ProgramOperation> po) :
51}
52
53/**
54 * Constructs an incomplete TerminalProgramOperation.
55 *
56 * This can be used when a TerminalProgramOperation might point to
57 * an non-existing PO during builing of the program.
58 *
59 * @param label A textual label of the target PO. Should be used later
60 * to find the correct PO.
61 */
66
67
68/**
69 * The destructor.
70 */
73
74/**
75 * Returns the instruction address of the trigger move in the tracked
76 * ProgramOperation.
77 *
78 * Returns 0 in case the target PO is not in a program, thus its address
79 * is not known.
80 */
84 return po_->triggeringMove()->move().parent().address();
85}
86
87bool
89 return isProgramOperationKnown() &&
90 po_->triggeringMove() != NULL &&
91 po_->triggeringMove()->move().isInInstruction() &&
92 po_->triggeringMove()->move().parent().isInProcedure();
93}
94
95/**
96 * Creates an exact copy of the terminal and returns it.
97 */
101 newObj->label_ = this->label_;
102 return newObj;
103}
104
105/**
106 * Checks if terminals are equal.
107 */
108bool
110
111 if (!other.isInstructionAddress()) {
112 return false;
113 }
114 return &dynamic_cast<const TerminalProgramOperation&>(other).po_ ==
115 &this->po_;
116}
117
118}
#define assert(condition)
ProgramOperationPtr po_
The referred PO. The pointer can be copied, e.g. to DDG.
TerminalProgramOperation(TCEString instructionLabel)
virtual bool equals(const Terminal &other) const
virtual bool isInstructionAddress() const
Definition Terminal.cc:87