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/alpha32/alpha32CG.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/CodeGen/alpha32/alpha32CG.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1003 - (view) (download)

1 : monnier 429 (*
2 :     * Alpha32 specific backend
3 : monnier 247 *)
4 : monnier 429 structure Alpha32CG =
5 :     MachineGen
6 :     ( structure I = Alpha32Instr
7 :     structure MachSpec = Alpha32Spec
8 : george 984 structure ClientPseudoOps = Alpha32ClientPseudoOps
9 : monnier 429 structure PseudoOps = Alpha32PseudoOps
10 : blume 773 structure Ext = SMLNJMLTreeExt(* generic extension *)
11 : monnier 429 structure CpsRegs = Alpha32CpsRegs
12 : monnier 475 structure InsnProps = Alpha32Props
13 : monnier 429 structure Asm = Alpha32AsmEmitter
14 : george 555 structure Shuffle = Alpha32Shuffle
15 : george 909
16 : blume 773 structure CCalls = DummyCCallsFn (Alpha32MLTree)
17 : george 823 structure OmitFramePtr = struct
18 :     exception NotImplemented
19 : george 909 structure CFG=Alpha32CFG
20 : george 823 structure I=Alpha32Instr
21 :     val vfp = CpsRegs.vfp
22 :     fun omitframeptr _ = raise NotImplemented
23 :     end
24 :    
25 : blume 773
26 : monnier 429 structure MLTreeComp=
27 :     Alpha(structure AlphaInstr = Alpha32Instr
28 :     structure AlphaMLTree = Alpha32MLTree
29 :     structure PseudoInstrs = Alpha32PseudoInstrs
30 : george 555 structure ExtensionComp = SMLNJMLTreeExtComp
31 :     (structure I = Alpha32Instr
32 :     structure T = Alpha32MLTree
33 : george 909 structure CFG = Alpha32CFG
34 : george 984 structure TS = Alpha32MLTreeStream
35 : george 555 )
36 : monnier 429 val mode32bit = true (* simulate 32 bit mode *)
37 :     val multCost = ref 8 (* just guessing *)
38 :     val useMultByConst = ref false (* just guessing *)
39 : leunga 583 val byteWordLoadStores = ref false
40 : george 546 val SMLNJfloatingPoint = true (* must be true for SML/NJ *)
41 : monnier 429 )
42 : monnier 247
43 : leunga 657 structure Jumps =
44 : monnier 429 AlphaJumps(structure Instr=Alpha32Instr
45 : george 984 structure Shuffle=Alpha32Shuffle
46 :     structure MLTreeEval=Alpha32MLTreeEval)
47 : monnier 247
48 : monnier 429 structure BackPatch =
49 : george 909 BBSched2(structure CFG=Alpha32CFG
50 : leunga 657 structure Jumps = Jumps
51 : george 909 structure Placement = DefaultBlockPlacement(Alpha32CFG)
52 : monnier 429 structure Emitter = Alpha32MCEmitter)
53 : monnier 247
54 : monnier 429 structure RA =
55 : leunga 744 RISC_RA
56 : monnier 429 (structure I = Alpha32Instr
57 : george 909 structure Flowgraph = Alpha32CFG
58 : monnier 429 structure InsnProps = InsnProps
59 :     structure Rewrite = AlphaRewrite(Alpha32Instr)
60 :     structure Asm = Alpha32AsmEmitter
61 : leunga 744 structure SpillHeur = ChaitinSpillHeur
62 :     structure Spill = RASpill(structure InsnProps = InsnProps
63 :     structure Asm = Alpha32AsmEmitter)
64 : monnier 247
65 : leunga 744 val sp = I.C.stackptrR
66 : monnier 498 val spill = CPSRegions.spill
67 : monnier 247
68 : leunga 744 structure SpillTable = SpillTable(Alpha32Spec)
69 :    
70 :     val architecture = Alpha32Spec.architecture
71 :    
72 :     val beginRA = SpillTable.spillInit
73 :    
74 : monnier 469 fun pure _ = false
75 :    
76 : monnier 429 (* make copies *)
77 : leunga 744 structure Int =
78 :     struct
79 :     val avail = Alpha32CpsRegs.availR
80 :     val dedicated = Alpha32CpsRegs.dedicatedR
81 : monnier 247
82 : leunga 744 fun copy((rds as [_], rss as [_]), _) =
83 : george 1003 I.copy{dst=rds, src=rss, impl=ref NONE, tmp=NONE}
84 :     | copy((rds, rss), I.INSTR(I.COPY{tmp, ...})) =
85 :     I.copy{dst=rds, src=rss, impl=ref NONE, tmp=tmp}
86 : monnier 247
87 : leunga 744 (* spill copy temp *)
88 : george 1003 fun spillCopyTmp(an, I.INSTR(I.COPY{tmp,dst,src,impl}),loc) =
89 :     I.copy{tmp=SOME(I.Displace{base=sp,
90 : leunga 744 disp=SpillTable.getRegLoc loc}),
91 :     dst=dst,src=src,impl=impl}
92 : monnier 247
93 : leunga 744 (* spill register *)
94 : leunga 796 fun spillInstr{src,spilledCell,spillLoc,an} =
95 : george 1003 [I.store{stOp=I.STL, b=sp,
96 : leunga 796 d=I.IMMop(SpillTable.getRegLoc spillLoc),
97 :     r=src, mem=spill}]
98 : leunga 744
99 :     (* reload register *)
100 : leunga 796 fun reloadInstr{dst,spilledCell,spillLoc,an} =
101 : george 1003 [I.load{ldOp=I.LDL, b=sp,
102 : leunga 796 d=I.IMMop(SpillTable.getRegLoc spillLoc),
103 :     r=dst, mem=spill}]
104 :    
105 :     val mode = RACore.NO_OPTIMIZATION
106 : leunga 744 end
107 :    
108 :     structure Float =
109 :     struct
110 :     val avail = Alpha32CpsRegs.availF
111 :     val dedicated = Alpha32CpsRegs.dedicatedF
112 :    
113 :     fun copy((fds as [_], fss as [_]), _) =
114 : george 1003 I.fcopy{dst=fds, src=fss, impl=ref NONE, tmp=NONE}
115 :     | copy((fds, fss), I.INSTR(I.FCOPY{tmp, ...})) =
116 :     I.fcopy{dst=fds, src=fss, impl=ref NONE, tmp=tmp}
117 : leunga 744
118 : george 1003 fun spillCopyTmp(an, I.INSTR(I.FCOPY{tmp,dst,src,impl}),loc) =
119 :     I.fcopy{tmp=SOME(I.Displace{base=sp,
120 : leunga 744 disp=SpillTable.getFregLoc loc}),
121 :     dst=dst,src=src,impl=impl}
122 :    
123 :     fun spillInstr(_, r,loc) =
124 : george 1003 [I.fstore{stOp=I.STT, b=sp,
125 : leunga 744 d=I.IMMop(SpillTable.getFregLoc loc),
126 :     r=r, mem=spill}]
127 :    
128 :     fun reloadInstr(_, r,loc) =
129 : george 1003 [I.fload{ldOp=I.LDT, b=sp,
130 : leunga 744 d=I.IMMop(SpillTable.getFregLoc loc),
131 :     r=r, mem=spill}]
132 : leunga 796
133 :     val mode = RACore.NO_OPTIMIZATION
134 : leunga 744 end
135 : monnier 429 )
136 :     )

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