Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/ppc/instructions/ppcCompInstrExt.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/ppc/instructions/ppcCompInstrExt.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1594 - (view) (download)

1 : jhr 1594 (* ppcCompInstrExt.sml
2 :     *
3 :     * COPYRIGHT (c) 2004 John Reppy (http://www.cs.uchicago.edu/~jhr)
4 :     * All rights reserved.
5 :     *
6 :     * emit code for extensions to the ppc instruction set.
7 :     *)
8 :    
9 :     signature PPCCOMP_INSTR_EXT =
10 :     sig
11 :     structure I : PPCINSTR
12 :     structure TS : MLTREE_STREAM
13 :     where T = I.T
14 :     structure CFG : CONTROL_FLOW_GRAPH
15 :     where I = I
16 :     and P = TS.S.P
17 :    
18 :     type reducer =
19 :     (I.instruction, I.C.cellset, I.operand, I.addressing_mode, CFG.cfg) TS.reducer
20 :    
21 :     val compileSext :
22 :     reducer
23 :     -> {stm: (I.T.stm, I.T.rexp, I.T.fexp, I.T.ccexp) PPCInstrExt.sext,
24 :     an: I.T.an list}
25 :     -> unit
26 :     end
27 :    
28 :     functor PPCCompInstrExt (
29 :    
30 :     structure I : PPCINSTR
31 :     structure TS : MLTREE_STREAM
32 :     where T = I.T
33 :     structure CFG : CONTROL_FLOW_GRAPH
34 :     where P = TS.S.P
35 :     and I = I
36 :    
37 :     ) : PPCCOMP_INSTR_EXT = struct
38 :    
39 :     structure CFG = CFG
40 :     structure T = TS.T
41 :     structure I = I
42 :     structure C = I.C
43 :     structure X = PPCInstrExt
44 :     structure TS = TS
45 :    
46 :     type stm = (T.stm, T.rexp, T.fexp, T.ccexp) X.sext
47 :    
48 :     type reducer =
49 :     (I.instruction, I.C.cellset, I.operand, I.addressing_mode, CFG.cfg) TS.reducer
50 :    
51 :     fun error msg = MLRiscErrorMsg.error("PPCCompInstrExt", msg)
52 :    
53 :     fun compileSext (reducer : reducer) {stm : stm, an : T.an list} = let
54 :     val TS.REDUCER{
55 :     reduceRexp, operand, emit, instrStream, addressOf, ...
56 :     } = reducer
57 :     val TS.S.STREAM{emit=emitI, ...} = instrStream
58 :     fun emit' inst = emit(I.INSTR inst, an)
59 :     in
60 :     case stm
61 :     of X.STWU{src, ea} => let
62 :     val (base, disp) = addressOf ea
63 :     in
64 :     emit' (I.ST{
65 :     st = I.STWU,
66 :     rs = reduceRexp src,
67 :     ra = base,
68 :     d = disp,
69 :     mem = T.Region.memory
70 :     })
71 :     end
72 :     (* end case *)
73 :     end
74 :    
75 :     end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0