Commit 313aa026 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

2006-01-08 Benoît Perrot <benoit@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.
	
parent 883f5fac
2006-01-08 Benot Perrot <benoit@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 Benot Perrot <benoit@lrde.epita.fr>
Move inline implementations from .hh files to .hxx
......
......@@ -18,6 +18,8 @@
//
#include "common.hh"
#include "parse/libparse.hh"
#include "inst/program_solver.hh"
#include "parse-tasks.hh"
......@@ -43,6 +45,7 @@ namespace inst
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);
......
......@@ -65,15 +65,17 @@ namespace inst
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);
protected:
void solve_exp(Exp &exp);
virtual void visit(IntExp &i);
virtual void visit(LabelExp &l);
virtual void visit(OpExp &o);
virtual void visit(IntExp &i);
virtual void visit(LabelExp &l);
virtual void visit(OpExp &o);
protected:
void solve_cpu_register(Register &reg) const;
......@@ -94,6 +96,8 @@ print """
int max_callee_save_;
int max_caller_save_;
int max_args_;
bool unlimited_regs_enabled_;
};
} // namespace inst
......@@ -122,9 +126,6 @@ print """#include \"inst/program_solver.hh\"
#include \"vm/cpu.hh\"
// FIXME: dirty access unlimited registers flag
# include \"parse/libparse.hh\"
namespace inst
{
......@@ -212,7 +213,7 @@ namespace inst
}
break;
case Register::unlimited:
if (!parse::unlimited_regs_p)
if (!unlimited_regs_enabled_)
{
std::cerr << \"Unlimited registers prohibited.\" << std::endl;
exit_set(exit_solve);
......
......@@ -30,7 +30,8 @@ namespace inst
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 @@ namespace inst
max_args_ = max_args;
}
inline void
ProgramSolver::enable_unlimited_regs(bool flag)
{
unlimited_regs_enabled_ = flag;
}
//
inline void
ProgramSolver::solve(Program &program)
......
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