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/trunk/src/MLRISC/mips/emit/mipsMC.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/mips/emit/mipsMC.sml

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

revision 1327, Fri May 16 16:59:31 2003 UTC revision 1328, Fri May 16 19:23:19 2003 UTC
# Line 6  Line 6 
6    
7    
8  functor MIPSMCEmitter(structure Instr : MIPSINSTR  functor MIPSMCEmitter(structure Instr : MIPSINSTR
9                          structure MLTreeEval : MLTREE_EVAL where T = Instr.T
10                          structure Stream : INSTRUCTION_STREAM
11                        structure CodeString : CODE_STRING                        structure CodeString : CODE_STRING
12                       ) : INSTRUCTION_EMITTER =                       ) : INSTRUCTION_EMITTER =
13  struct  struct
14     structure I = Instr     structure I = Instr
15     structure C = I.C     structure C = I.C
    structure LabelExp = I.LabelExp  
16     structure Constant = I.Constant     structure Constant = I.Constant
17     structure T = I.T     structure T = I.T
18     structure S = T.Stream     structure S = Stream
19     structure P = S.P     structure P = S.P
20     structure W = Word32     structure W = Word32
21    
# Line 34  Line 35 
35         val emit_int = itow         val emit_int = itow
36         fun emit_word w = w         fun emit_word w = w
37         fun emit_label l = itow(Label.addrOf l)         fun emit_label l = itow(Label.addrOf l)
38         fun emit_labexp le = itow(LabelExp.valueOf le)         fun emit_labexp le = itow(MLTreeEval.valueOf le)
39         fun emit_const c = itow(Constant.valueOf c)         fun emit_const c = itow(Constant.valueOf c)
40         val loc = ref 0         val loc = ref 0
41    
# Line 49  Line 50 
50         in loc := i + 1; CodeString.update(i,Word8.fromLargeWord w) end         in loc := i + 1; CodeString.update(i,Word8.fromLargeWord w) end
51    
52         fun doNothing _ = ()         fun doNothing _ = ()
53           fun fail _ = raise Fail "MCEmitter"
54         fun getAnnotations () = error "getAnnotations"         fun getAnnotations () = error "getAnnotations"
55    
56         fun pseudoOp pOp = P.emitValue{pOp=pOp, loc= !loc,emit=eByte}         fun pseudoOp pOp = P.emitValue{pOp=pOp, loc= !loc,emit=eByte}
# Line 70  Line 72 
72              eByteW b24;              eByteW b24;
73              eByteW b32 )              eByteW b32 )
74         end         end
75     fun emit_GP r = itow (C.physicalRegisterNum r)     fun emit_GP r = itow (CellsBasis.physicalRegisterNum r)
76     and emit_FP r = itow (C.physicalRegisterNum r)     and emit_FP r = itow (CellsBasis.physicalRegisterNum r)
77     and emit_CC r = itow (C.physicalRegisterNum r)     and emit_CC r = itow (CellsBasis.physicalRegisterNum r)
78     and emit_COND r = itow (C.physicalRegisterNum r)     and emit_COND r = itow (CellsBasis.physicalRegisterNum r)
79     and emit_HI r = itow (C.physicalRegisterNum r)     and emit_HI r = itow (CellsBasis.physicalRegisterNum r)
80     and emit_LO r = itow (C.physicalRegisterNum r)     and emit_LO r = itow (CellsBasis.physicalRegisterNum r)
81     and emit_MEM r = itow (C.physicalRegisterNum r)     and emit_MEM r = itow (CellsBasis.physicalRegisterNum r)
82     and emit_CTRL r = itow (C.physicalRegisterNum r)     and emit_CTRL r = itow (CellsBasis.physicalRegisterNum r)
83     and emit_CELLSET r = itow (C.physicalRegisterNum r)     and emit_CELLSET r = itow (CellsBasis.physicalRegisterNum r)
84     fun Load {l, rt, b, offset} =     fun Load {l, rt, b, offset} =
85         let val rt = emit_GP rt         let val rt = emit_GP rt
86             val b = emit_GP b             val b = emit_GP b
# Line 133  Line 135 
135             emitInstr instr             emitInstr instr
136         end         end
137    
138       fun emitInstruction(I.ANNOTATION{i, ...}) = emitInstruction(i)
139         | emitInstruction(I.INSTR(i)) = emitter(i)
140         | emitInstruction(I.LIVE _)  = ()
141         | emitInstruction(I.KILL _)  = ()
142       | emitInstruction _ = error "emitInstruction"
143    
144     in  S.STREAM{beginCluster=init,     in  S.STREAM{beginCluster=init,
145                  pseudoOp=pseudoOp,                  pseudoOp=pseudoOp,
146                  emit=emitter,                  emit=emitInstruction,
147                  endCluster=doNothing,                  endCluster=fail,
148                  defineLabel=doNothing,                  defineLabel=doNothing,
149                  entryLabel=doNothing,                  entryLabel=doNothing,
150                  comment=doNothing,                  comment=doNothing,

Legend:
Removed from v.1327  
changed lines
  Added in v.1328

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