OpenASIP 2.2
Loading...
Searching...
No Matches
GlobalScope.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 GlobalScope.hh
26 *
27 * Declaration of GlobalScope class.
28 *
29 * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_GLOBAL_SCOPE_HH
34#define TTA_GLOBAL_SCOPE_HH
35
36#include "Scope.hh"
37
38namespace TTAMachine {
39 class AddressSpace;
40}
41
42namespace TTAProgram {
43
44 class Program;
45 class Label;
46
47class GlobalScope : public Scope {
48public:
50 virtual ~GlobalScope();
51
52 virtual bool isGlobal() const;
53
54 int globalCodeLabelCount(Address address) const;
55
56 const CodeLabel& globalCodeLabel(Address address, int index) const;
57
58 int globalCodeLabelCount() const;
59
60 const CodeLabel& globalCodeLabel(int index) const;
61
62 int globalDataLabelCount(Address address) const;
63
64 const DataLabel& globalDataLabel(Address address, int index) const;
65
66 int globalDataLabelCount() const;
67
68 const DataLabel& globalDataLabel(int index) const;
69
70 virtual void removeCodeLabels(InstructionAddress address);
71
72 virtual Scope* copy() const;
73
74 virtual Scope* copyAndRelocate(const TTAProgram::Program& program) const;
75
76 virtual void setDataLabelAddressSpace(
77 const TTAMachine::AddressSpace& space);
78
79protected:
80 virtual void addGlobalCodeLabel(
81 const CodeLabel& codeLabel, const Scope& owner);
82 virtual void addGlobalDataLabel(
83 const DataLabel& codeLabel, const Scope& owner);
84
85private:
86
87 /**
88 * Connects a label and its owner for bookkeeping.
89 */
90 class LabelOwner {
91 public:
92 LabelOwner(const Label& label, const Scope& owner);
94 const Label& label() const;
95 const Scope& scope() const;
96 private:
97 /// The label.
98 const Label* label_;
99 /// The owner scope of the label.
100 const Scope* owner_;
101 };
102
103 /// Copying not allowed.
105 /// Assignment not allowed.
107
108 /// List for LabelOwners.
109 typedef std::vector<LabelOwner*> LabelOwnerList;
110
111 /// Container for all code labels contained in the global scope and its
112 /// child scopes.
114 /// Container for all data labels.
116};
117
118}
119
120#endif
UInt32 InstructionAddress
Definition BaseType.hh:175
find Finds info of the inner loops in the program
const Scope * owner_
The owner scope of the label.
const Label * label_
The label.
virtual void addGlobalCodeLabel(const CodeLabel &codeLabel, const Scope &owner)
virtual void setDataLabelAddressSpace(const TTAMachine::AddressSpace &space)
const DataLabel & globalDataLabel(Address address, int index) const
int globalCodeLabelCount() const
LabelOwnerList allCodeLabels_
Container for all code labels contained in the global scope and its child scopes.
GlobalScope(const GlobalScope &)
Copying not allowed.
virtual Scope * copyAndRelocate(const TTAProgram::Program &program) const
std::vector< LabelOwner * > LabelOwnerList
List for LabelOwners.
virtual void removeCodeLabels(InstructionAddress address)
const CodeLabel & globalCodeLabel(Address address, int index) const
virtual bool isGlobal() const
LabelOwnerList allDataLabels_
Container for all data labels.
virtual Scope * copy() const
int globalDataLabelCount() const
virtual void addGlobalDataLabel(const DataLabel &codeLabel, const Scope &owner)
GlobalScope & operator=(const GlobalScope &)
Assignment not allowed.
const CodeLabel & codeLabel(const std::string &name) const
Definition Scope.cc:233