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/compiler/CodeGen/hppa/hppaLabelComp.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/CodeGen/hppa/hppaLabelComp.sml

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

revision 545, Thu Feb 24 13:56:44 2000 UTC revision 546, Thu Feb 24 14:04:51 2000 UTC
# Line 2  Line 2 
2    (structure MLTree : MLTREE    (structure MLTree : MLTREE
3     structure Instr : HPPAINSTR     structure Instr : HPPAINSTR
4       sharing Instr.Region = MLTree.Region       sharing Instr.Region = MLTree.Region
5       sharing Instr.Constant = MLTree.Constant) =       sharing Instr.LabelExp = MLTree.LabelExp) =
6  struct  struct
7    structure T = MLTree    structure T = MLTree
8    structure I = Instr    structure I = Instr
9    structure C = I.C    structure C = I.C
10    structure LE = LabelExp    structure LE = I.LabelExp
11    
12    type reduce =    type ('s,'r,'f,'c) reduce =
13      { stm: T.stm -> unit,      { stm: ('s,'r,'f,'c) T.stm -> unit,
14        rexp: T.rexp -> int,        rexp: ('s,'r,'f,'c) T.rexp -> int,
15        emit: I.instruction -> unit }        emit: I.instruction -> unit }
16    
   datatype lab_opnd = OPND of I.operand | REG of int  
   
17    fun error msg = ErrorMsg.impossible("HppaLabelComp." ^ msg)    fun error msg = ErrorMsg.impossible("HppaLabelComp." ^ msg)
18    
19    fun ldLabelOpnd emit {label, pref} = OPND(I.LabExp(label,I.T))    fun ldLabelOpnd emit {label, pref} = I.LabExp(label,I.T)
20    fun ldLabelEA emit lexp = (0, I.LabExp(lexp, I.T))    fun ldLabelEA emit lexp = (0, I.LabExp(lexp, I.T))
21    
22    (* should change the return pointer to 2 to follow HPUX conventions *)    (* should change the return pointer to 2 to follow HPUX conventions *)
23    fun doCall({stm,rexp,emit}:reduce, T.CALL(exp, def, use, mem)) = let    fun doCall({stm,rexp,emit}:('s,'r,'f,'c) reduce,
24                 T.CALL(exp, flow, def, use, cdef, cuse, mem)) =
25      let
26          val addCCreg = C.addCell C.CC          val addCCreg = C.addCell C.CC
27          fun live([], acc) = acc          fun live([], acc) = acc
28            | live(T.GPR(T.REG(_, r))::regs, acc) = live(regs, C.addReg(r, acc))            | live(T.GPR(T.REG(_, r))::regs, acc) = live(regs, C.addReg(r, acc))
29            | live(T.FPR(T.FREG(_, f))::regs, acc) = live(regs, C.addFreg(f, acc))            | live(T.FPR(T.FREG(_, f))::regs, acc) = live(regs, C.addFreg(f, acc))
30            | live(T.CCR(T.CC c)::regs, acc) = live(regs, addCCreg(c, acc))            | live(T.CCR(T.CC(_,c))::regs, acc) = live(regs, addCCreg(c, acc))
31              | live(T.CCR(T.FCC(_,c))::regs, acc) = live(regs, addCCreg(c, acc))
32            | live(_::regs, acc) = live(regs, acc)            | live(_::regs, acc) = live(regs, acc)
33          val returnPtr = 31          val returnPtr = 31
34          val defs = C.addReg(returnPtr, live(def, C.empty))          val defs = C.addReg(returnPtr, live(def, C.empty))
# Line 37  Line 38 
38        end        end
39      | doCall _ = error "doCall"      | doCall _ = error "doCall"
40    
41    fun doJmp({stm,rexp,emit}:reduce, T.JMP(exp, labs)) =    fun doJmp({stm,rexp,emit}:('s,'r,'f,'c) reduce, T.JMP(ctrl, exp, labs)) =
42      (case exp      (case exp
43       of T.LABEL(LE.LABEL lab) => emit(I.B{lab=lab,n=true})       of T.LABEL(LE.LABEL lab) => emit(I.B{lab=lab,n=true})
44        | T.LABEL _ => error "doJmp: LABEL"        | T.LABEL _ => error "doJmp: LABEL"

Legend:
Removed from v.545  
changed lines
  Added in v.546

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