Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
f3c5532f
Commit
f3c5532f
authored
Aug 19, 2003
by
Michael Beck
Browse files
Make prefixes for most (hopefully all) enum values. Means change your code, I/F has changed ;-)
[r1715]
parent
25a9079a
Changes
11
Hide whitespace changes
Inline
Side-by-side
ir/ana/cgana.c
View file @
f3c5532f
...
...
@@ -49,13 +49,13 @@ static eset * entities = NULL;
* bergebenene (dynamischen) Typ berschreibt. */
static
entity
*
get_implementation
(
type
*
class
,
entity
*
method
)
{
int
i
;
if
(
get_entity_peculiarity
(
method
)
!=
description
&&
if
(
get_entity_peculiarity
(
method
)
!=
peculiarity_
description
&&
get_entity_owner
(
method
)
==
class
)
{
return
method
;
}
for
(
i
=
get_entity_n_overwrittenby
(
method
)
-
1
;
i
>=
0
;
--
i
)
{
entity
*
e
=
get_entity_overwrittenby
(
method
,
i
);
if
(
get_entity_peculiarity
(
e
)
!=
description
&&
get_entity_owner
(
e
)
==
class
)
{
if
(
get_entity_peculiarity
(
e
)
!=
peculiarity_
description
&&
get_entity_owner
(
e
)
==
class
)
{
return
e
;
}
}
...
...
@@ -81,10 +81,10 @@ entity *get_inherited_methods_implementation(entity *inh_meth) {
}
else
{
assert
(
0
&&
"Complex constant values not supported -- adress of method should be straight constant!"
);
}
if
(
impl_meth
&&
(
get_entity_peculiarity
(
impl_meth
)
!=
existent
))
{
if
(
impl_meth
&&
(
get_entity_peculiarity
(
impl_meth
)
!=
peculiarity_
existent
))
{
printf
(
"this_meth: "
);
DDMEO
(
inh_meth
);
printf
(
"impl meth: "
);
DDMEO
(
impl_meth
);
assert
(
!
impl_meth
||
get_entity_peculiarity
(
impl_meth
)
==
existent
);
assert
(
!
impl_meth
||
get_entity_peculiarity
(
impl_meth
)
==
peculiarity_
existent
);
}
return
impl_meth
?
impl_meth
:
inh_meth
;
}
...
...
@@ -99,8 +99,8 @@ entity *get_inherited_methods_implementation(entity *inh_meth) {
Cycle-free, therefore must terminate. */
void
collect_impls
(
entity
*
method
,
eset
*
set
,
int
*
size
,
bool
*
open
)
{
int
i
;
if
(
get_entity_peculiarity
(
method
)
==
existent
)
{
if
(
get_entity_visibility
(
method
)
==
external_allocated
)
{
if
(
get_entity_peculiarity
(
method
)
==
peculiarity_
existent
)
{
if
(
get_entity_visibility
(
method
)
==
visibility_
external_allocated
)
{
assert
(
get_entity_irg
(
method
)
==
NULL
);
*
open
=
true
;
}
else
{
...
...
@@ -111,10 +111,10 @@ void collect_impls(entity *method, eset *set, int *size, bool *open) {
}
}
}
if
(
get_entity_peculiarity
(
method
)
==
inherited
)
{
if
(
get_entity_peculiarity
(
method
)
==
peculiarity_
inherited
)
{
entity
*
impl_ent
=
get_inherited_methods_implementation
(
method
);
assert
(
impl_ent
&&
"no implementation for inherited entity"
);
if
(
get_entity_visibility
(
impl_ent
)
==
external_allocated
)
{
if
(
get_entity_visibility
(
impl_ent
)
==
visibility_
external_allocated
)
{
assert
(
get_entity_irg
(
impl_ent
)
==
NULL
);
*
open
=
true
;
}
else
{
...
...
@@ -193,7 +193,7 @@ static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
pmap_entry
*
entry
=
pmap_find
(
ldname_map
,
(
void
*
)
get_SymConst_ptrinfo
(
node
));
if
(
entry
!=
NULL
)
{
/* Method is declared in the compiled code */
entity
*
ent
=
entry
->
value
;
if
(
get_opt_normalize
()
&&
(
get_entity_visibility
(
ent
)
!=
external_allocated
))
{
/* Meth. is defined */
if
(
get_opt_normalize
()
&&
(
get_entity_visibility
(
ent
)
!=
visibility_
external_allocated
))
{
/* Meth. is defined */
ir_node
*
new_node
;
assert
(
get_entity_irg
(
ent
));
set_irg_current_block
(
current_ir_graph
,
get_nodes_Block
(
node
));
...
...
@@ -210,14 +210,14 @@ static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
(
get_irn_op
(
skip_Proj
(
get_Sel_ptr
(
node
)))
==
op_Alloc
))
{
ir_node
*
new_node
;
/* We know which method will be called, no dispatch necessary. */
assert
(
get_entity_peculiarity
(
ent
)
!=
description
);
assert
(
get_entity_peculiarity
(
ent
)
!=
peculiarity_
description
);
set_irg_current_block
(
current_ir_graph
,
get_nodes_Block
(
node
));
/* @@@ Is this correct?? Alloc could reference a subtype of the owner
of Sel that overwrites the method referenced in Sel. */
new_node
=
copy_const_value
(
get_atomic_ent_value
(
ent
));
DBG_OPT_POLY_ALLOC
;
exchange
(
node
,
new_node
);
}
else
{
assert
(
get_entity_peculiarity
(
ent
)
!=
inherited
);
assert
(
get_entity_peculiarity
(
ent
)
!=
peculiarity_
inherited
);
if
(
!
eset_contains
(
entities
,
ent
))
{
/* Entity noch nicht behandelt. Alle (intern oder extern)
* implementierten Methoden suchen, die diese Entity
...
...
@@ -231,7 +231,7 @@ static void sel_methods_walker(ir_node * node, pmap * ldname_map) {
* ausfhrbar und nicht erreichbar. */
/* Gib eine Warnung aus wenn die Entitaet eine Beschreibung ist
fuer die es keine Implementierung gibt. */
if
(
get_entity_peculiarity
(
ent
)
==
description
)
{
if
(
get_entity_peculiarity
(
ent
)
==
peculiarity_
description
)
{
/* @@@ GL Methode um Fehler anzuzeigen aufrufen! */
printf
(
"WARNING: Calling method description %s in method %s which has "
"no implementation!
\n
"
,
get_entity_name
(
ent
),
...
...
@@ -283,7 +283,7 @@ static void sel_methods_init(void) {
entity
*
ent
=
get_irg_ent
(
get_irp_irg
(
i
));
/* Nur extern sichtbare Methode knnen berhaupt mit SymConst
* aufgerufen werden. */
if
(
get_entity_visibility
(
ent
)
!=
local
)
{
if
(
get_entity_visibility
(
ent
)
!=
visibility_
local
)
{
pmap_insert
(
ldname_map
,
(
void
*
)
get_entity_ld_ident
(
ent
),
ent
);
}
}
...
...
@@ -414,7 +414,7 @@ static void callee_ana_node(ir_node * node, eset * methods) {
/* interne Methode */
entity
*
ent
=
tarval_to_entity
(
get_Const_tarval
(
node
));
assert
(
ent
&&
is_method_type
(
get_entity_type
(
ent
)));
if
(
get_entity_visibility
(
ent
)
!=
external_allocated
)
{
if
(
get_entity_visibility
(
ent
)
!=
visibility_
external_allocated
)
{
assert
(
get_entity_irg
(
ent
));
eset_insert
(
methods
,
ent
);
}
else
{
...
...
@@ -669,7 +669,7 @@ static entity ** get_free_methods(void) {
ir_graph
*
irg
=
get_irp_irg
(
i
);
entity
*
ent
=
get_irg_ent
(
irg
);
/* insert "external visible" methods. */
if
(
get_entity_visibility
(
ent
)
!=
local
)
{
if
(
get_entity_visibility
(
ent
)
!=
visibility_
local
)
{
eset_insert
(
set
,
ent
);
}
irg_walk_graph
(
irg
,
NULL
,
(
irg_walk_func
*
)
free_ana_walker
,
set
);
...
...
ir/ir/ircgcons.c
View file @
f3c5532f
...
...
@@ -395,7 +395,7 @@ static void construct_start(entity * caller, entity * callee,
ir_node
*
start
=
get_irg_start
(
irg
),
*
filter
;
assert
(
irg
);
assert
(
get_entity_peculiarity
(
callee
)
==
existent
);
/* Else data is not initalized. */
assert
(
get_entity_peculiarity
(
callee
)
==
peculiarity_
existent
);
/* Else data is not initalized. */
assert
((
0
<=
data
->
count
)
&&
(
data
->
count
<
get_Block_cg_n_cfgpreds
(
get_nodes_Block
(
start
))));
set_Block_cg_cfgpred
(
get_nodes_Block
(
start
),
data
->
count
,
exec
);
...
...
ir/ir/ircgopt.c
View file @
f3c5532f
...
...
@@ -78,7 +78,7 @@ void gc_irgs(int n_keep, entity ** keep_arr) {
entity
*
ent
=
get_irg_ent
(
irg
);
if
(
get_entity_link
(
ent
)
!=
MARK
)
{
remove_irp_irg
(
irg
);
set_entity_peculiarity
(
ent
,
description
);
set_entity_peculiarity
(
ent
,
peculiarity_
description
);
}
set_entity_link
(
ent
,
NULL
);
}
...
...
ir/ir/irdump.c
View file @
f3c5532f
...
...
@@ -636,7 +636,7 @@ static void print_typespecific_info(type *tp) {
switch
(
get_type_tpop_code
(
tp
))
{
case
tpo_class
:
{
if
(
existent
==
get_class_peculiarity
(
tp
))
if
(
peculiarity_
existent
==
get_class_peculiarity
(
tp
))
fprintf
(
F
,
" "
TYPE_CLASS_NODE_ATTR
);
else
fprintf
(
F
,
" "
TYPE_DESCRIPTION_NODE_ATTR
);
...
...
@@ -667,7 +667,8 @@ static void print_typespecific_info(type *tp) {
}
/* switch type */
}
static
void
print_type_node
(
type
*
tp
)
{
static
void
print_type_node
(
type
*
tp
)
{
fprintf
(
F
,
"node: {title: "
);
PRINT_TYPEID
(
tp
);
fprintf
(
F
,
" label:
\"
%s %s
\"
"
,
get_id_str
(
get_type_tpop_nameid
(
tp
)),
get_id_str
(
get_type_ident
(
tp
)));
...
...
@@ -678,43 +679,50 @@ static void print_type_node(type *tp) {
fprintf
(
F
,
"}
\n
"
);
}
void
dump_entity_node
(
entity
*
ent
)
{
#define X(a) case a: fprintf(F, #a); break
void
dump_entity_node
(
entity
*
ent
)
{
fprintf
(
F
,
"node: {title:
\"
"
);
PRINT_ENTID
(
ent
);
fprintf
(
F
,
"
\"
"
);
fprintf
(
F
,
DEFAULT_TYPE_ATTRIBUTE
);
fprintf
(
F
,
"label: "
);
fprintf
(
F
,
"
\"
ent %s
\"
"
ENTITY_NODE_ATTR
,
get_id_str
(
get_entity_ident
(
ent
)));
fprintf
(
F
,
"
\n
info1:
\"\n
id: "
);
PRINT_ENTID
(
ent
);
fprintf
(
F
,
"
\n
allocation: "
);
switch
(
get_entity_allocation
(
ent
))
{
case
dynamic_allocated
:
fprintf
(
F
,
"dynamic allocated"
);
break
;
case
automatic_allocated
:
fprintf
(
F
,
"automatic allocated"
);
break
;
case
static_allocated
:
fprintf
(
F
,
"static allocated"
);
break
;
case
parameter_allocated
:
fprintf
(
F
,
"parameter allocated"
);
break
;
X
(
allocation_dynamic
)
;
X
(
allocation_automatic
)
;
X
(
allocation_static
)
;
X
(
allocation_parameter
)
;
}
fprintf
(
F
,
"
\n
visibility: "
);
switch
(
get_entity_visibility
(
ent
))
{
case
local
:
fprintf
(
F
,
"
local
"
);
break
;
case
external_visible
:
fprintf
(
F
,
"
external
visible
"
);
break
;
case
external_allocated
:
fprintf
(
F
,
"
external
allocated
"
);
break
;
X
(
visibility_
local
);
X
(
visibility_
external
_
visible
);
X
(
visibility_
external
_
allocated
);
}
fprintf
(
F
,
"
\n
variability: "
);
switch
(
get_entity_variability
(
ent
))
{
case
uninitialized
:
fprintf
(
F
,
"
uninitialized
"
);
break
;
case
initialized
:
fprintf
(
F
,
"
initialized
"
);
break
;
case
part_constant
:
fprintf
(
F
,
"
part_constant
"
);
break
;
case
constant
:
fprintf
(
F
,
"
constant
"
);
break
;
X
(
variability_
uninitialized
);
X
(
variability_
initialized
);
X
(
variability_
part_constant
);
X
(
variability_
constant
);
}
fprintf
(
F
,
"
\n
volatility: "
);
switch
(
get_entity_volatility
(
ent
))
{
case
non_volatile
:
fprintf
(
F
,
"
non_volatile
"
);
break
;
case
is_volatile
:
fprintf
(
F
,
"
is_volatile
"
);
break
;
X
(
volatility_
non_volatile
);
X
(
volatility_
is_volatile
);
}
fprintf
(
F
,
"
\n
peculiarity: "
);
switch
(
get_entity_peculiarity
(
ent
))
{
case
description
:
fprintf
(
F
,
"
description
"
);
break
;
case
inherited
:
fprintf
(
F
,
"
inherited
"
);
break
;
case
existent
:
fprintf
(
F
,
"
existent
"
);
break
;
X
(
peculiarity_
description
);
X
(
peculiarity_
inherited
);
X
(
peculiarity_
existent
);
}
fprintf
(
F
,
"
\n
name: %s
\n
ld_name: %s"
,
get_id_str
(
get_entity_ident
(
ent
)),
...
...
@@ -728,6 +736,7 @@ void dump_entity_node(entity *ent) {
}
fprintf
(
F
,
"
\"\n
}
\n
"
);
}
#undef X
/* dumps a type or entity and it's edges. */
static
void
...
...
@@ -754,7 +763,7 @@ dump_type_info (type_or_ent *tore, void *env) {
}
}
/* attached subgraphs */
if
(
const_entities
&&
(
get_entity_variability
(
ent
)
!=
uninitialized
))
{
if
(
const_entities
&&
(
get_entity_variability
(
ent
)
!=
variability_
uninitialized
))
{
if
(
is_atomic_entity
(
ent
))
{
value
=
get_atomic_ent_value
(
ent
);
if
(
value
)
{
...
...
ir/ir/irgwalk.c
View file @
f3c5532f
...
...
@@ -350,16 +350,19 @@ typedef struct walk_env {
}
walk_env
;
/* Walk to all constant expressions in this entity. */
static
void
walk_entity
(
entity
*
ent
,
void
*
env
)
{
static
void
walk_entity
(
entity
*
ent
,
void
*
env
)
{
walk_env
*
my_env
=
(
walk_env
*
)
env
;
if
(
get_entity_variability
(
ent
)
!=
uninitialized
)
{
if
(
get_entity_variability
(
ent
)
!=
variability_uninitialized
)
{
if
(
is_atomic_entity
(
ent
))
{
irg_walk
(
get_atomic_ent_value
(
ent
),
my_env
->
pre
,
my_env
->
post
,
my_env
->
env
);
}
else
{
int
i
;
for
(
i
=
0
;
i
<
get_compound_ent_n_values
(
ent
);
i
++
)
{
}
else
{
int
i
,
n
=
get_compound_ent_n_values
(
ent
);
for
(
i
=
0
;
i
<
n
;
i
++
)
irg_walk
(
get_compound_ent_value
(
ent
,
i
),
my_env
->
pre
,
my_env
->
post
,
my_env
->
env
);
}
}
}
}
...
...
ir/tr/entity.c
View file @
f3c5532f
...
...
@@ -78,27 +78,29 @@ new_entity (type *owner, ident *name, type *type)
res
->
owner
=
owner
;
res
->
name
=
name
;
res
->
type
=
type
;
if
(
get_type_tpop
(
type
)
==
type_method
)
res
->
allocation
=
static_allocated
;
res
->
allocation
=
allocation_static
;
else
res
->
allocation
=
automatic_allocated
;
res
->
visibility
=
local
;
res
->
allocation
=
allocation_automatic
;
res
->
visibility
=
visibility_local
;
res
->
offset
=
-
1
;
if
(
is_method_type
(
type
))
{
res
->
variability
=
constant
;
res
->
variability
=
variability_
constant
;
rem
=
current_ir_graph
;
current_ir_graph
=
get_const_code_irg
();
res
->
value
=
new_Const
(
mode_P_mach
,
new_tarval_from_entity
(
res
,
mode_P_mach
));
current_ir_graph
=
rem
;
}
else
{
res
->
variability
=
uninitialized
;
res
->
value
=
NULL
;
res
->
variability
=
variability_
uninitialized
;
res
->
value
=
NULL
;
res
->
values
=
NULL
;
}
res
->
peculiarity
=
existent
;
res
->
volatility
=
non_volatile
;
res
->
ld_name
=
NULL
;
res
->
overwrites
=
NEW_ARR_F
(
entity
*
,
1
);
res
->
peculiarity
=
peculiarity_
existent
;
res
->
volatility
=
volatility_
non_volatile
;
res
->
ld_name
=
NULL
;
res
->
overwrites
=
NEW_ARR_F
(
entity
*
,
1
);
res
->
overwrittenby
=
NEW_ARR_F
(
entity
*
,
1
);
res
->
irg
=
NULL
;
...
...
@@ -287,10 +289,10 @@ const char *get_allocation_name(ent_allocation all)
{
#define X(a) case a: return #a
switch
(
all
)
{
X
(
a
utomatic_allocated
);
X
(
parameter_allocated
);
X
(
dynamic_allocated
);
X
(
static_allocated
);
X
(
a
llocation_automatic
);
X
(
allocation_parameter
);
X
(
allocation_dynamic
);
X
(
allocation_static
);
default:
return
"BAD VALUE"
;
}
#undef X
...
...
@@ -304,9 +306,9 @@ get_entity_visibility (entity *ent) {
INLINE
void
set_entity_visibility
(
entity
*
ent
,
ent_visibility
vis
)
{
if
(
vis
!=
local
)
assert
((
ent
->
allocation
==
static_allocated
)
||
(
ent
->
allocation
==
a
utomatic_allocated
));
if
(
vis
!=
visibility_
local
)
assert
((
ent
->
allocation
==
allocation_static
)
||
(
ent
->
allocation
==
a
llocation_automatic
));
/* @@@ Test that the owner type is not local, but how??
&& get_class_visibility(get_entity_owner(ent)) != local));*/
ent
->
visibility
=
vis
;
...
...
@@ -317,9 +319,9 @@ const char *get_visibility_name(ent_visibility vis)
{
#define X(a) case a: return #a
switch
(
vis
)
{
X
(
local
);
X
(
external_visible
);
X
(
external_allocated
);
X
(
visibility_
local
);
X
(
visibility_
external_visible
);
X
(
visibility_
external_allocated
);
default:
return
"BAD VALUE"
;
}
#undef X
...
...
@@ -331,17 +333,20 @@ get_entity_variability (entity *ent) {
}
INLINE
void
set_entity_variability
(
entity
*
ent
,
ent_variability
var
){
if
(
var
==
part_constant
)
set_entity_variability
(
entity
*
ent
,
ent_variability
var
)
{
if
(
var
==
variability_part_constant
)
assert
(
is_class_type
(
ent
->
type
)
||
is_struct_type
(
ent
->
type
));
if
((
is_compound_type
(
ent
->
type
))
&&
(
ent
->
variability
==
uninitialized
)
&&
(
var
!=
uninitialized
))
{
(
ent
->
variability
==
variability_
uninitialized
)
&&
(
var
!=
variability_
uninitialized
))
{
/* Allocate datastructures for constant values */
ent
->
values
=
NEW_ARR_F
(
ir_node
*
,
1
);
ent
->
val_paths
=
NEW_ARR_F
(
compound_graph_path
*
,
1
);
}
if
((
is_compound_type
(
ent
->
type
))
&&
(
var
==
uninitialized
)
&&
(
ent
->
variability
!=
uninitialized
))
{
(
var
==
variability_
uninitialized
)
&&
(
ent
->
variability
!=
variability_
uninitialized
))
{
/* Free datastructures for constant values */
DEL_ARR_F
(
ent
->
values
);
DEL_ARR_F
(
ent
->
val_paths
);
...
...
@@ -354,10 +359,10 @@ const char *get_variability_name(ent_variability var)
{
#define X(a) case a: return #a
switch
(
var
)
{
X
(
uninitialized
);
X
(
initialized
);
X
(
part_constant
);
X
(
constant
);
X
(
variability_
uninitialized
);
X
(
variability_
initialized
);
X
(
variability_
part_constant
);
X
(
variability_
constant
);
default:
return
"BAD VALUE"
;
}
#undef X
...
...
@@ -380,8 +385,8 @@ const char *get_volatility_name(ent_volatility var)
{
#define X(a) case a: return #a
switch
(
var
)
{
X
(
non_volatile
);
X
(
is_volatile
);
X
(
volatility_
non_volatile
);
X
(
volatility_
is_volatile
);
default:
return
"BAD VALUE"
;
}
#undef X
...
...
@@ -406,9 +411,9 @@ const char *get_peculiarity_name(peculiarity var)
{
#define X(a) case a: return #a
switch
(
var
)
{
X
(
description
);
X
(
inherited
);
X
(
existent
);
X
(
peculiarity_
description
);
X
(
peculiarity_
inherited
);
X
(
peculiarity_
existent
);
default:
return
"BAD VALUE"
;
}
#undef X
...
...
@@ -416,16 +421,19 @@ const char *get_peculiarity_name(peculiarity var)
/* Set has no effect for existent entities of type method. */
INLINE
ir_node
*
get_atomic_ent_value
(
entity
*
ent
)
{
assert
(
ent
);
assert
(
is_atomic_entity
(
ent
));
assert
((
ent
->
variability
!=
uninitialized
));
get_atomic_ent_value
(
entity
*
ent
)
{
assert
(
ent
);
assert
(
is_atomic_entity
(
ent
));
assert
(
ent
->
variability
!=
variability_uninitialized
);
return
ent
->
value
;
}
INLINE
void
set_atomic_ent_value
(
entity
*
ent
,
ir_node
*
val
)
{
assert
(
ent
&&
is_atomic_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
if
((
is_method_type
(
ent
->
type
))
&&
(
ent
->
peculiarity
==
existent
))
return
;
assert
(
ent
&&
is_atomic_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_uninitialized
));
if
(
is_method_type
(
ent
->
type
)
&&
(
ent
->
peculiarity
==
peculiarity_existent
))
return
;
ent
->
value
=
val
;
}
...
...
@@ -520,40 +528,40 @@ set_compound_graph_path_node(compound_graph_path *gr, int pos, entity *node) {
the compound. */
INLINE
void
add_compound_ent_value_w_path
(
entity
*
ent
,
ir_node
*
val
,
compound_graph_path
*
path
)
{
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
ARR_APP1
(
ir_node
*
,
ent
->
values
,
val
);
ARR_APP1
(
compound_graph_path
*
,
ent
->
val_paths
,
path
);
}
INLINE
void
set_compound_ent_value_w_path
(
entity
*
ent
,
ir_node
*
val
,
compound_graph_path
*
path
,
int
pos
)
{
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
ent
->
values
[
pos
+
1
]
=
val
;
ent
->
val_paths
[
pos
+
1
]
=
path
;
}
INLINE
int
get_compound_ent_n_values
(
entity
*
ent
)
{
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
return
(
ARR_LEN
(
ent
->
values
))
-
1
;
}
INLINE
ir_node
*
get_compound_ent_value
(
entity
*
ent
,
int
pos
)
{
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
return
ent
->
values
[
pos
+
1
];
}
INLINE
compound_graph_path
*
get_compound_ent_value_path
(
entity
*
ent
,
int
pos
)
{
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
return
ent
->
val_paths
[
pos
+
1
];
}
void
remove_compound_ent_value
(
entity
*
ent
,
entity
*
value_ent
)
{
int
i
;
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
for
(
i
=
1
;
i
<
(
ARR_LEN
(
ent
->
val_paths
));
i
++
)
{
compound_graph_path
*
path
=
ent
->
val_paths
[
i
];
if
(
path
->
nodes
[
path
->
len
-
1
]
==
value_ent
)
{
...
...
@@ -570,7 +578,7 @@ remove_compound_ent_value(entity *ent, entity *value_ent) {
INLINE
void
add_compound_ent_value
(
entity
*
ent
,
ir_node
*
val
,
entity
*
member
)
{
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
compound_graph_path
*
path
=
new_compound_graph_path
(
get_entity_owner
(
ent
),
1
);
path
->
nodes
[
0
]
=
member
;
add_compound_ent_value_w_path
(
ent
,
val
,
path
);
...
...
@@ -583,7 +591,7 @@ INLINE void
copy_and_add_compound_ent_value(entity *ent, ir_node *val, entity *member) {
ir_graph *rem = current_ir_graph;
assert(get_entity_variability(ent) != uninitialized);
assert(get_entity_variability(ent) !=
variability_
uninitialized);
current_ir_graph = get_const_code_irg();
val = copy_const_value(val);
...
...
@@ -594,14 +602,14 @@ copy_and_add_compound_ent_value(entity *ent, ir_node *val, entity *member) {
/* Copies the value i of the entity to current_block in current_ir_graph.
ir_node *
copy_compound_ent_value(entity *ent, int pos) {
assert(ent && is_compound_entity(ent) && (ent->variability != uninitialized));
assert(ent && is_compound_entity(ent) && (ent->variability !=
variability_
uninitialized));
return copy_const_value(ent->values[pos+1]);
}*/
INLINE
entity
*
get_compound_ent_value_member
(
entity
*
ent
,
int
pos
)
{
compound_graph_path
*
path
;
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
path
=
get_compound_ent_value_path
(
ent
,
pos
);
assert
(
path
->
len
==
1
);
...
...
@@ -611,7 +619,7 @@ get_compound_ent_value_member(entity *ent, int pos) {
INLINE
void
set_compound_ent_value
(
entity
*
ent
,
ir_node
*
val
,
entity
*
member
,
int
pos
)
{
compound_graph_path
*
path
;
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
uninitialized
));
assert
(
ent
&&
is_compound_entity
(
ent
)
&&
(
ent
->
variability
!=
variability_
uninitialized
));
path
=
get_compound_ent_value_path
(
ent
,
pos
);
set_compound_graph_path_node
(
path
,
0
,
member
);
set_compound_ent_value_w_path
(
ent
,
val
,
path
,
pos
);
...
...
@@ -629,7 +637,7 @@ set_array_entity_values(entity *ent, tarval **values, int num_vals) {
/* One bound is sufficient, the nunmber of constant fields makes the
size. */
assert
(
get_array_lower_bound
(
arrtp
,
0
)
||
get_array_upper_bound
(
arrtp
,
0
));
assert
(
get_entity_variability
(
ent
)
!=
uninitialized
);
assert
(
get_entity_variability
(
ent
)
!=
variability_
uninitialized
);
current_ir_graph
=
get_const_code_irg
();
for
(
i
=
0
;
i
<
num_vals
;
i
++
)
{
...
...
@@ -783,7 +791,7 @@ set_entity_irg(entity *ent, ir_graph *irg) {
* aber erhalten bleiben soll. */
/* assert (irg); */
assert
(
is_method_type
(
ent
->
type
));
assert
(
ent
->
peculiarity
==
existent
);
assert
(
ent
->
peculiarity
==
peculiarity_
existent
);
ent
->
irg
=
irg
;
}
...
...
@@ -832,6 +840,7 @@ void mark_entity_visited(entity *ent) {
INLINE
bool
entity_visited
(
entity
*
ent
)
{
return
get_entity_visited
(
ent
)
>=
type_visited
;
}
INLINE
bool
entity_not_visited
(
entity
*
ent
)
{
return
get_entity_visited
(
ent
)
<
type_visited
;
}
ir/tr/entity.h
View file @
f3c5532f
...
...
@@ -212,16 +212,16 @@ void set_entity_type (entity *ent, type *tp);
/** The allocation type. */
typedef
enum
{
a
utomatic_allocated
,
/**< The entity is allocated during runtime, implicitly
as component of a compound type. This is the default. */
parameter_allocated
,
/**< The entity is a parameter. It is also automatic allocated.
We distinguish the allocation of paramters from the allocation
of local variables as their placement depends on the calling
conventions. */
dynamic_allocated
,
/**< The entity is allocated during runtime, explicitly
by an Alloc node. */
static_allocated
/**< The entity is allocated statically. We can use a
SymConst(?) as address of the entity. */
a
llocation_automatic
,
/**< The entity is allocated during runtime, implicitly
as component of a compound type. This is the default. */
allocation_parameter
,
/**< The entity is a parameter. It is also automatic allocated.
We distinguish the allocation of paramters from the allocation
of local variables as their placement depends on the calling
conventions. */
allocation_dynamic
,
/**< The entity is allocated during runtime, explicitly
by an Alloc node. */
allocation_static
/**< The entity is allocated statically. We can use a
SymConst(?) as address of the entity. */
}
ent_allocation
;
/** Returns the allocation type of an entity. */
...
...
@@ -238,14 +238,14 @@ const char *get_allocation_name(ent_allocation vis);
* for partial compilation.
*/
typedef
enum
{
local
,
/**< The entity is only visible locally. This is the default. */
external_visible
,
/**< The entity is visible to other external program parts, but
it is defined here. It may not be optimized away. The entity must
be static_allocated. */
external_allocated
/**< The entity is defined and allocated externally. This compilation
must not allocate memory for this entity. The entity must
be static_allocated. This can also be an external defined
method. */
visibility_
local
,
/**< The entity is only visible locally. This is the default. */
visibility_
external_visible
,
/**< The entity is visible to other external program parts, but
it is defined here. It may not be optimized away. The entity must
be static_allocated. */
visibility_
external_allocated
/**< The entity is defined and allocated externally. This compilation
must not allocate memory for this entity. The entity must
be static_allocated. This can also be an external defined
method. */
}
ent_visibility
;
/** Returns the visibility of an entity. */
...
...
@@ -259,13 +259,13 @@ const char *get_visibility_name(ent_visibility vis);
/** This enumeration flags the variability of entities. */
typedef
enum
{
uninitialized
,
/**< The content of the entity is completely unknown. */
initialized
,
/**< After allocation the entity is initalized with the
value given somewhere in the entity. */
part_constant
,
/**< For entities of compound types. Some members of the entity
are constant. The others are uninitialized. Those members
given a value for are constant. */
constant
/**< The entity is constant. */
variability_
uninitialized
,
/**< The content of the entity is completely unknown. */
variability_
initialized
,
/**< After allocation the entity is initalized with the
value given somewhere in the entity. */
variability_
part_constant
,
/**< For entities of compound types. Some members of the entity
are constant. The others are uninitialized. Those members
given a value for are constant. */
variability_
constant
/**< The entity is constant. */
}
ent_variability
;
/** Returns the variability of an entity. */
...
...
@@ -279,8 +279,8 @@ const char *get_variability_name(ent_variability var);