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
tree.hh
Go to the documentation of this file.
1
6
#ifndef TREE_TREE_HH
7
# define TREE_TREE_HH
8
9
# include <iosfwd>
10
11
# include <
temp/temp.hh
>
12
# include <
tree/fwd.hh
>
13
14
// FIXME: This class is truly ugly and needs being reworked. Pay
15
// attention to child_push_back and child_set, it is abnormal and they
16
// do more or less the same thing.
17
18
namespace
tree
19
{
20
21
class
Tree
22
{
23
public
:
25
Tree
();
27
Tree
(
const
tree_list_type
& children);
29
virtual
~Tree
();
30
33
40
typedef
enum
41
{
42
const_kind
,
name_kind
,
temp_kind
,
binop_kind
,
mem_kind
,
43
call_kind
,
eseq_kind
,
move_kind
,
sxp_kind
,
jump_kind
,
44
cjump_kind
,
seq_kind
,
label_kind
45
}
kind_tree_type
;
46
48
virtual
kind_tree_type
kind_get
()
const
= 0;
50
51
// All the children
52
void
child_push_back
(
const
rTree& tree);
53
tree_list_type
&
children_get
();
54
const
tree_list_type
&
children_get
()
const
;
55
56
private
:
57
void
child_set
(rTree& dst,
const
rTree& src);
58
59
public
:
60
// Start at 0, of course.
61
rTree&
child_get
(
int
nth);
62
rTree
child_get
(
int
nth)
const
;
63
rTree&
left_get
();
64
rTree&
right_get
();
65
66
// parent
67
void
parent_get_assert
()
const
;
68
Tree
*
parent_get
();
69
const
Tree
*
parent_get
()
const
;
70
void
parent_set
(
Tree
* parent);
71
72
// (in-place) replacement
73
void
replace_by
(
const
rTree& tree);
74
76
virtual
std::ostream&
tag_print
(std::ostream& o)
const
= 0;
78
virtual
std::ostream&
dump
(std::ostream& o)
const
;
79
80
public
:
81
// temp::Temp management for asm output.
82
temp::Temp
&
asm_get
();
83
void
asm_set
(
const
temp::Temp
& temp);
84
85
// State management for asm output.
86
void
*
state_get
()
const
;
87
void
*&
state_get
();
88
89
// Reduced state.
90
bool
reducible_get
()
const
;
91
void
reducible_set
(
bool
b);
92
93
protected
:
94
friend
std::ostream&
operator<<
(std::ostream& ostr,
const
Tree
& tree);
95
96
protected
:
98
tree_list_type
children_
;
100
Tree
*
parent_
=
nullptr
;
102
temp::Temp
*
temp_
=
nullptr
;
104
void
*
state_
=
nullptr
;
106
bool
reducible_
=
true
;
107
};
108
110
std::ostream&
operator<<
(std::ostream& o,
const
Tree
& t);
111
}
112
113
# include <
tree/tree.hxx
>
114
115
#endif // !TREE_TREE_HH
tree
tree.hh
Generated on Wed Mar 5 2014 15:47:37 for LRDE Tiger Compiler by
1.8.1.2