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

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