Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Limit access to callee-save and caller-save registers.
* dev/inst-solver-gen.py:
Check use of callee-save and caller-save registers.
* src/inst/inst-tasks.hh, src/inst/inst-tasks.cc:
Add coresponding tasks.
2004-09-19 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/inst/inst-tasks.cc
--- src/inst/inst-tasks.cc (revision 123)
+++ src/inst/inst-tasks.cc (revision 124)
@@ -39,6 +39,8 @@
prg_solve ()
{
inst::ProgramSolver program_solver;
+ program_solver.set_max_callee_save(max_callee_save);
+ program_solver.set_max_caller_save(max_caller_save);
program_solver.solve(* parse::tasks::program);
if (exit_status != exit_success)
exit (exit_status);
Index: src/inst/inst-tasks.hh
--- src/inst/inst-tasks.hh (revision 123)
+++ src/inst/inst-tasks.hh (revision 124)
@@ -37,6 +37,14 @@
"Resolve jump offsets and check bounds of immediates",
prg_solve, "parse");
+ INT_TASK_DECLARE ("callee-save",
+ "Set max number of callee-save registers",
+ max_callee_save, 8, 0, 8,
+ "");
+ INT_TASK_DECLARE ("caller-save",
+ "Set max number of caller-save registers",
+ max_caller_save, 10, 0, 10,
+ "");
} // namespace tasks
} // namespace inst
Index: dev/inst-solver-gen.py
--- dev/inst-solver-gen.py (revision 123)
+++ dev/inst-solver-gen.py (revision 124)
@@ -59,10 +59,24 @@
protected ExpVisitor
{
public:
+ ProgramSolver():
+ program_(0),
+ max_callee_save_(8), max_caller_save_(10)
+ {}
virtual ~ProgramSolver()
{}
public:
+ void set_max_callee_save(int max_callee_save)
+ {
+ max_callee_save_ = max_callee_save;
+ }
+ void set_max_caller_save(int max_caller_save)
+ {
+ max_caller_save_ = max_caller_save;
+ }
+
+ public:
void solve(Program &program)
{
program_ = &program;
@@ -98,6 +112,9 @@
print """
protected:
Program *program_;
+
+ int max_callee_save_;
+ int max_caller_save_;
};
} // namespace inst
@@ -116,6 +133,7 @@
print license
print """#include \"inst/program_solver.hh\"
+#include \"vm/cpu.hh\"
namespace inst
{
@@ -168,7 +186,6 @@
}
}
-
void
ProgramSolver::solve_cpu_register(Register ®) const
{
@@ -176,8 +193,21 @@
{
case Register::generic:
reg.set_kind(Register::general);
- break;
case Register::general:
+ if ((reg.get_index() == vm::Cpu::t9 && max_caller_save_ < 10)
+ || (reg.get_index() == vm::Cpu::t8 && max_caller_save_ < 9)
+ || (vm::Cpu::t0 + max_caller_save_ - 1 < reg.get_index()
+ && reg.get_index() <= vm::Cpu::t7))
+ {
+ std::cerr << \"Caller-save register limited.\" << std::endl;
+ exit_set(exit_solve);
+ }
+ else if (vm::Cpu::s0 + max_callee_save_ - 1 < reg.get_index() &&
+ reg.get_index() <= vm::Cpu::s7)
+ {
+ std::cerr << \"Callee-save register limited.\" << std::endl;
+ exit_set(exit_solve);
+ }
break;
case Register::unlimited:
if (!parse::unlimited_regs_p)
Show replies by date
>> "Benoît" == Benoît Perrot
<benoit(a)lrde.epita.fr> writes:
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Limit access to callee-save and caller-save
registers.
* dev/inst-solver-gen.py:
Check use of callee-save and caller-save registers.
* src/inst/inst-tasks.hh, src/inst/inst-tasks.cc:
Add coresponding tasks.
That's a matter of NEWS!
Akim Demaille <akim(a)epita.fr> writes:
>>
"Benoît" == Benoît Perrot <benoit(a)lrde.epita.fr> writes:
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Limit access to callee-save and caller-save
registers.
* dev/inst-solver-gen.py:
Check use of callee-save and caller-save registers.
* src/inst/inst-tasks.hh, src/inst/inst-tasks.cc:
Add coresponding tasks.
That's a matter of NEWS!
Yeah yeah :)
I thought about it just before and just after commiting ;)
--
Noe