OpenASIP  2.0
LineNumSection.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 LineNumSection.cc
26  *
27  * Non-inline definitions of LineNumSection class.
28  *
29  * @author Mikael Lepistö 2003 (tmlepist-no.spam-cs.tut.fi)
30  *
31  * @note rating: yellow
32  */
33 
34 #include "LineNumSection.hh"
35 
36 namespace TPEF {
37 
38 using ReferenceManager::SafePointer;
39 
40 LineNumSection LineNumSection::proto_(true);
41 
42 /**
43  * Constructor.
44  *
45  * @param init True if instance should register itself to base class.
46  */
48  codeSection_(&SafePointer::null) {
49 
50  if (init) {
52  }
53 
55  unsetFlagVLen();
57 }
58 
59 /**
60  * Destructor.
61  */
63 }
64 
65 /**
66  * Returns section's type.
67  *
68  * @return Type of section.
69  */
72  return ST_LINENO;
73 }
74 
75 /**
76  * Creates an instance of section.
77  *
78  * @return Newly created section.
79  */
80 Section*
82  return new LineNumSection(false);
83 }
84 
85 /**
86  * Sets text section which instructions are referred in this section.
87  *
88  * @param Section to set.
89  */
90 void
92  const ReferenceManager::SafePointer* codeSect) {
93  codeSection_ = codeSect;
94 }
95 
96 /**
97  * Sets text section which instructions are referred in this section.
98  *
99  * @param Section to set.
100  */
101 void
104 }
105 
106 /**
107  * Returns text section which lines are stored in this section.
108  *
109  * @return Text section which lines are stored in this section.
110  */
113  return dynamic_cast<CodeSection*>(codeSection_->pointer());
114 }
115 
116 }
TPEF::ReferenceManager::SafePointer::replaceReference
static const SafePointer * replaceReference(const SafePointer *old, SafePointable *obj)
TPEF::LineNumSection::codeSection_
const ReferenceManager::SafePointer * codeSection_
Stores text section which we refer with lines.
Definition: LineNumSection.hh:63
TPEF::LineNumSection::type
virtual SectionType type() const
Definition: LineNumSection.cc:71
TPEF::Section::unsetFlagVLen
void unsetFlagVLen()
TPEF::LineNumSection::~LineNumSection
virtual ~LineNumSection()
Definition: LineNumSection.cc:62
TPEF::LineNumSection::codeSection
CodeSection * codeSection() const
Definition: LineNumSection.cc:112
LineNumSection.hh
TPEF::Section
Definition: Section.hh:64
TPEF::ReferenceManager::SafePointer
Definition: SafePointer.hh:188
TPEF::LineNumSection::LineNumSection
LineNumSection(bool init)
Definition: LineNumSection.cc:47
TPEF::ReferenceManager::SafePointer::pointer
SafePointable * pointer() const
TPEF::LineNumSection::setCodeSection
void setCodeSection(const ReferenceManager::SafePointer *codeSect)
Definition: LineNumSection.cc:91
TPEF::CodeSection
Definition: CodeSection.hh:44
TPEF::Section::unsetFlagNoBits
void unsetFlagNoBits()
TPEF::Section::setStartingAddress
void setStartingAddress(AddressImage address)
TPEF::Section::registerSection
static void registerSection(const Section *section)
Definition: Section.cc:114
TPEF::Section::ST_LINENO
@ ST_LINENO
Line number section.
Definition: Section.hh:75
TPEF::LineNumSection::clone
virtual Section * clone() const
Definition: LineNumSection.cc:81
TPEF::Section::SectionType
SectionType
Definition: Section.hh:69
TPEF::LineNumSection::proto_
static LineNumSection proto_
Protorype instance of section.
Definition: LineNumSection.hh:65
TPEF
Definition: Assembler.hh:43