Debian Codegraph @

lib/mlrisc-lib/MLRISC/mltree/instr-gen.sml

raw
1 (*
2 * Generate a linear sequence of instructions
3 *)
4 functor InstrGen
5 (structure I : INSTRUCTIONS
6 structure Stream : INSTRUCTION_STREAM
7 structure CFG : CONTROL_FLOW_GRAPH (* where I = I and P = Stream.P *)
8 where type I.addressing_mode = I.addressing_mode
9 and type I.ea = I.ea
10 and type I.instr = I.instr
11 and type I.instruction = I.instruction
12 and type I.operand = I.operand
13 where type P.Client.pseudo_op = Stream.P.Client.pseudo_op
14 and type P.T.Basis.cond = Stream.P.T.Basis.cond
15 and type P.T.Basis.div_rounding_mode = Stream.P.T.Basis.div_rounding_mode
16 and type P.T.Basis.ext = Stream.P.T.Basis.ext
17 and type P.T.Basis.fcond = Stream.P.T.Basis.fcond
18 and type P.T.Basis.rounding_mode = Stream.P.T.Basis.rounding_mode
19 and type P.T.Constant.const = Stream.P.T.Constant.const
20 and type ('s,'r,'f,'c) P.T.Extension.ccx = ('s,'r,'f,'c) Stream.P.T.Extension.ccx
21 and type ('s,'r,'f,'c) P.T.Extension.fx = ('s,'r,'f,'c) Stream.P.T.Extension.fx
22 and type ('s,'r,'f,'c) P.T.Extension.rx = ('s,'r,'f,'c) Stream.P.T.Extension.rx
23 and type ('s,'r,'f,'c) P.T.Extension.sx = ('s,'r,'f,'c) Stream.P.T.Extension.sx
24 and type P.T.I.div_rounding_mode = Stream.P.T.I.div_rounding_mode
25 and type P.T.Region.region = Stream.P.T.Region.region
26 and type P.T.ccexp = Stream.P.T.ccexp
27 and type P.T.fexp = Stream.P.T.fexp
28 (* and type P.T.labexp = Stream.P.T.labexp *)
29 and type P.T.mlrisc = Stream.P.T.mlrisc
30 and type P.T.oper = Stream.P.T.oper
31 and type P.T.rep = Stream.P.T.rep
32 and type P.T.rexp = Stream.P.T.rexp
33 and type P.T.stm = Stream.P.T.stm
34 ) : INSTR_GEN =
35 struct
36 structure C = I.C
37 structure I = I
38 structure S = Stream
39 structure CFG = CFG
40
41 (* Pretty stupid, eh? *)
42 fun newStream(instrs) =
43 let fun emit i = instrs := i :: !instrs
44 fun can'tUse _ = MLRiscErrorMsg.error("InstrGen","unimplemented")
45 in Stream.STREAM
46 { beginCluster = can'tUse,
47 endCluster = can'tUse,
48 emit = emit,
49 pseudoOp = can'tUse,
50 defineLabel = can'tUse,
51 entryLabel = can'tUse,
52 comment = can'tUse,
53 annotation = can'tUse,
54 getAnnotations = can'tUse,
55 exitBlock = can'tUse
56 }
57 end
58
59 end