| 1 |
(* |
| 2 |
* Architectures that require branch delay slots should implement this module |
| 3 |
* |
| 4 |
*) |
| 5 |
signature DELAY_SLOT_PROPERTIES = |
| 6 |
sig |
| 7 |
structure I : INSTRUCTIONS |
| 8 |
|
| 9 |
datatype delay_slot = |
| 10 |
D_NONE (* no delay slot *) |
| 11 |
| D_ERROR (* an error *) |
| 12 |
| D_ALWAYS (* one delay slot *) |
| 13 |
| D_TAKEN (* delay slot is only active when branch is taken *) |
| 14 |
| D_FALLTHRU (* delay slot is only active when branch is not taken *) |
| 15 |
|
| 16 |
(* size of delay slot in bytes *) |
| 17 |
val delaySlotSize : int |
| 18 |
|
| 19 |
(* Return the delay slot properties of an instruction *) |
| 20 |
val delaySlot : { instr : I.instruction, backward : bool } -> |
| 21 |
{ n : bool, (* is the nullified bit on? *) |
| 22 |
nOn : delay_slot, (* delay type when nullified *) |
| 23 |
nOff : delay_slot, (* delay type when not nullified *) |
| 24 |
nop : bool (* is there a nop padded? *) |
| 25 |
} |
| 26 |
|
| 27 |
(* Change the delay slot properties of an instruction *) |
| 28 |
val enableDelaySlot : |
| 29 |
{instr : I.instruction, n:bool, nop:bool} -> I.instruction |
| 30 |
|
| 31 |
(* is there any dependency conflict? *) |
| 32 |
val conflict : {src:I.instruction,dst:I.instruction} -> bool |
| 33 |
|
| 34 |
(* can delaySlot fit within the delay slot of jmp? *) |
| 35 |
val delaySlotCandidate : |
| 36 |
{ jmp : I.instruction, delaySlot : I.instruction } -> bool |
| 37 |
|
| 38 |
(* change the branch target of an instruction *) |
| 39 |
val setTarget : I.instruction * Label.label -> I.instruction |
| 40 |
|
| 41 |
end |
| 42 |
|