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
d745be6d
Commit
d745be6d
authored
Sep 26, 2008
by
Michael Beck
Browse files
simplified code, fixed comments
[r22294]
parent
f1b0a42b
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/libfirm/typerep.h
View file @
d745be6d
...
@@ -403,10 +403,13 @@ void set_entity_backend_marked(ir_entity *ent, int flag);
...
@@ -403,10 +403,13 @@ void set_entity_backend_marked(ir_entity *ent, int flag);
* Bitfield type indicating the way an entity is used.
* Bitfield type indicating the way an entity is used.
*/
*/
typedef
enum
{
typedef
enum
{
ir_usage_address_taken
=
1
<<
0
,
ir_usage_none
=
0
,
/**< This entity is unused. */
ir_usage_write
=
1
<<
1
,
ir_usage_address_taken
=
1
<<
0
,
/**< The address of this entity was taken. */
ir_usage_read
=
1
<<
2
,
ir_usage_write
=
1
<<
1
,
/**< The entity was written to. */
ir_usage_reinterpret_cast
=
1
<<
3
,
ir_usage_read
=
1
<<
2
,
/**< The entity was read. */
ir_usage_reinterpret_cast
=
1
<<
3
,
/**< The entity was read but with a wrong mode
(an implicit reinterpret cast) */
/** Unknown access */
ir_usage_unknown
ir_usage_unknown
=
ir_usage_address_taken
|
ir_usage_write
|
ir_usage_read
=
ir_usage_address_taken
|
ir_usage_write
|
ir_usage_read
|
ir_usage_reinterpret_cast
|
ir_usage_reinterpret_cast
...
...
ir/ana/irmemory.c
View file @
d745be6d
...
@@ -928,38 +928,42 @@ static void init_entity_usage(ir_type * tp) {
...
@@ -928,38 +928,42 @@ static void init_entity_usage(ir_type * tp) {
/* We have to be conservative: All external visible entities are unknown */
/* We have to be conservative: All external visible entities are unknown */
for
(
i
=
get_compound_n_members
(
tp
)
-
1
;
i
>=
0
;
--
i
)
{
for
(
i
=
get_compound_n_members
(
tp
)
-
1
;
i
>=
0
;
--
i
)
{
ir_entity
*
entity
=
get_compound_member
(
tp
,
i
);
ir_entity
*
ent
=
get_compound_member
(
tp
,
i
);
ir_entity_usage
flags
=
0
;
ir_entity_usage
flags
=
ir_usage_none
;
ir_visibility
vis
=
get_entity_visibility
(
ent
);
if
(
get_entity_visibility
(
entity
)
==
visibility_external_visible
||
if
(
vis
==
visibility_external_visible
||
get_entity_visibility
(
entity
)
==
visibility_external_allocated
||
vis
==
visibility_external_allocated
||
get_entity_stickyness
(
ent
ity
)
==
stickyness_sticky
)
{
get_entity_stickyness
(
ent
)
==
stickyness_sticky
)
{
flags
|=
ir_usage_unknown
;
flags
|=
ir_usage_unknown
;
}
}
set_entity_usage
(
ent
,
flags
);
set_entity_usage
(
entity
,
flags
);
}
}
}
}
/**
* Mark all entities used in the initializer as unknown usage.
*
* @param initializer the initializer to check
*/
static
void
check_initializer_nodes
(
ir_initializer_t
*
initializer
)
static
void
check_initializer_nodes
(
ir_initializer_t
*
initializer
)
{
{
switch
(
initializer
->
kind
)
{
unsigned
i
;
case
IR_INITIALIZER_CONST
:
{
ir_node
*
n
;
ir_node
*
n
=
initializer
->
consti
.
value
;
switch
(
initializer
->
kind
)
{
case
IR_INITIALIZER_CONST
:
/* let's check if it's an address */
/* let's check if it's an address */
n
=
initializer
->
consti
.
value
;
if
(
is_Global
(
n
))
{
if
(
is_Global
(
n
))
{
ir_entity
*
ent
=
get_Global_entity
(
n
);
ir_entity
*
ent
=
get_Global_entity
(
n
);
set_entity_usage
(
ent
,
ir_usage_unknown
);
set_entity_usage
(
ent
,
ir_usage_unknown
);
}
}
return
;
return
;
}
case
IR_INITIALIZER_TARVAL
:
case
IR_INITIALIZER_TARVAL
:
case
IR_INITIALIZER_NULL
:
case
IR_INITIALIZER_NULL
:
return
;
return
;
case
IR_INITIALIZER_COMPOUND
:
{
case
IR_INITIALIZER_COMPOUND
:
size_t
i
;
for
(
i
=
0
;
i
<
initializer
->
compound
.
n_initializers
;
++
i
)
{
for
(
i
=
0
;
i
<
initializer
->
compound
.
n_initializers
;
++
i
)
{
ir_initializer_t
*
sub_initializer
ir_initializer_t
*
sub_initializer
=
initializer
->
compound
.
initializers
[
i
];
=
initializer
->
compound
.
initializers
[
i
];
...
@@ -967,12 +971,12 @@ static void check_initializer_nodes(ir_initializer_t *initializer)
...
@@ -967,12 +971,12 @@ static void check_initializer_nodes(ir_initializer_t *initializer)
}
}
return
;
return
;
}
}
}
panic
(
"invalid initializer found"
);
panic
(
"invalid initializer found"
);
}
/* check_initializer_nodes */
}
/* check_initializer_nodes */
/**
/**
* Mark all entities used in the initializer for the given entity as address taken.
* Mark all entities used in the initializer for the given entity as unknown
* usage.
*
*
* @param ent the entity
* @param ent the entity
*/
*/
...
@@ -1013,7 +1017,7 @@ static void check_initializer(ir_entity *ent) {
...
@@ -1013,7 +1017,7 @@ static void check_initializer(ir_entity *ent) {
/**
/**
* Mark all entities used in initializers as
address taken
.
* Mark all entities used in initializers as
unknown usage
.
*
*
* @param tp a compound type
* @param tp a compound type
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment