## delay-slot-props.api
# Compiled by:
#
src/lib/compiler/back/low/lib/lowhalf.lib# Architectures that require branch delay slots should implement this module
stipulate
package lbl = codelabel; # codelabel is from
src/lib/compiler/back/low/code/codelabel.pkgherein
api Delay_Slot_Properties {
#
package mcf: Machcode_Form; # Machcode_Form is from
src/lib/compiler/back/low/code/machcode-form.api Delay_Slot
= D_NONE # No delay slot
| D_ERROR
# An error
| D_ALWAYS
# One delay slot
| D_TAKEN
# Delay slot is only active when branch is taken
| D_FALLTHRU
# Delay slot is only active when branch is not taken
;
# Size of delay slot in bytes:
#
delay_slot_bytes: Int;
# Return the delay slot properties of an instruction
#
delay_slot
:
{ instruction: mcf::Machine_Op,
backward: Bool
}
->
{ n: Bool, # is the nullified bit on?
n_on: Delay_Slot, # Delay type when nullified
n_off: Delay_Slot, # Delay type when not nullified
nop: Bool # is there a nop padded?
};
# Change the delay slot properties of an instruction
#
enable_delay_slot
:
{ instruction: mcf::Machine_Op,
n: Bool,
nop: Bool
}
->
mcf::Machine_Op;
# Is there any dependency conflict?
#
conflict
:
{ src: mcf::Machine_Op,
dst: mcf::Machine_Op
}
->
Bool;
# Can delay_slot fit within the delay slot of jmp?
#
delay_slot_candidate
:
{ jmp: mcf::Machine_Op,
delay_slot: mcf::Machine_Op
}
->
Bool;
# Change the branch target of an instruction:
#
set_target
:
( mcf::Machine_Op,
lbl::Codelabel
)
->
mcf::Machine_Op;
};
end;