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

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