Commit 9ad5c9c4 authored by Benoit Perrot's avatar Benoit Perrot
Browse files

Fill delay slot of native branch instructions with NOP.

parent 8d90c6dc
2003-07-29 Benot Perrot <benoit@lrde.epita.fr>
* dev/mipsy-builder-gen.py,
* src/parse/libparse.hh, src/parse/libparse.cc,
* src/parse/parse-tasks.hh, src/parse/parse-tasks.cc:
Fill delay slot of native branch instructions with NOP.
* NEWS: Update.
2003-07-29 Benot Perrot <benoit@lrde.epita.fr>
* configure.ac:
......
-*- text -*-
New in 0.3:
New in 0.4:
* --fill-delay-slot: fill delay slot of native branch instructions with NOP.
New in 0.3, 2003-07-29:
* Make option engine support incomplete options.
* --check-callee-save: check that callee save registers are preserved
across a call.
......
......@@ -36,22 +36,26 @@ print """#ifndef INST_PROGRAM_BUILDER_HH
# include \"inst/all.hh\"
# include \"inst/program.hh\"
# include \"vm/cpu.hh\"
namespace inst
{
using namespace inst;
using vm::Cpu;
class ProgramBuilder
{
public:
ProgramBuilder():
_program(0)
ProgramBuilder(bool fill_delay_slot_p = false):
_program(0), fill_delay_slot_p(fill_delay_slot_p)
{
}
public:
void reset()
void reset(bool fill_delay_slot_p = false)
{
this->fill_delay_slot_p = fill_delay_slot_p;
_program = new Program();
}
......@@ -117,6 +121,14 @@ for inst in instructions:
print " {"
call = "* new " + class_id(inst.opcode) + "(" + call + ")"
print " _program->text_section().add_inst (" + call + ");"
if inst.kind == "branch":
print " if (fill_delay_slot_p)"
print " _program->text_section()."
print " add_inst (* new Sll(* new Register(Register::general, " + \
"Cpu::zero), "
print " * new Register(Register::general, " + \
"Cpu::zero), "
print " * new IntExp(0)));"
print " }"
else: # syntax.level == "complex"
......@@ -132,6 +144,7 @@ for inst in instructions:
print """
protected:
Program* _program;
bool fill_delay_slot_p;
};
} // namespace inst
......
......@@ -32,13 +32,16 @@ namespace parse
// Authorize unlimited registers.
bool unlimited_regs_p = false;
// Fill delay slot of native branch instructions with NOP.
bool fill_delay_slot_p = false;
// Parse a MIPS asm file, return the corresponding abstract syntax.
::inst::Program*
parse (const std::string &fname)
{
yy::Parser parser = yy::Parser (trace_parse_p, yy::Location ());
yy::program_builder.reset ();
yy::program_builder.reset(fill_delay_slot_p);
scan_open (fname);
parser.parse ();
......
......@@ -35,6 +35,8 @@ namespace parse
extern bool unlimited_regs_p;
extern bool fill_delay_slot_p;
} // namespace parse
#endif // !PARSE_LIBPARSE_HH
......@@ -48,11 +48,21 @@ namespace parse
trace_parse_p = true;
}
void
fill_delay_slot ()
{
fill_delay_slot_p = true;
}
inst::Program* program = 0;
void
parse ()
{
assertion (filename != NULL);
if (filename == NULL)
{
std::cerr << "You must specify an input file." << std::endl;
exit (exit_failure);
}
program = ::parse::parse(filename);
if (!program)
......
......@@ -39,6 +39,9 @@ namespace parse
TASK_DECLARE ("trace-parse", "Trace the parse",
trace_parse, "");
TASK_DECLARE ("fill-delay-slot",
"Fill delay slot of native branch instructions with NOP",
fill_delay_slot, "");
TASK_DECLARE ("parse", "Parse a file",
parse, "");
......
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