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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4388 - (view) (download)

1 : jhr 4388 (* ppcPseudoInstr.sml
2 :     *
3 :     * COPYRIGHT (c) 2017 The Fellowship of SML/NJ (http://www.smlnj.org)
4 :     * All rights reserved.
5 :     *)
6 :    
7 : monnier 245 functor PPCPseudoInstr
8 :     (structure Instr : PPCINSTR
9 :     where Region = CPSRegions) : PPC_PSEUDO_INSTR =
10 :     struct
11 :     structure I = Instr
12 :     structure C = Instr.C
13 :    
14 :     val stack = CPSRegions.stack
15 : jhr 4388 val cvti2dTmpOff = 4096+16 (* runtime system dependent *)
16 : mblume 1532 val cvti2dConstOff = 4096+8 (* '' *)
17 : monnier 245 val sp = C.stackptrR
18 :    
19 :     (* Cute little trick -- go figure *)
20 : jhr 4388 fun cvti2d {reg, fd} = let
21 :     val tmpR = C.newReg()
22 :     val tmpF = C.newFreg()
23 :     in
24 :     map I.INSTR
25 :     [I.ARITHI{oper=I.XORIS, rt=tmpR, ra=reg, im=I.ImmedOp 32768},
26 :     I.ST{st=I.STW, rs=tmpR, ra=sp, d=I.ImmedOp(cvti2dTmpOff+4), mem=stack},
27 :     I.ARITHI{oper=I.ADDIS, rt=tmpR, ra=C.r0, im=I.ImmedOp(0x4330)},
28 :     I.ST{st=I.STW, rs=tmpR, ra=sp, d=I.ImmedOp(cvti2dTmpOff), mem=stack},
29 :     I.LF{ld=I.LFD, ft=fd, ra=sp, d=I.ImmedOp(cvti2dTmpOff), mem=stack},
30 :     I.LF{ld=I.LFD, ft=tmpF, ra=sp, d=I.ImmedOp(cvti2dConstOff), mem=stack},
31 :     I.FARITH{oper=I.FSUB, ft=fd, fa=fd, fb=tmpF, Rc=false}]
32 :     end
33 : monnier 411 end

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