File: sparcDelaySlots.sml

package info (click to toggle)
mlton 20210117%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,464 kB
  • sloc: ansic: 27,682; sh: 4,455; asm: 3,569; lisp: 2,879; makefile: 2,347; perl: 1,169; python: 191; pascal: 68; javascript: 7
file content (58 lines) | stat: -rw-r--r-- 2,248 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(*
 * This file was automatically generated by MDGen (v3.0)
 * from the machine description file "sparc/sparc.md".
 *)


functor SparcDelaySlots(structure I : SparcINSTR
                        structure P : INSN_PROPERTIES
                           where I = I
                       ) : DELAY_SLOT_PROPERTIES =
struct
   structure I = I
   datatype delay_slot = D_NONE | D_ERROR | D_ALWAYS | D_TAKEN | D_FALLTHRU 
   
   fun error msg = MLRiscErrorMsg.error("SparcDelaySlots",msg)
   fun delaySlot {instr, backward} = let
          fun delaySlot instr = 
              (
               case instr of
               I.Bicc{b, a, label, nop} => {nop=nop, n=a andalso 
               (
                case b of
                I.BA => false
              | _ => true
               ), nOn=D_NONE, nOff=D_ALWAYS}
             | I.FBfcc{b, a, label, nop} => {nop=nop, n=a, nOn=D_NONE, nOff=D_ALWAYS}
             | I.JMP{r, i, labs, nop} => {nop=nop, n=false, nOn=D_NONE, nOff=D_ALWAYS}
             | I.JMPL{r, i, d, defs, uses, nop, mem} => {nop=nop, n=false, nOn=D_NONE, nOff=D_ALWAYS}
             | I.CALL{defs, uses, label, nop, mem} => {nop=nop, n=false, nOn=D_NONE, nOff=D_ALWAYS}
             | I.FCMP{cmp, r1, r2, nop} => {nop=nop, n=false, nOn=D_NONE, nOff=D_ALWAYS}
             | I.RET{leaf, nop} => {nop=nop, n=false, nOn=D_NONE, nOff=D_ALWAYS}
             | _ => {nop=true, n=false, nOn=D_ERROR, nOff=D_NONE}
              )
       in delaySlot instr
       end

   fun enableDelaySlot _ = error "enableDelaySlot"
   fun conflict _ = error "conflict"
   fun delaySlotCandidate {jmp, delaySlot} = let
          fun delaySlotCandidate delaySlot = 
              (
               case delaySlot of
               I.Bicc{b, a, label, nop} => false
             | I.FBfcc{b, a, label, nop} => false
             | I.JMP{r, i, labs, nop} => false
             | I.JMPL{r, i, d, defs, uses, nop, mem} => false
             | I.CALL{defs, uses, label, nop, mem} => false
             | I.Ticc{t, cc, r, i} => false
             | I.FCMP{cmp, r1, r2, nop} => false
             | I.RET{leaf, nop} => false
             | _ => true
              )
       in delaySlotCandidate delaySlot
       end

   fun setTarget _ = error "setTarget"
end