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

2005-02-03 Benoît Perrot <benoit@lrde.epita.fr>

	Store an iterator in TextLabels.

	* src/inst/text_label.hh: Do it.
	* src/inst/text_section.hh (define_label): Move its 
	implementation into...
	* src/inst/text_section.cc (define_label): This file, to solve 
	inclusion cycle.
parent de204fcf
2005-02-03 Benot Perrot <benoit@lrde.epita.fr>
Store an iterator in TextLabels.
* src/inst/text_label.hh: Do it.
* src/inst/text_section.hh (define_label): Move its
implementation into...
* src/inst/text_section.cc (define_label): This file, to solve
inclusion cycle.
2005-01-30 Benot Perrot <benoit@lrde.epita.fr>
Prepare iterator in text_label storage.
Prepare iterator in TextLabel storage.
* src/inst/text_section.hh: Maintain an iterator on the very last
instruction slot.
......
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2003, 2004 Benoit Perrot <benoit@lrde.epita.fr>
// Copyright (C) 2003, 2004, 2005 Benoit Perrot <benoit@lrde.epita.fr>
//
// Nolimips is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
......@@ -20,6 +20,7 @@
# define INST_TEXT_LABEL_HH
# include "inst/label.hh"
# include "inst/text_section.hh"
namespace inst
{
......@@ -28,8 +29,9 @@ namespace inst
public Label
{
public:
TextLabel(const std::string &s):
Label(s)
TextLabel(const std::string &s,
TextSection::instruction_list_type::iterator it):
Label(s), it_(it)
{}
public:
......@@ -37,6 +39,14 @@ namespace inst
{
offset_ = offset;
}
TextSection::instruction_list_type::iterator get_iterator() const
{
return it_;
}
protected:
TextSection::instruction_list_type::iterator it_;
};
} // namespace inst
......
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2003, 2004 Benoit Perrot <benoit@lrde.epita.fr>
// Copyright (C) 2003, 2004, 2005 Benoit Perrot <benoit@lrde.epita.fr>
//
// Nolimips is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
......@@ -16,8 +16,9 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#include "inst/text_section.hh"
#include "inst/inst.hh"
#include "inst/text_label.hh"
#include "inst/text_section.hh"
namespace inst
{
......@@ -33,6 +34,16 @@ namespace inst
delete (*it);
}
// --------------------------------------------------------------------------
void
TextSection::define_label(const misc::unique_string &id)
{
TextLabel *label = new TextLabel(id, sentry_);
label->set_offset((insts_.size() - 1) * 4);
Section::register_label(label);
}
// --------------------------------------------------------------------------
// Print operator
// --------------------------------------------------------------------------
......
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2003, 2004 Benoit Perrot <benoit@lrde.epita.fr>
// Copyright (C) 2003, 2004, 2005 Benoit Perrot <benoit@lrde.epita.fr>
//
// Nolimips is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
......@@ -25,12 +25,12 @@
# include "misc/contract.hh"
# include "inst/section.hh"
# include "inst/text_label.hh"
namespace inst
{
class Inst;
class TextLabel;
/// Implement an assembly text (code) section
class TextSection:
......@@ -59,12 +59,7 @@ namespace inst
}
public:
void define_label(const misc::unique_string &id)
{
TextLabel *label = new TextLabel(id);
label->set_offset((insts_.size() - 1) * 4);
Section::register_label(label);
}
void define_label(const misc::unique_string &id);
public:
void add_inst(inst::Inst* inst)
......
Markdown is supported
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