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/branches/SMLNJ/src/compiler/CodeGen/alpha32/alpha32PseudoInstrs.sml
ViewVC logotype

Annotation of /sml/branches/SMLNJ/src/compiler/CodeGen/alpha32/alpha32PseudoInstrs.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (view) (download)

1 : monnier 16 functor Alpha32PseudoInstrs
2 :     (structure Instr : ALPHA32INSTR
3 :     where Region=CPSRegions) : ALPHA32_PSEUDO_INSTR =
4 :     struct
5 :     structure I = Instr
6 :     structure C = Instr.C
7 :    
8 :     type reduceOpnd = I.operand -> int
9 :    
10 :     val floatTmpOffset = I.IMMop 96 (* runtime system dependent *)
11 :     val floatTmpOffset8 = I.IMMop(96+8) (* " *)
12 :     val divlOffset = I.IMMop 120 (* " *)
13 :     val divluOffset = I.IMMop 124 (* " *)
14 :    
15 :     val newFreg = I.C.newFreg
16 :     val newReg = I.C.newReg
17 :     val stack = CPSRegions.stack
18 :     val sp = I.C.stackptrR
19 :     val zeroR = 31
20 :    
21 :     val makeCellset = List.foldl C.addReg C.empty
22 :     val defs = makeCellset [0, 23, 24, 25, 26, 28]
23 :     val uses = makeCellset [16, 17]
24 :     fun copyTmp() = SOME(I.Direct(C.newReg()))
25 :    
26 :     fun divl({ra, rb, rc}, reduceOpnd) =
27 :     [I.COPY{dst=[16, 17], src=[ra, reduceOpnd rb], impl=ref NONE,
28 :     tmp=copyTmp()},
29 :     I.LOAD{ldOp=I.LDL, r=27, b=sp, d=divlOffset, mem=stack},
30 :     I.JSR({r=26, b=27, d=0}, defs, uses),
31 :     I.COPY{dst=[rc], src=[0], impl=ref NONE, tmp=copyTmp()}]
32 :    
33 :     fun divlu({ra, rb, rc}, reduceOpnd) =
34 :     [I.COPY{dst=[16, 17], src=[ra, reduceOpnd rb], impl=ref NONE,
35 :     tmp=copyTmp()},
36 :     I.LOAD{ldOp=I.LDL, r=27, b=sp, d=divluOffset, mem=stack},
37 :     I.JSR({r=26, b=27, d=0}, defs, uses),
38 :     I.COPY{dst=[rc], src=[0], impl=ref NONE, tmp=copyTmp()}]
39 :    
40 :     fun cvti2d({opnd, fd}, reduceOpnd) = let
41 :     val ra = reduceOpnd opnd
42 :     in
43 :     [I.STORE{stOp=I.STQ, r=ra,
44 :     b=sp, d=floatTmpOffset, mem=stack},
45 :     I.FLOAD{ldOp=I.LDT, r=fd, b=sp, d=floatTmpOffset, mem=stack},
46 :     I.FOPERATE{oper=I.CVTQT, fa=zeroR, fb=fd, fc=fd}]
47 :     end
48 :     end

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