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

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