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 743, Thu Dec 7 15:31:24 2000 UTC revision 744, Fri Dec 8 04:11:42 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.LabelExp = MLTree.LabelExp) =       sharing Instr.LabelExp = MLTree.LabelExp) : LABEL_COMP =
6  struct  struct
7    structure T = MLTree    structure T = MLTree
8    structure I = Instr    structure I = Instr
# Line 11  Line 11 
11    
12    type reduce =    type reduce =
13      { stm: T.stm -> unit,      { stm: T.stm -> unit,
14        rexp: T.rexp -> int,        rexp: T.rexp -> C.cell,
15        emit: I.instruction -> unit }        emit: I.instruction -> unit }
16    
17    fun error msg = ErrorMsg.impossible("HppaLabelComp." ^ msg)    fun error msg = ErrorMsg.impossible("HppaLabelComp." ^ msg)
18    
19    fun ldLabelOpnd emit {label, pref} = 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 = (C.r0, 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,    fun doCall({stm,rexp,emit}:reduce,
24               T.CALL{funct, targets, defs, uses, cdefs, cuses, region}) =               T.CALL{funct, targets, defs, uses, region, ...}) =
25    let    let
26          val addCCreg = C.addCell C.CC          val addCCreg = C.CellSet.add
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))            | 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 = C.GPReg 31
34          val defs = C.addReg(returnPtr, live(defs, C.empty))          val defs = C.addReg(returnPtr, live(defs, C.empty))
35          val uses = live(uses, C.empty)          val uses = live(uses, C.empty)
36        in emit(I.BLE{b=rexp funct, d=I.IMMED 0, sr=5, t=returnPtr,        in emit(I.BLE{b=rexp funct, d=I.IMMED 0, sr=5, t=returnPtr,
# Line 38  Line 38 
38        end        end
39      | doCall _ = error "doCall"      | doCall _ = error "doCall"
40    
41    fun doJmp({stm,rexp,emit}:reduce, T.JMP(ctrl, exp, labs)) =    fun doJmp({stm,rexp,emit}:reduce, T.JMP(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"
45        | _ => emit(I.BV{b=rexp(exp), x=0, labs=labs, n=true})        | _ => emit(I.BV{b=rexp(exp), x=C.GPReg 0, labs=labs, n=true})
46      (*esac*))      (*esac*))
47    
48  end  end

Legend:
Removed from v.743  
changed lines
  Added in v.744

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