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

SCM Repository

[smlnj] Diff of /sml/branches/SMLNJ/src/MLRISC/backpatch/vlBackPatch.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/backpatch/vlBackPatch.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 410, Fri Sep 3 00:25:03 1999 UTC revision 411, Fri Sep 3 00:25:03 1999 UTC
# Line 5  Line 5 
5  signature MC_EMIT = sig  signature MC_EMIT = sig
6    structure I : INSTRUCTIONS    structure I : INSTRUCTIONS
7    
8    val emitInstr : I.instruction * int Intmap.intmap -> Word8Vector.vector    val emitInstr : I.instruction *
9           (I.C.register -> I.C.register) -> Word8Vector.vector
10  end  end
11    
12    
# Line 15  Line 16 
16     structure Props : INSN_PROPERTIES     structure Props : INSN_PROPERTIES
17     structure Emitter : MC_EMIT     structure Emitter : MC_EMIT
18     structure Flowgraph : FLOWGRAPH     structure Flowgraph : FLOWGRAPH
19     structure Asm : EMITTER_NEW     structure Asm : INSTRUCTION_EMITTER
20        sharing Emitter.I = Jumps.I = Flowgraph.I = Props.I = Asm.I) : BBSCHED =        sharing Emitter.I = Jumps.I = Flowgraph.I = Props.I = Asm.I) : BBSCHED =
21  struct  struct
22    structure I = Jumps.I    structure I = Jumps.I
23      structure C = I.C
24    structure F = Flowgraph    structure F = Flowgraph
25    structure P = F.P    structure P = F.P
26    structure W8V = Word8Vector    structure W8V = Word8Vector
# Line 30  Line 32 
32      | LABEL of Label.label * desc      | LABEL of Label.label * desc
33      | NIL      | NIL
34    
35    datatype cluster = CLUSTER of {cluster: desc, regmap: int Intmap.intmap}    datatype cluster = CLUSTER of {cluster: desc, regmap:C.register -> C.register}
36    
37    fun error msg = MLRiscErrorMsg.impossible ("vlBackPatch." ^ msg)    fun error msg = MLRiscErrorMsg.error("vlBackPatch",msg)
38    
39    val clusters = ref ([] : cluster list)    val clusters = ref ([] : cluster list)
40    
41    fun bbsched(F.CLUSTER{blocks, regmap,  ...}) = let    fun bbsched(F.CLUSTER{blocks, regmap,  ...}) = let
42        val regmap = C.lookup regmap
43      fun bytes([], p) = p      fun bytes([], p) = p
44        | bytes([s], p) = BYTES(s, p)        | bytes([s], p) = BYTES(s, p)
45        | bytes(s, p) = BYTES(W8V.concat s, p)        | bytes(s, p) = BYTES(W8V.concat s, p)
# Line 54  Line 57 
57          end          end
58        | f(F.ENTRY _::rest) = f rest        | f(F.ENTRY _::rest) = f rest
59        | f(F.EXIT _::rest) = f rest        | f(F.EXIT _::rest) = f rest
       | f(F.ORDERED blks::rest) = f(blks@rest)  
60        | f [] = NIL        | f [] = NIL
61    in    in
62      clusters :=      clusters :=
# Line 101  Line 103 
103      fun output v =      fun output v =
104        W8V.app (fn v => (CodeString.update(!loc, v); loc:= !loc+1)) v        W8V.app (fn v => (CodeString.update(!loc, v); loc:= !loc+1)) v
105    
106        val Asm.S.STREAM{emit,...} = Asm.makeStream()
107    
108      fun chunk(pos, []) = ()      fun chunk(pos, []) = ()
109        | chunk(pos, CLUSTER{cluster, regmap}::rest) = let        | chunk(pos, CLUSTER{cluster, regmap}::rest) = let
110            fun outputInstr i = output (Emitter.emitInstr(nop, regmap))            fun outputInstr i = output (Emitter.emitInstr(nop, regmap))
# Line 117  Line 121 
121                in                in
122                  if n > 0 then                  if n > 0 then
123                    (print ("\t\t\t Inserting " ^ Int.toString n ^ "nops\n");                    (print ("\t\t\t Inserting " ^ Int.toString n ^ "nops\n");
124                     Asm.emitInstr(instr, regmap))                     emit regmap instr)
125                  else ();                  else ();
126                  app output instrs;                  app output instrs;
127                  if n < 0 then                  if n < 0 then

Legend:
Removed from v.410  
changed lines
  Added in v.411

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