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

2005-01-30 Benoît Perrot <benoit@lrde.epita.fr>

	Prepare iterator in text_label storage.
	
	* src/inst/text_section.hh: Maintain an iterator on the very last 
	instruction slot.
parent e467fceb
2005-01-30 Benot Perrot <benoit@lrde.epita.fr>
Prepare iterator in text_label storage.
* src/inst/text_section.hh: Maintain an iterator on the very last
instruction slot.
2005-01-30 Benot Perrot <benoit@lrde.epita.fr>
Store the instructions in a list to prepare future random insertions.
......
......@@ -42,7 +42,10 @@ namespace inst
public:
TextSection(const std::string &name = ".text"):
Section(name)
{}
{
insts_.push_back(0);
sentry_ = insts_.begin();
}
virtual ~TextSection();
public:
......@@ -52,21 +55,24 @@ namespace inst
}
instruction_list_type::const_iterator end() const
{
return insts_.end();
return sentry_;
}
public:
void define_label(const misc::unique_string &id)
{
TextLabel *label = new TextLabel(id);
label->set_offset(insts_.size() * 4);
label->set_offset((insts_.size() - 1) * 4);
Section::register_label(label);
}
public:
void add_inst(inst::Inst* inst)
{
insts_.push_back(inst);
(*sentry_) = inst;
insts_.push_back(0);
++sentry_;
}
public:
......@@ -74,6 +80,7 @@ namespace inst
protected:
instruction_list_type insts_;
instruction_list_type::iterator sentry_;
};
} // namespace inst
......
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