It seems that there is a flaw in the handling of the file nodes.mk, which is not regenerated when nodes.mk.gen.py is touched. I will investigate this... later :P
Index: ChangeLog from 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.
Index: src/vm/Makefile.am --- src/vm/Makefile.am (revision 206) +++ src/vm/Makefile.am (working copy) @@ -2,6 +2,7 @@
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 \ Index: src/vm/fwd.hh --- src/vm/fwd.hh (revision 0) +++ src/vm/fwd.hh (revision 207) @@ -0,0 +1,42 @@ +// +// 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 Index: src/parse/Makefile.am --- src/parse/Makefile.am (revision 206) +++ src/parse/Makefile.am (working copy) @@ -58,6 +58,7 @@
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 \ Index: src/parse/fwd.hh --- src/parse/fwd.hh (revision 0) +++ src/parse/fwd.hh (revision 207) @@ -0,0 +1,30 @@ +// +// 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 Index: src/inst/nodes.gen.py --- src/inst/nodes.gen.py (revision 206) +++ src/inst/nodes.gen.py (working copy) @@ -1,7 +1,7 @@ #!/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 @@ 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 @@
# include "misc/select_const.hh"
-# include "inst/decl.hh" +# include "inst/fwd.hh"
namespace inst { Index: src/inst/nodes.mk.gen.py --- src/inst/nodes.mk.gen.py (revision 206) +++ src/inst/nodes.mk.gen.py (working copy) @@ -36,6 +36,6 @@ 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"""