Commit e916ca29 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

2005-07-03 Benoît Perrot <benoit@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.
parent 15962a44
2005-07-03 Benoît Perrot <benoit@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.
2005-04-21 Benoît Perrot <benoit@lrde.epita.fr>
* dec/parse-asm-scan-gen.py: Explicitely dispatch on signed
......
......@@ -67,7 +67,7 @@ namespace inst
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 @@ namespace inst
{
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 @@ print """
int max_callee_save_;
int max_caller_save_;
int max_args_;
};
} // namespace inst
......@@ -221,6 +226,12 @@ namespace inst
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)
......
......@@ -42,6 +42,7 @@ namespace inst
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);
......
......@@ -45,6 +45,10 @@ namespace inst
"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
......
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