projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added initialization of fields
[libfirm]
/
ir
/
tr
/
entity.c
diff --git
a/ir/tr/entity.c
b/ir/tr/entity.c
index
90ffd8f
..
5cf9e2e
100644
(file)
--- a/
ir/tr/entity.c
+++ b/
ir/tr/entity.c
@@
-20,7
+20,7
@@
# include "typegmod_t.h"
# include "array.h"
/* All this is needed to build the constant node for methods: */
# include "typegmod_t.h"
# include "array.h"
/* All this is needed to build the constant node for methods: */
-# include "irprog.h"
+# include "irprog
_t
.h"
# include "ircons.h"
/*******************************************************************/
# include "ircons.h"
/*******************************************************************/
@@
-36,7
+36,10
@@
init_entity (void)
/** ENTITY **/
/*******************************************************************/
/** ENTITY **/
/*******************************************************************/
-INLINE type *get_entity_owner (entity *ent);
+/* redeclared to declare INLINE. */
+INLINE entity *get_entity_overwrites (entity *ent, int pos);
+INLINE entity *get_entity_overwrittenby (entity *ent, int pos);
+INLINE type *get_entity_owner (entity *ent);
INLINE void insert_entity_in_owner (entity *ent) {
type *owner = ent->owner;
INLINE void insert_entity_in_owner (entity *ent) {
type *owner = ent->owner;
@@
-85,6
+88,8
@@
new_entity (type *owner, ident *name, type *type)
current_ir_graph = rem;
} else {
res->variability = uninitialized;
current_ir_graph = rem;
} else {
res->variability = uninitialized;
+ res->value = NULL;
+ res->values = NULL;
}
res->peculiarity = existent;
res->volatility = non_volatile;
}
res->peculiarity = existent;
res->volatility = non_volatile;
@@
-94,6
+99,10
@@
new_entity (type *owner, ident *name, type *type)
res->irg = NULL;
res->irg = NULL;
+#ifdef DEBUG_libfirm
+ res->nr = get_irp_new_node_nr();
+#endif
+
res->visit = 0;
/* Remember entity in it's owner. */
res->visit = 0;
/* Remember entity in it's owner. */
@@
-138,6
+147,9
@@
copy_entity_own (entity *old, type *new_owner) {
new->overwrites = NEW_ARR_F(entity *, 1);
new->overwrittenby = NEW_ARR_F(entity *, 1);
}
new->overwrites = NEW_ARR_F(entity *, 1);
new->overwrittenby = NEW_ARR_F(entity *, 1);
}
+#ifdef DEBUG_libfirm
+ new->nr = get_irp_new_node_nr();
+#endif
insert_entity_in_owner (new);
insert_entity_in_owner (new);
@@
-153,20
+165,38
@@
copy_entity_name (entity *old, ident *new_name) {
memcpy (new, old, sizeof (entity));
new->name = new_name;
new->ld_name = NULL;
memcpy (new, old, sizeof (entity));
new->name = new_name;
new->ld_name = NULL;
- new->overwrites = DUP_ARR_F(entity *, old->overwrites);
- new->overwrittenby = DUP_ARR_F(entity *, old->overwrittenby);
+ if (is_class_type(new->owner)) {
+ new->overwrites = DUP_ARR_F(entity *, old->overwrites);
+ new->overwrittenby = DUP_ARR_F(entity *, old->overwrittenby);
+ }
+#ifdef DEBUG_libfirm
+ new->nr = get_irp_new_node_nr();
+#endif
insert_entity_in_owner (new);
return new;
}
insert_entity_in_owner (new);
return new;
}
+
void
free_entity (entity *ent) {
void
free_entity (entity *ent) {
+ free_tv_entity(ent);
free_entity_attrs(ent);
free(ent);
}
free_entity_attrs(ent);
free(ent);
}
+/* Outputs a unique number for this node */
+INLINE long
+get_entity_nr(entity *ent) {
+ assert(ent);
+#ifdef DEBUG_libfirm
+ return ent->nr;
+#else
+ return 0;
+#endif
+}
+
INLINE const char *
get_entity_name (entity *ent) {
assert (ent);
INLINE const char *
get_entity_name (entity *ent) {
assert (ent);