LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
color.hh
Go to the documentation of this file.
1
6
#ifndef REGALLOC_COLOR_HH
7
# define REGALLOC_COLOR_HH
8
9
# include <vector>
10
# include <map>
11
12
# include <
temp/fwd.hh
>
13
14
# include <
liveness/flowgraph.hh
>
15
# include <
liveness/interference-graph.hh
>
16
17
// FIXME: should be libtarget.hh
18
# include <
target/target.hh
>
19
20
namespace
regalloc
21
{
23
class
Color
24
{
25
// Shortand typedefs
26
public
:
27
typedef
liveness::InterferenceGraph
InterferenceGraph
;
28
typedef
liveness::interferencegraph_vertex_iter_type
hnodes_iterator
;
29
30
typedef
InterferenceGraph::vertex_descriptor
node_type
;
31
typedef
misc::set<node_type>
node_set_type
;
32
typedef
std::list<node_type>
node_list_type
;
33
34
typedef
InterferenceGraph::move_type
move_type
;
35
typedef
InterferenceGraph::move_set_type
move_set_type
;
36
39
typedef
std::vector<move_set_type>
move_list_map_type
;
40
42
typedef
std::vector<temp::Temp>
color_map_type
;
43
45
typedef
std::vector<node_type>
alias_map_type
;
46
49
public
:
53
Color
(
assem::ProcFrag
& frag,
const
target::Cpu
& cpu,
54
const
temp::TempMap
&
tempmap
,
55
bool
coalesce_p =
false
,
bool
trace_p =
false
);
60
public
:
61
// The color timer.
62
const
misc::timer
&
timer_get
()
const
;
68
protected
:
70
void
import_nodes
();
71
73
void
import_moves
();
74
76
void
precolor
();
77
83
void
priorities_compute
();
84
87
void
degrees_compute
();
93
void
add_edge
(
const
node_type
u,
const
node_type
v);
94
97
void
make_work_list
(
const
node_type
n);
98
100
void
make_work_list
();
101
107
node_set_type
adjacent
(
const
node_type
n)
const
;
108
115
bool
adjacent
(
const
node_type
a,
const
node_type
b)
const
;
116
118
move_set_type
node_moves
(
const
node_type
n)
const
;
119
121
bool
move_related
(
const
node_type
n)
const
;
122
130
bool
coalesce_briggs_p
(
const
node_type
a,
const
node_type
b)
const
;
131
138
bool
coalesce_george_p
(
const
node_type
a,
const
node_type
b)
const
;
142
143
void
coalesce
();
144
148
void
add_work_list
(
const
node_type
u);
149
150
protected
:
153
node_type
get_alias
(
const
node_type
a)
const
;
154
162
void
combine
(
const
node_type
u,
const
node_type
v);
163
165
void
freeze_moves
(
const
node_type
u);
166
168
void
freeze
();
169
171
void
select_spill
();
172
173
175
void
simplify
();
176
202
void
decrement_degree
(
node_type
n);
203
212
void
enable_moves
(
node_type
n);
213
215
void
enable_moves
(
const
node_set_type
& nodes);
216
217
void
assign_color
(
node_type
n);
218
228
void
assign_colors
();
229
230
public
:
234
bool
operator()
();
235
238
public
:
240
const
temp::temp_set_type
spilled_get
()
const
;
241
245
temp::TempMap
tempmap_get
()
const
;
251
protected
:
253
void
trace
(
const
std::string& what,
const
node_type
& n)
const
;
254
256
void
trace
(
const
std::string& what,
const
move_type
& m)
const
;
257
260
void
dump
(std::ostream& ostr,
const
node_type
& n)
const
;
261
263
void
dump
(std::ostream& ostr,
const
node_set_type
& s)
const
;
264
266
void
dump
(std::ostream& ostr,
const
node_list_type
& s)
const
;
267
270
void
dump
(std::ostream& ostr,
const
move_type
& s)
const
;
271
273
void
dump
(std::ostream& ostr,
const
move_set_type
& s)
const
;
274
276
void
dump
(std::ostream& ostr)
const
;
281
protected
:
283
InterferenceGraph
ig_
;
284
286
const
target::Cpu
&
cpu_
;
287
289
size_t
nb_regs_
;
290
292
assem::ProcFrag
&
asm_proc_frag_
;
293
295
bool
trace_p_
;
296
298
bool
coalesce_p_
;
299
307
308
node_set_type
precolored_
;
309
312
node_set_type
initial_
;
313
316
node_set_type
simplify_work_list_
;
317
320
node_set_type
freeze_work_list_
;
321
324
node_set_type
spill_work_list_
;
325
328
node_set_type
spilled_nodes_
;
329
333
node_set_type
coalesced_nodes_
;
334
336
node_set_type
colored_nodes_
;
337
341
node_list_type
select_stack_
;
342
352
353
move_set_type
coalesced_moves_
;
354
356
move_set_type
constrained_moves_
;
357
360
move_set_type
frozen_moves_
;
361
363
move_set_type
work_list_moves_
;
364
366
move_set_type
active_moves_
;
367
374
375
std::vector<size_t>
degree_
;
376
379
move_list_map_type
move_list_
;
380
383
alias_map_type
alias_
;
384
388
color_map_type
color_
;
389
393
394
std::map<temp::Temp, int>
temps_priority_
;
395
396
399
private
:
401
misc::timer
timer_
;
403
};
404
405
}
// namespace regalloc
406
407
408
# undef DO
409
410
#endif // !REGALLOC_COLOR_HH
regalloc
color.hh
Generated on Wed Mar 5 2014 15:47:37 for LRDE Tiger Compiler by
1.8.1.2