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/compiler/CodeGen/ppc/ppcPseudoInstr.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/CodeGen/ppc/ppcPseudoInstr.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 245 - (view) (download)
Original Path: sml/branches/SMLNJ/src/compiler/CodeGen/ppc/ppcPseudoInstr.sml

1 : monnier 245 functor PPCPseudoInstr
2 :     (structure Instr : PPCINSTR
3 :     where Region = CPSRegions) : PPC_PSEUDO_INSTR =
4 :     struct
5 :     structure I = Instr
6 :     structure C = Instr.C
7 :    
8 :     val stack = CPSRegions.stack
9 :     val cvti2dTmpOff = 16 (* runtime system dependent *)
10 :     val cvti2dConstOff = 8 (* '' *)
11 :     val sp = C.stackptrR
12 :    
13 :     (* Cute little trick -- go figure *)
14 :     fun cvti2d{reg, fd} = let
15 :     val tmpR = C.newReg()
16 :     val tmpF = C.newFreg()
17 :     in
18 :     [I.ARITHI{oper=I.XORS, rt=tmpR, ra=reg, im=I.ImmedOp 32768},
19 :     I.ST{sz=I.Word, rs=tmpR, ra=sp, d=I.ImmedOp(cvti2dTmpOff+4), mem=stack},
20 :     I.ARITHI{oper=I.ADDS, rt=tmpR, ra=0, im=I.ImmedOp(0x4330)},
21 :     I.ST{sz=I.Word, rs=tmpR, ra=sp, d=I.ImmedOp(cvti2dTmpOff), mem=stack},
22 :     I.L{sz=I.Double, rt=fd, ra=sp, d=I.ImmedOp(cvti2dTmpOff), mem=stack},
23 :     I.L{sz=I.Double, rt=tmpF, ra=sp, d=I.ImmedOp(cvti2dConstOff), mem=stack},
24 :     I.FARITH{oper=I.FSUB, ft=fd, fa=fd, fb=tmpF, Rc=false}]
25 :     end
26 :     end

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