Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Remove dirty access to libparse internal
* src/inst/program_solver.gen.py, src/inst/program_solver.hxx:
Replace dirty access to libparse internal by an internal flag.
* src/inst-tasks.cc:
Use it.
2006-01-08 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/inst-tasks.cc
--- src/inst-tasks.cc (revision 209)
+++ src/inst-tasks.cc (working copy)
@@ -18,6 +18,8 @@
//
#include "common.hh"
+#include "parse/libparse.hh"
+
#include "inst/program_solver.hh"
#include "parse-tasks.hh"
@@ -43,6 +45,7 @@
program_solver.set_max_callee_save(max_callee_save);
program_solver.set_max_caller_save(max_caller_save);
program_solver.set_max_args(max_args);
+ program_solver.enable_unlimited_regs(parse::unlimited_regs_p);
program_solver.solve(* parse::tasks::program);
if (exit_status != exit_success)
exit (exit_status);
Index: src/inst/program_solver.gen.py
--- src/inst/program_solver.gen.py (revision 209)
+++ src/inst/program_solver.gen.py (working copy)
@@ -65,6 +65,8 @@
void set_max_caller_save(int max_caller_save);
void set_max_args(int max_args);
+ void enable_unlimited_regs(bool flag = true);
+
public:
void solve(Program &program);
@@ -94,6 +96,8 @@
int max_callee_save_;
int max_caller_save_;
int max_args_;
+
+ bool unlimited_regs_enabled_;
};
} // namespace inst
@@ -122,9 +126,6 @@
#include \"vm/cpu.hh\"
-// FIXME: dirty access unlimited registers flag
-# include \"parse/libparse.hh\"
-
namespace inst
{
@@ -212,7 +213,7 @@
}
break;
case Register::unlimited:
- if (!parse::unlimited_regs_p)
+ if (!unlimited_regs_enabled_)
{
std::cerr << \"Unlimited registers prohibited.\" <<
std::endl;
exit_set(exit_solve);
Index: src/inst/program_solver.hxx
--- src/inst/program_solver.hxx (revision 209)
+++ src/inst/program_solver.hxx (working copy)
@@ -30,7 +30,8 @@
inline
ProgramSolver::ProgramSolver():
program_(0),
- max_callee_save_(8), max_caller_save_(10), max_args_(4)
+ max_callee_save_(8), max_caller_save_(10), max_args_(4),
+ unlimited_regs_enabled_(false)
{
}
@@ -51,6 +52,12 @@
max_args_ = max_args;
}
+ inline void
+ ProgramSolver::enable_unlimited_regs(bool flag)
+ {
+ unlimited_regs_enabled_ = flag;
+ }
+
//
inline void
ProgramSolver::solve(Program &program)
Show replies by date