Commit d36fa2b8 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Index: ChangeLog

from  Benoît Perrot  <benoit@lrde.epita.fr>

	Name sections.
	
	* src/inst/section: Add name attribute.
	* src/inst/text_section.hh, src/inst/data_section.hh:
	Default it to `.text' for text sections and `.data' for data sections.
	* src/inst/text_section.cc, src/inst/data_section.cc (print):
	Display name.
parent c31d032b
2004-09-26 Benot Perrot <benoit@lrde.epita.fr>
Name sections.
* src/inst/section: Add name attribute.
* src/inst/text_section.hh, src/inst/data_section.hh:
Default it to `.text' for text sections and `.data' for data sections.
* src/inst/text_section.cc, src/inst/data_section.cc (print):
Display name.
2004-09-20 Benot Perrot <benoit@lrde.epita.fr>
* NEWS: Update
......
......@@ -26,8 +26,7 @@ namespace inst
// --------------------------------------------------------------------------
DataSection::~DataSection()
{
}
{}
// --------------------------------------------------------------------------
// Print operator
......@@ -39,7 +38,7 @@ namespace inst
if (size_ == 0)
return;
ostr << "\t.data" << std::endl;
ostr << "\t" << name_ << std::endl;
int i = 0;
while (i < size_)
......
......@@ -33,11 +33,13 @@
namespace inst
{
/// Abstract an assembly data section
class DataSection:
public Section
{
public:
DataSection():
DataSection(const std::string &name = ".data"):
Section(name),
size_(0)
{
std::memset(bytes_, 0, INST_DATA_DATASIZE);
......
......@@ -29,6 +29,7 @@
namespace inst
{
/// Abstract an assembly section
class Section
{
protected:
......@@ -39,12 +40,12 @@ namespace inst
typedef std::map<const Label, int> label_offset_type;
public:
Section()
{
}
/// Construct an abstract section `\a name'
Section(const std::string &name):
name_(name)
{}
virtual ~Section()
{
}
{}
protected:
void add_label(Label *label, int offset)
......@@ -76,6 +77,8 @@ namespace inst
virtual void print(std::ostream& ostr) const = 0;
protected:
std::string name_;
// FIXME: Might be static, to avoid multi-definition of labels.
offset_label_type labels_;
label_offset_type offsets_;
......
......@@ -39,7 +39,8 @@ namespace inst
void
TextSection::print(std::ostream& ostr) const
{
ostr << "\t.text" << std::endl;
ostr << "\t" << name_ << std::endl;
for (unsigned i = 0; i < insts_.size(); ++i)
{
std::map<int, label_list_type>::const_iterator it =
......
......@@ -30,13 +30,14 @@
namespace inst
{
/// Implement an assembly text (code) section
class TextSection:
public Section
{
public:
TextSection()
{
}
TextSection(const std::string &name = ".text"):
Section(name)
{}
virtual ~TextSection();
public:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment