OpenASIP  2.0
Procedure.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 Procedure.hh
26  *
27  * Declaration of Procedure class.
28  *
29  * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_PROCEDURE_HH
34 #define TTA_PROCEDURE_HH
35 
36 #include <vector>
37 
38 #include "TCEString.hh"
39 #include "Exception.hh"
40 #include "Address.hh"
41 #include "CodeSnippet.hh"
42 #include "Application.hh"
43 
44 class TCEString;
45 
46 namespace TTAProgram {
47 
48 class Instruction;
49 class Program;
50 
51 
52 /**
53  * Represents a TTA procedure.
54  */
55 class Procedure : public CodeSnippet {
56 public:
57  Procedure(
58  const TCEString& name,
59  const TTAMachine::AddressSpace& space);
60  Procedure(
61  const TCEString& name,
62  const TTAMachine::AddressSpace& space,
63  UIntWord startLocation);
64  virtual ~Procedure();
65 
66  TCEString name() const { return name_; }
67 
68  int alignment() const;
69 
70  Address address(const Instruction& ins) const;
71 
72  void
74  abortWithError("Not Implemented yet.");
75  }
76 
77  void add(Instruction* ins);
78  void insertAfter(const Instruction& pos, Instruction* ins);
79  void insertBefore(const Instruction& pos, Instruction* ins);
80 
81  void clear();
82 
85 
86  void remove(Instruction& ins);
87 
88  CodeSnippet* copy() const;
89 
90 private:
91  /// Copying not allowed.
92  Procedure(const Procedure&);
93  /// Assignment not allowed.
94  Procedure& operator=(const Procedure&);
95 
96  /// The name of the procedure.
98  /// The alignment of instructions.
100  /// The default alignment of instructions.
101  static const int INSTRUCTION_INDEX_ALIGNMENT;
102 };
103 
104 #include "Procedure.icc"
105 
106 }
107 
108 #endif
TTAProgram
Definition: Estimator.hh:65
UIntWord
Word UIntWord
Definition: BaseType.hh:144
TTAProgram::Address
Definition: Address.hh:51
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
TTAProgram::Procedure::remove
void remove(Instruction &ins)
Definition: Procedure.cc:297
Exception.hh
TTAProgram::CodeSnippet::insertBefore
virtual void insertBefore(const Instruction &pos, Instruction *ins)
Definition: CodeSnippet.cc:514
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAProgram::Procedure::address
Address address(const Instruction &ins) const
Definition: Procedure.cc:101
TTAProgram::Procedure::insertAfter
void insertAfter(const Instruction &pos, Instruction *ins)
Definition: Procedure.cc:193
TTAProgram::Procedure::name_
const TCEString name_
The name of the procedure.
Definition: Procedure.hh:97
TTAProgram::Procedure::copy
CodeSnippet * copy() const
Definition: Procedure.cc:137
TTAProgram::Procedure::alignment_
int alignment_
The alignment of instructions.
Definition: Procedure.hh:99
TCEString.hh
Procedure.icc
TTAProgram::CodeSnippet::insertAfter
virtual void insertAfter(const Instruction &pos, Instruction *ins)
Definition: CodeSnippet.cc:462
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
TTAProgram::Procedure::addFront
void addFront(Instruction *)
Definition: Procedure.hh:73
TTAProgram::Procedure::~Procedure
virtual ~Procedure()
Definition: Procedure.cc:80
Application.hh
TTAProgram::Procedure::clear
void clear()
Definition: Procedure.cc:345
CodeSnippet.hh
TTAProgram::Procedure::insertBefore
void insertBefore(const Instruction &pos, Instruction *ins)
Definition: Procedure.cc:242
TTAProgram::CodeSnippet
Definition: CodeSnippet.hh:59
TTAProgram::Procedure::add
void add(Instruction *ins)
Definition: Procedure.cc:160
TTAProgram::Procedure::INSTRUCTION_INDEX_ALIGNMENT
static const int INSTRUCTION_INDEX_ALIGNMENT
The default alignment of instructions.
Definition: Procedure.hh:101
Address.hh
TCEString
Definition: TCEString.hh:53
TTAProgram::Procedure::Procedure
Procedure(const TCEString &name, const TTAMachine::AddressSpace &space)
Definition: Procedure.cc:59
TTAProgram::Procedure::name
TCEString name() const
Definition: Procedure.hh:66
TTAProgram::Procedure::operator=
Procedure & operator=(const Procedure &)
Assignment not allowed.
TTAProgram::Procedure
Definition: Procedure.hh:55
TTAProgram::Procedure::alignment
int alignment() const
Definition: Procedure.cc:89