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

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

	Store the instructions in a list to prepare future random insertions.
	
	* src/inst/text_section.hh: Store the instructions in a list 
	instead of a vector to ease random insertions.
	* src/inst/text_section.cc (~TextSection, print): Use TextSection's 
	typedefs and dedicated begin and end to iterate through the  
	instruction container.
	* dev/inst-solver-gen.py: Use operator!= instead of operator< to 
	stop the iteration.
	
parent 58ab9449
2005-01-30 Benot Perrot <benoit@lrde.epita.fr>
Store the instructions in a list to prepare future random insertions.
* src/inst/text_section.hh: Store the instructions in a list
instead of a vector to ease random insertions.
* src/inst/text_section.cc (~TextSection, print): Use TextSection's
typedefs and dedicated begin and end to iterate through the
instruction container.
* dev/inst-solver-gen.py: Use operator!= instead of operator< to
stop the iteration.
2005-01-29 Benot Perrot <benoit@lrde.epita.fr>
Make Label compose its associated offset.
......
......@@ -90,7 +90,7 @@ namespace inst
pc_ = 4;
for (TextSection::instruction_list_type::const_iterator
it = program.text_section().begin();
it < program.text_section().end(); ++it, pc_ += 4)
it != program.text_section().end(); ++it, pc_ += 4)
(*it)->accept(*this);
}
protected:
......
......@@ -28,7 +28,7 @@ namespace inst
TextSection::~TextSection()
{
for (std::vector<inst::Inst*>::iterator
for (instruction_list_type::const_iterator
it = insts_.begin(); it != insts_.end(); ++it)
delete (*it);
}
......@@ -42,7 +42,9 @@ namespace inst
{
ostr << "\t" << name_ << std::endl;
for (unsigned i = 0; i < insts_.size(); ++i)
unsigned i = 0;
for (instruction_list_type::const_iterator
inst_it = begin(); inst_it != end(); ++inst_it, ++i)
{
std::map<int, label_list_type>::const_iterator it =
labels_.find(i * 4);
......@@ -51,7 +53,7 @@ namespace inst
l != (*it).second.end(); ++l)
ostr << *(*l) << ':' << std::endl;
ostr << '\t' << *(insts_[i]) << std::endl;
ostr << '\t' << (*inst_it) << std::endl;
}
}
......
......@@ -37,7 +37,7 @@ namespace inst
public Section
{
public:
typedef std::vector<inst::Inst*> instruction_list_type;
typedef std::list<inst::Inst*> instruction_list_type;
public:
TextSection(const std::string &name = ".text"):
......
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