https://svn.lrde.epita.fr/svn/nolimips
ChangeLog | 7 +++++++
dev/inst-solver-gen.py | 13 ++++++++++++-
src/inst-tasks.cc | 1 +
src/inst-tasks.hh | 4 ++++
4 files changed, 24 insertions(+), 1 deletion(-)
Index: trunk/ChangeLog
from BenoƮt Perrot <benoit(a)lrde.epita.fr>
Limit access to argument registers.
* dev/inst-solver-gen.py: Check use of argument registers.
* src/inst-tasks.hh, src/inst-tasks.cc: Add corresponding task.
Index: trunk/src/inst-tasks.cc
--- trunk/src/inst-tasks.cc (revision 181)
+++ trunk/src/inst-tasks.cc (revision 182)
@@ -42,6 +42,7 @@
inst::ProgramSolver program_solver;
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.solve(* parse::tasks::program);
if (exit_status != exit_success)
exit (exit_status);
Index: trunk/src/inst-tasks.hh
--- trunk/src/inst-tasks.hh (revision 181)
+++ trunk/src/inst-tasks.hh (revision 182)
@@ -45,6 +45,10 @@
"Set max number of caller-save registers",
max_caller_save, 10, 0, 10,
"");
+ INT_TASK_DECLARE ("args",
+ "Set max number of argument registers",
+ max_args, 4, 0, 4,
+ "");
} // namespace tasks
} // namespace inst
Index: trunk/dev/inst-solver-gen.py
--- trunk/dev/inst-solver-gen.py (revision 181)
+++ trunk/dev/inst-solver-gen.py (revision 182)
@@ -67,7 +67,7 @@
public:
ProgramSolver():
program_(0),
- max_callee_save_(8), max_caller_save_(10)
+ max_callee_save_(8), max_caller_save_(10), max_args_(4)
{}
virtual ~ProgramSolver()
{}
@@ -81,6 +81,10 @@
{
max_caller_save_ = max_caller_save;
}
+ void set_max_args(int max_args)
+ {
+ max_args_ = max_args;
+ }
public:
void solve(Program &program)
@@ -123,6 +127,7 @@
int max_callee_save_;
int max_caller_save_;
+ int max_args_;
};
} // namespace inst
@@ -221,6 +226,12 @@
std::cerr << \"Callee-save register limited.\" << std::endl;
exit_set(exit_solve);
}
+ else if (vm::Cpu::a0 + max_args_ - 1 < reg.get_index() &&
+ reg.get_index() <= vm::Cpu::a3)
+ {
+ std::cerr << \"Argument register limited.\" << std::endl;
+ exit_set(exit_solve);
+ }
break;
case Register::unlimited:
if (!parse::unlimited_regs_p)