Commit 883f5fac authored by Benoit Perrot's avatar Benoit Perrot
Browse files

2006-01-08 Benoît Perrot <benoit@lrde.epita.fr>

	Move inline implementations from .hh files to .hxx

	* src/inst/register.hh,
	* src/inst/label.hh,
	* src/inst/text_label.hh,
	* src/inst/exp.hh,
	* src/inst/int_exp.hh,
	* src/inst/label_exp.hh,
	* src/inst/op_exp.hh,
	* src/inst/inst.hh,
	* src/inst/section.hh,
	* src/inst/data_section.hh,
	* src/inst/text_section.hh,
	* src/inst/program.hh,
	* src/inst/program_builder.hh.gen.py,
	* src/inst/program_solver.gen.py,
	* src/vm/cp0.hh,
	* src/vm/cpu.hh,
	* src/vm/mmu.hh,
	* src/vm/memory.hh,
	* src/vm/segment.hh,
	* src/vm/system_library.hh,
	* src/vm/spim_system_library.hh,
	* src/vm/nolimips_system_library.hh,
	* src/vm/virtual_machine.hh,
	* src/shell/cmd.hh,
	* src/shell/shell.hh,
	* src/task/task.hh,
	* src/task/task_register.hh:
	Split into...
	* src/inst/register.hxx,
	* src/inst/label.hxx, src/inst/label.cc,
	* src/inst/text_label.hxx, src/inst/text_label.cc,	
	* src/inst/exp.hxx, src/inst/exp.cc,
	* src/inst/int_exp.hxx, src/inst/int_exp.cc,
	* src/inst/label_exp.hxx, src/inst/label_exp.cc,
	* src/inst/op_exp.hxx, src/inst/op_exp.cc,
	* src/inst/inst.hxx, src/inst/inst.cc,
	* src/inst/section.hxx, src/inst/section.cc,	
	* src/inst/data_section.hxx, src/inst/data_section.cc,
	* src/inst/text_section.hxx, src/inst/text_section.cc,
	* src/inst/program.hxx,
	* src/inst/program_builder.hxx,
	* src/inst/program_solver.hxx,
	* src/vm/cp0.hxx,
	* src/vm/cpu.hxx, src/vm/cpu.cc,
	* src/vm/mmu.hxx,
	* src/vm/memory.hxx,
	* src/vm/segment.hxx,
	* src/vm/system_library.hxx, src/vm/system_library.cc,
	* src/vm/spim_system_library.hxx, src/vm/spim_system_library.cc,
	* src/vm/nolimips_system_library.hxx, src/vm/nolimips_system_library.cc,
	* src/vm/virtual_machine.hxx, src/vm/virtual_machine.cc,
	* src/shell/cmd.hxx,
	* src/shell/shell.hxx, src/shell/shell.cc,
	* src/task/task.hxx, src/task/task.cc,
	* src/task/task_register.hxx, src/task/task_register.cc:
	... These files, respectively.
	* src/inst/Makefile.am,
	* src/shell/Makefile.am,
	* src/task/Makefile.am,
	* src/vm/Makefile.am:
	Update accordingly.

	* src/inst/exp-visitor.hh:
	Use fwd.hh
	* src/task-tasks.cc, src/nolimips-tasks.cc:
	Include task_register.hh
	* src/task/boolean_task.hh,
	* src/task/function_task.hh,
	* src/task/int_task.hh,
	* src/task/string_task.hh:
	Homogeneize coding style.
parent 315c946f
2006-01-08 Benot Perrot <benoit@lrde.epita.fr>
Move inline implementations from .hh files to .hxx
* src/inst/register.hh,
* src/inst/label.hh,
* src/inst/text_label.hh,
* src/inst/exp.hh,
* src/inst/int_exp.hh,
* src/inst/label_exp.hh,
* src/inst/op_exp.hh,
* src/inst/inst.hh,
* src/inst/section.hh,
* src/inst/data_section.hh,
* src/inst/text_section.hh,
* src/inst/program.hh,
* src/inst/program_builder.hh.gen.py,
* src/inst/program_solver.gen.py,
* src/vm/cp0.hh,
* src/vm/cpu.hh,
* src/vm/mmu.hh,
* src/vm/memory.hh,
* src/vm/segment.hh,
* src/vm/system_library.hh,
* src/vm/spim_system_library.hh,
* src/vm/nolimips_system_library.hh,
* src/vm/virtual_machine.hh,
* src/shell/cmd.hh,
* src/shell/shell.hh,
* src/task/task.hh,
* src/task/task_register.hh:
Split into...
* src/inst/register.hxx,
* src/inst/label.hxx, src/inst/label.cc,
* src/inst/text_label.hxx, src/inst/text_label.cc,
* src/inst/exp.hxx, src/inst/exp.cc,
* src/inst/int_exp.hxx, src/inst/int_exp.cc,
* src/inst/label_exp.hxx, src/inst/label_exp.cc,
* src/inst/op_exp.hxx, src/inst/op_exp.cc,
* src/inst/inst.hxx, src/inst/inst.cc,
* src/inst/section.hxx, src/inst/section.cc,
* src/inst/data_section.hxx, src/inst/data_section.cc,
* src/inst/text_section.hxx, src/inst/text_section.cc,
* src/inst/program.hxx,
* src/inst/program_builder.hxx,
* src/inst/program_solver.hxx,
* src/vm/cp0.hxx,
* src/vm/cpu.hxx, src/vm/cpu.cc,
* src/vm/mmu.hxx,
* src/vm/memory.hxx,
* src/vm/segment.hxx,
* src/vm/system_library.hxx, src/vm/system_library.cc,
* src/vm/spim_system_library.hxx, src/vm/spim_system_library.cc,
* src/vm/nolimips_system_library.hxx, src/vm/nolimips_system_library.cc,
* src/vm/virtual_machine.hxx, src/vm/virtual_machine.cc,
* src/shell/cmd.hxx,
* src/shell/shell.hxx, src/shell/shell.cc,
* src/task/task.hxx, src/task/task.cc,
* src/task/task_register.hxx, src/task/task_register.cc:
... These files, respectively.
* src/inst/Makefile.am,
* src/shell/Makefile.am,
* src/task/Makefile.am,
* src/vm/Makefile.am:
Update accordingly.
* src/inst/exp-visitor.hh:
Use fwd.hh
* src/task-tasks.cc, src/nolimips-tasks.cc:
Include task_register.hh
* src/task/boolean_task.hh,
* src/task/function_task.hh,
* src/task/int_task.hh,
* src/task/string_task.hh:
Homogeneize coding style.
2006-01-07 Benot Perrot <benoit@lrde.epita.fr>
Print a generated-file warning at the beginning of generated
......
......@@ -48,19 +48,20 @@ noinst_LTLIBRARIES = libinst.la
libinst_la_CPPFLAGS = -I $(top_srcdir)/lib -I $(top_srcdir)/src -I $(top_builddir)/src
libinst_la_SOURCES = \
$(FROM_NODES_GEN_PY) nodes.stamp \
register.hh \
exp.hh exp.cc \
int_exp.hh int_exp.cc \
label_exp.hh label_exp.cc \
op_exp.hh op_exp.cc \
register.hh register.hxx \
exp.hh exp.hxx exp.cc \
int_exp.hh int_exp.hxx int_exp.cc \
label_exp.hh label_exp.hxx label_exp.cc \
op_exp.hh op_exp.hxx op_exp.cc \
exp-visitor.hh \
inst.hh \
program.hh \
label.hh label.cc \
text_label.hh \
section.hh section.cc \
text_section.hh text_section.cc \
data_section.hh data_section.cc \
program.hh \
program_builder.hh program_builder.cc program_builder.hh.stamp \
program_solver.hh program_solver.cc program_solver.stamp
inst.hh inst.hxx inst.cc \
label.hh label.hxx label.cc \
text_label.hh text_label.hxx text_label.cc \
section.hh section.hxx section.cc \
text_section.hh text_section.hxx text_section.cc \
data_section.hh data_section.hxx data_section.cc \
program.hh program.hxx \
program_builder.hh program_builder.hxx program_builder.cc \
program_builder.hh.stamp \
program_solver.hh program_solver.hxx program_solver.cc \
program_solver.stamp
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2003, 2004, 2005 Benoit Perrot <benoit@lrde.epita.fr>
// Copyright (C) 2003, 2004, 2005, 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
......@@ -26,7 +26,8 @@ namespace inst
// --------------------------------------------------------------------------
DataSection::~DataSection()
{}
{
}
// --------------------------------------------------------------------------
......@@ -62,13 +63,13 @@ namespace inst
{
ostr << *(*label_it) << ':' << std::endl;
++label_it;
if (label_it != labels_.end())
next_labeled_offset = (*label_it)->get_offset();
else // No more labels
break;
}
ostr << "\t.byte\t0x"
<< std::hex << static_cast<unsigned>(bytes_[i])
<< std::endl;
......
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2003, 2004, 2005 Benoit Perrot <benoit@lrde.epita.fr>
// Copyright (C) 2003, 2004, 2005, 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
......@@ -19,70 +19,42 @@
#ifndef INST_DATA_SECTION_HH
# define INST_DATA_SECTION_HH
# include "config.h"
# include <stdint.h>
# include <ostream>
# include <vector>
# include <string>
# include "misc/contract.hh"
# include "misc/unique_string.hh"
# include "inst/section.hh"
# include "inst/fwd.hh"
namespace inst
{
class Label;
/// Abstract an assembly data section
class DataSection:
public Section
{
public:
DataSection(const std::string &name = ".data"):
Section(name)
{}
DataSection(const std::string &name = ".data");
virtual ~DataSection();
public:
int size() const
{
return bytes_.size();
}
int size() const;
public:
bool define_label(const misc::unique_string &id);
public:
void add_space(unsigned space_size)
{
for (unsigned i = 0; i < space_size; ++i)
bytes_.push_back(0);
}
void add_byte(int b)
{
// FIXME: check b in byte range
bytes_.push_back(b);
}
void add_word(int w)
{
unsigned pow = 256 * 256 * 256;
for (int i = 0; i < 4; ++i, pow /= 256)
add_byte(w / pow);
}
public:
int load_byte(unsigned offset) const
{
precondition(offset < bytes_.size());
return (int8_t) bytes_[offset];
}
void add_space(unsigned space_size);
void add_byte(int b);
void add_word(int w);
public:
int load_byte(unsigned offset) const;
public:
virtual void write(std::ostream& ostr) const;
......@@ -95,4 +67,6 @@ namespace inst
} // namespace inst
# include "inst/data_section.hxx"
#endif // !INST_DATA_SECTION_HH
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#ifndef INST_DATA_SECTION_HXX
# define INST_DATA_SECTION_HXX
# include "inst/data_section.hh"
# include "misc/contract.hh"
namespace inst
{
//
inline
DataSection::DataSection(const std::string &name):
Section(name)
{
}
//
inline int
DataSection::size() const
{
return bytes_.size();
}
//
inline void
DataSection::add_space(unsigned space_size)
{
for (unsigned i = 0; i < space_size; ++i)
bytes_.push_back(0);
}
inline void
DataSection::add_byte(int b)
{
// FIXME: check b in byte range
bytes_.push_back(b);
}
inline void
DataSection::add_word(int w)
{
unsigned pow = 256 * 256 * 256;
for (int i = 0; i < 4; ++i, pow /= 256)
add_byte(w / pow);
}
//
inline int
DataSection::load_byte(unsigned offset) const
{
precondition(offset < bytes_.size());
return (int8_t) bytes_[offset];
}
} // namespace inst
#endif // !INST_DATA_SECTION_HXX
//
// 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, 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
......@@ -21,13 +21,11 @@
# include "misc/select_const.hh"
# include "inst/fwd.hh"
namespace inst
{
class IntExp;
class LabelExp;
class OpExp;
template <typename K>
class GenExpVisitor
{
......@@ -37,11 +35,11 @@ namespace inst
}
public:
virtual void visit(typename select_const<K, IntExp>::type&) = 0;
virtual void visit(typename select_const<K, LabelExp>::type&) = 0;
virtual void visit(typename select_const<K, OpExp>::type&) = 0;
virtual void visit(typename select_const<K, IntExp>::type&) = 0;
virtual void visit(typename select_const<K, LabelExp>::type&) = 0;
virtual void visit(typename select_const<K, OpExp>::type&) = 0;
};
typedef GenExpVisitor<const_kind> ConstExpVisitor;
typedef GenExpVisitor<non_const_kind> ExpVisitor;
......
......@@ -6,12 +6,12 @@
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
......
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2003, 2004, 2005 Benoit Perrot <benoit@lrde.epita.fr>
// Copyright (C) 2003, 2004, 2005, 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
......@@ -21,11 +21,10 @@
# include <ostream>
# include "misc/contract.hh"
# include "misc/lockable.hh"
# include "misc/counted_ptr.hh"
# include "inst/exp-visitor.hh"
# include "inst/fwd.hh"
namespace inst
{
......@@ -34,49 +33,35 @@ namespace inst
public misc::lockable
{
protected:
Exp():
immediate_(0)
{}
Exp();
public:
virtual ~Exp();
public:
virtual void write(std::ostream& ostr) const;
virtual void write(std::ostream &ostr) const;
virtual void accept(ConstExpVisitor& v) const = 0;
virtual void accept(ExpVisitor& v) = 0;
virtual void accept(ConstExpVisitor &v) const = 0;
virtual void accept(ExpVisitor &v) = 0;
public:
operator int () const
{
return get_immediate();
}
int get_immediate() const
{
precondition(locked());
return immediate_;
}
void set_immediate(int i)
{
precondition(!locked());
lock();
void set_immediate(int i);
int get_immediate() const;
immediate_ = i;
}
operator int () const;
protected:
int immediate_;
int immediate_;
};
inline std::ostream&
operator<<(std::ostream& ostr, const Exp& e)
{
e.write(ostr);
return ostr;
}
//
std::ostream &
operator<<(std::ostream &ostr, const Exp &e);
//
typedef misc::counted_ptr<Exp> CountedExp;
} // namespace inst
# include "inst/exp.hxx"
#endif // !INST_EXP_HH
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
#ifndef INST_EXP_HXX
# define INST_EXP_HXX
# include "inst/exp.hh"
# include "misc/contract.hh"
namespace inst
{
//
inline
Exp::Exp():
immediate_(0)
{
}
//
inline void
Exp::set_immediate(int i)
{
precondition(!locked());
lock();
immediate_ = i;
}
inline int
Exp::get_immediate() const
{
precondition(locked());
return immediate_;
}
inline
Exp::operator int () const
{
return get_immediate();
}
//
inline std::ostream &
operator<<(std::ostream &ostr, const Exp &e)
{
e.write(ostr);
return ostr;
}
} // namespace inst
#endif // !INST_EXP_HXX
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// 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/inst.hh"
namespace inst
{
Inst::~Inst()
{
}
} // namespace inst
//
// This file is part of Nolimips, a MIPS simulator with unlimited registers
// Copyright (C) 2003, 2004, 2005 Benoit Perrot <benoit@lrde.epita.fr>
// Copyright (C) 2003, 2004, 2005, 2006 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//
// Nolimips is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
......@@ -25,7 +25,7 @@
namespace inst
{