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

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

	Add forward declarations files

	* src/inst/nodes.gen.py: Generate forward declarations in an
	fwd.hh file instead of decl.hh
	* src/inst/nodes.mk.gen.py: Update accordingly.
	* src/parse/fwd.hh: New.
	* src/parse/Makefile.am: Distribute.
	* src/vm/fwd.hh: New.
	* src/vm/Makefile.am: Distribute.
parent b9336511
2006-01-07 Benot Perrot <benoit@lrde.epita.fr>
Add forward declarations files
* src/inst/nodes.gen.py: Generate forward declarations in an
fwd.hh file instead of decl.hh
* src/inst/nodes.mk.gen.py: Update accordingly.
* src/parse/fwd.hh: New.
* src/parse/Makefile.am: Distribute.
* src/vm/fwd.hh: New.
* src/vm/Makefile.am: Distribute.
2006-01-02 Roland Levillain <roland@lrde.epita.fr>
Prepare for Bison 2.2.
......
#!/usr/bin/env python
##
## 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
......@@ -274,26 +274,54 @@ nolimips.lazy_overwrite(srcdir + os.sep + "all.hh", "all.hh.tmp")
os.remove("all.hh.tmp")
## Generate all-declarator
sys.stdout = file("decl.hh.tmp", "w")
sys.stdout = file("fwd.hh.tmp", "w")
print nolimips.license
print "#ifndef INST_DECL_HH"
print "# define INST_DECL_HH"
print """
#ifndef INST_FWD_HH
# define INST_FWD_HH
# include \"misc/select_const.hh\"
namespace inst
{
class Register;
class Label;
class TextLabel;
class Exp;
class IntExp;
class LabelExp;
class OpExp;
template <typename ConstKind>
class GenExpVisitor;
typedef GenExpVisitor<const_kind> ConstExpVisitor;
typedef GenExpVisitor<non_const_kind> ExpVisitor;
class Inst;
"""
for inst in instructions:
if inst.level == "native":
print " class " + nolimips.class_id(inst.opcode) + ";"
print """
class Section;
class TextSection;
class DataSection;
class Program;
class ProgramBuilder;
class ProgramSolver;
} // namespace inst
#endif // !INST_DECL_HH
#endif // !INST_FWD_HH
"""
sys.stdout.close()
sys.stdout = sys.__stdout__
nolimips.lazy_overwrite(srcdir + os.sep + "decl.hh", "decl.hh.tmp")
os.remove("decl.hh.tmp")
nolimips.lazy_overwrite(srcdir + os.sep + "fwd.hh", "fwd.hh.tmp")
os.remove("fwd.hh.tmp")
## Generate visitor
sys.stdout = file("visitor.hh.tmp", "w")
......@@ -303,7 +331,7 @@ print """#ifndef INST_VISITOR_HH
# include \"misc/select_const.hh\"
# include \"inst/decl.hh\"
# include \"inst/fwd.hh\"
namespace inst
{
......
......@@ -36,6 +36,6 @@ for i in range(0, len(instructions)):
for ext in ["hh", "hxx", "cc"]:
line = line + instructions[i].opcode + "." + ext + " "
print line + "\t\t\\"
print """ decl.hh \\
print """ fwd.hh \\
all.hh \\
visitor.hh"""
......@@ -58,6 +58,7 @@ noinst_LTLIBRARIES = libparse.la
libparse_la_CPPFLAGS = -I $(top_srcdir)/src -I $(top_builddir)/src
libparse_la_SOURCES = \
fwd.hh \
asm-parse.cc asm-parse.yy.stamp \
$(FROM_ASM_PARSE_YY) \
asm-scan.ll asm-scan.hh asm-scan.ll.stamp \
......
//
// 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 PARSE_FWD_HH
# define PARSE_FWD_HH
namespace yy
{
class position;
class location;
class parser;
}
#endif // !PARSE_FWD_HH
......@@ -2,6 +2,7 @@ noinst_LTLIBRARIES = libvm.la
libvm_la_CPPFLAGS = -I $(top_srcdir)/lib -I $(top_srcdir)/src -I $(top_builddir)/src
libvm_la_SOURCES = \
fwd.hh \
mmu.hh \
cp0.hh \
cpu.hh cpu.cc \
......
//
// 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 VM_FWD_HH
# define VM_FWD_HH
namespace inst { class Program; }
namespace vm
{
class Cp0;
class Cpu;
class Mmu;
class Memory;
class Segment;
class SystemLibrary;
class NolimipsSystemLibrary;
class SpimSystemLibrary;
class VirtualMachine;
} // namespace vm
#endif // !VM_FWD_HH
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