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
97e544bb
Commit
97e544bb
authored
Nov 09, 2004
by
Götz Lindenmaier
Browse files
comments, removed unused fields
added unknown entity [r4338]
parent
d4a36c32
Changes
6
Hide whitespace changes
Inline
Side-by-side
ir/tr/entity.c
View file @
97e544bb
...
...
@@ -36,16 +36,25 @@
/** general **/
/*******************************************************************/
entity
*
unknown_entity
=
NULL
;
entity
*
get_unknown_entity
(
void
)
{
return
unknown_entity
;
}
#define UNKNOWN_ENTITY_NAME "unknown_entity"
static
INLINE
entity
*
new_rd_entity
(
dbg_info
*
db
,
type
*
owner
,
ident
*
name
,
type
*
type
);
void
init_entity
(
void
)
{
assert
(
unknown_type
&&
"Call init_type before init_entity!"
);
new_rd_entity
(
NULL
,
unknown_type
,
new_id_from_str
(
UNKNOWN_ENTITY_NAME
),
unknown_type
);
}
/*-----------------------------------------------------------------*/
/* ENTITY */
/*-----------------------------------------------------------------*/
static
void
insert_entity_in_owner
(
entity
*
ent
)
{
static
INLINE
void
insert_entity_in_owner
(
entity
*
ent
)
{
type
*
owner
=
ent
->
owner
;
switch
(
get_type_tpop_code
(
owner
))
{
case
tpo_class
:
{
...
...
@@ -64,8 +73,8 @@ static void insert_entity_in_owner (entity *ent) {
}
}
entity
*
new_entity
(
type
*
owner
,
ident
*
name
,
type
*
type
)
static
INLINE
entity
*
new_
rd_
entity
(
dbg_info
*
db
,
type
*
owner
,
ident
*
name
,
type
*
type
)
{
entity
*
res
;
ir_graph
*
rem
;
...
...
@@ -73,8 +82,8 @@ new_entity (type *owner, ident *name, type *type)
assert
(
!
id_contains_char
(
name
,
' '
)
&&
"entity name should not contain spaces"
);
res
=
(
entity
*
)
xmalloc
(
sizeof
(
entity
));
memset
(
res
,
0
,
sizeof
(
res
));
res
->
kind
=
k_entity
;
assert_legal_owner_of_ent
(
owner
);
res
->
owner
=
owner
;
res
->
name
=
name
;
res
->
type
=
type
;
...
...
@@ -113,7 +122,7 @@ new_entity (type *owner, ident *name, type *type)
}
res
->
irg
=
NULL
;
res
->
accesses
=
NULL
;
//
res->accesses = NULL;
#ifdef DEBUG_libfirm
res
->
nr
=
get_irp_new_node_nr
();
...
...
@@ -121,18 +130,29 @@ new_entity (type *owner, ident *name, type *type)
#endif
/* DEBUG_libfirm */
res
->
visit
=
0
;
set_entity_dbg_info
(
res
,
db
);
/* Remember entity in it's owner. */
insert_entity_in_owner
(
res
);
return
res
;
}
entity
*
new_d_entity
(
type
*
owner
,
ident
*
name
,
type
*
type
,
dbg_info
*
db
)
{
entity
*
res
=
new_entity
(
owner
,
name
,
type
);
set_entity_dbg_info
(
res
,
db
);
assert_legal_owner_of_ent
(
owner
);
entity
*
res
=
new_rd_entity
(
db
,
owner
,
name
,
type
);
/* Remember entity in it's owner. */
insert_entity_in_owner
(
res
);
return
res
;
}
entity
*
new_entity
(
type
*
owner
,
ident
*
name
,
type
*
type
)
{
return
new_d_entity
(
owner
,
name
,
type
,
NULL
);
}
static
void
free_entity_attrs
(
entity
*
ent
)
{
int
i
;
if
(
get_type_tpop
(
get_entity_owner
(
ent
))
==
type_class
)
{
...
...
ir/tr/entity.h
View file @
97e544bb
...
...
@@ -529,5 +529,26 @@ bool entity_not_visited(entity *ent);
* dynamic type are given. */
entity
*
resolve_ent_polymorphy
(
type
*
dynamic_class
,
entity
*
static_ent
);
/**
* @page unknown_entity
*
* This entity is an auxiliary entity dedicated to support analyses.
*
* The unknown entity represents that there could be an entity, but it is not
* known. This entity can be used to initialize fields before an analysis (not known
* yet) or to represent the top of a lattice (could not be determined). There exists
* exactly one entity unknown. This entity has as owner and as type the unknown type. It is
* allocated when initializing the entity module.
*
* The following values are set:
* mode: mode_ANY
* name: "type_unknown"
* state: layout_fixed
* size: 0
*/
/* A variable that contains the only unknown entity. */
extern
entity
*
unknown_entity
;
/* Returns the unknown entity */
entity
*
get_unknown_entity
(
void
);
# endif
/* _ENTITY_H_ */
ir/tr/entity_t.h
View file @
97e544bb
...
...
@@ -109,7 +109,6 @@ struct entity {
/* ------------- fields for analyses ---------------*/
ir_node
**
accesses
;
/**< accessing nodes: loads, stores. */
#ifdef DEBUG_libfirm
int
nr
;
/**< a unique node number for each node to make output
...
...
@@ -118,6 +117,8 @@ struct entity {
# endif
/* DEBUG_libfirm */
};
/* ----------------------- inline functions ------------------------ */
static
INLINE
int
__is_entity
(
const
void
*
thing
)
{
...
...
@@ -225,6 +226,7 @@ __set_entity_peculiarity(entity *ent, peculiarity pec) {
assert
(
ent
&&
ent
->
kind
==
k_entity
);
/* @@@ why peculiarity only for methods? */
assert
(
is_method_type
(
ent
->
type
));
ent
->
peculiarity
=
pec
;
}
...
...
ir/tr/type.h
View file @
97e544bb
...
...
@@ -904,7 +904,7 @@ type *get_none_type(void);
*/
/* A variable that contains the only unknown type. */
extern
type
*
unknown_type
;
/* Returns the
none
type */
/* Returns the
unknown
type */
type
*
get_unknown_type
(
void
);
...
...
ir/tr/type_t.h
View file @
97e544bb
...
...
@@ -131,8 +131,6 @@ struct type {
struct
dbg_info
*
dbi
;
/**< A pointer to information for debug support. */
/* ------------- fields for analyses ---------------*/
ir_node
**
allocations
;
/**< array of all Alloc nodes with this type
@@@ Should not be in here, hash table! */
#ifdef DEBUG_libfirm
int
nr
;
/**< a unique node number for each node to make output
...
...
ir/tr/typewalk.h
View file @
97e544bb
...
...
@@ -99,7 +99,7 @@ void class_walk_super2sub(class_walk_func *pre,
void
*
env
);
/**
* the entity walk function
* the entity walk function
. A function type for entity walkers.
*
* @param ent points to the visited entity
* @param env free environment pointer
...
...
@@ -111,9 +111,10 @@ typedef void entity_walk_func(entity *ent, void *env);
*
* @param tp the type
* @param doit the entity walker function
* @param env environment, wil be passed to the walker function
* @param env environment, wil
l
be passed to the walker function
*/
void
walk_types_entities
(
type
*
tp
,
entity_walk_func
*
doit
,
void
*
env
);
#endif
/* _TYPEWALK_H_ */
Write
Preview
Supports
Markdown
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