projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set svn:keywords property.
[libfirm]
/
ir
/
tr
/
entity.c
diff --git
a/ir/tr/entity.c
b/ir/tr/entity.c
index
d59f302
..
65af77b
100644
(file)
--- a/
ir/tr/entity.c
+++ b/
ir/tr/entity.c
@@
-63,7
+63,8
@@
ir_entity *get_unknown_entity(void) { return unknown_entity; }
/**
* Add an entity to it's already set owner type.
*/
/**
* Add an entity to it's already set owner type.
*/
-static inline void insert_entity_in_owner(ir_entity *ent) {
+static inline void insert_entity_in_owner(ir_entity *ent)
+{
ir_type *owner = ent->owner;
switch (get_type_tpop_code(owner)) {
case tpo_class:
ir_type *owner = ent->owner;
switch (get_type_tpop_code(owner)) {
case tpo_class:
@@
-93,8
+94,8
@@
static inline void insert_entity_in_owner(ir_entity *ent) {
*
* @return the new created entity
*/
*
* @return the new created entity
*/
-static inline ir_entity *
-
new_rd_entity(dbg_info *db, ir_type *owner,
ident *name, ir_type *type)
+static inline ir_entity *
new_rd_entity(dbg_info *db, ir_type *owner,
+
ident *name, ir_type *type)
{
ir_entity *res;
ir_graph *rem;
{
ir_entity *res;
ir_graph *rem;
@@
-159,8
+160,8
@@
new_rd_entity(dbg_info *db, ir_type *owner, ident *name, ir_type *type)
return res;
} /* new_rd_entity */
return res;
} /* new_rd_entity */
-ir_entity *
-
new_d_entity(ir_type *owner, ident *name, ir_type *type, dbg_info *db)
{
+ir_entity *
new_d_entity(ir_type *owner, ident *name, ir_type *type, dbg_info *db)
+{
ir_entity *res;
assert(is_compound_type(owner));
ir_entity *res;
assert(is_compound_type(owner));
@@
-172,8
+173,8
@@
new_d_entity(ir_type *owner, ident *name, ir_type *type, dbg_info *db) {
return res;
} /* new_d_entity */
return res;
} /* new_d_entity */
-ir_entity *
-
new_entity(ir_type *owner, ident *name, ir_type *type)
{
+ir_entity *
new_entity(ir_type *owner, ident *name, ir_type *type)
+{
return new_d_entity(owner, name, type, NULL);
} /* new_entity */
return new_d_entity(owner, name, type, NULL);
} /* new_entity */
@@
-256,8
+257,8
@@
static ir_entity *deep_entity_copy(ir_entity *old)
* Copies the entity if the new_owner is different from the
* owner of the old entity, else returns the old entity.
*/
* Copies the entity if the new_owner is different from the
* owner of the old entity, else returns the old entity.
*/
-ir_entity *
-
copy_entity_own(ir_entity *old, ir_type *new_owner)
{
+ir_entity *
copy_entity_own(ir_entity *old, ir_type *new_owner)
+{
ir_entity *newe;
assert(is_entity(old));
assert(is_compound_type(new_owner));
ir_entity *newe;
assert(is_entity(old));
assert(is_compound_type(new_owner));
@@
-279,8
+280,8
@@
copy_entity_own(ir_entity *old, ir_type *new_owner) {
return newe;
} /* copy_entity_own */
return newe;
} /* copy_entity_own */
-ir_entity *
-
copy_entity_name(ir_entity *old, ident *new_name)
{
+ir_entity *
copy_entity_name(ir_entity *old, ident *new_name)
+{
ir_entity *newe;
assert(old && old->kind == k_entity);
ir_entity *newe;
assert(old && old->kind == k_entity);
@@
-298,8
+299,8
@@
copy_entity_name(ir_entity *old, ident *new_name) {
return newe;
} /* copy_entity_name */
return newe;
} /* copy_entity_name */
-void
-
free_entity(ir_entity *ent)
{
+void
free_entity(ir_entity *ent)
+{
assert(ent && ent->kind == k_entity);
free_entity_attrs(ent);
ent->kind = k_BAD;
assert(ent && ent->kind == k_entity);
free_entity_attrs(ent);
ent->kind = k_BAD;
@@
-307,8
+308,8
@@
free_entity(ir_entity *ent) {
} /* free_entity */
/* Outputs a unique number for this node */
} /* free_entity */
/* Outputs a unique number for this node */
-long
-
get_entity_nr(const ir_entity *ent)
{
+long
get_entity_nr(const ir_entity *ent)
+{
assert(ent && ent->kind == k_entity);
#ifdef DEBUG_libfirm
return ent->nr;
assert(ent && ent->kind == k_entity);
#ifdef DEBUG_libfirm
return ent->nr;
@@
-317,28
+318,28
@@
get_entity_nr(const ir_entity *ent) {
#endif
} /* get_entity_nr */
#endif
} /* get_entity_nr */
-const char *
-
(get_entity_name)(const ir_entity *ent)
{
+const char *
(get_entity_name)(const ir_entity *ent)
+{
return _get_entity_name(ent);
}
return _get_entity_name(ent);
}
-ident *
-
(get_entity_ident)(const ir_entity *ent)
{
+ident *
(get_entity_ident)(const ir_entity *ent)
+{
return _get_entity_ident(ent);
}
return _get_entity_ident(ent);
}
-void
-
(set_entity_ident)(ir_entity *ent, ident *id)
{
+void
(set_entity_ident)(ir_entity *ent, ident *id)
+{
_set_entity_ident(ent, id);
}
_set_entity_ident(ent, id);
}
-ir_type *
-
(get_entity_owner)(const ir_entity *ent)
{
+ir_type *
(get_entity_owner)(const ir_entity *ent)
+{
return _get_entity_owner(ent);
}
return _get_entity_owner(ent);
}
-void
-
set_entity_owner(ir_entity *ent, ir_type *owner)
{
+void
set_entity_owner(ir_entity *ent, ir_type *owner)
+{
assert(is_entity(ent));
assert(is_compound_type(owner));
ent->owner = owner;
assert(is_entity(ent));
assert(is_compound_type(owner));
ent->owner = owner;
@@
-349,8
+350,8
@@
ident *(get_entity_ld_ident)(const ir_entity *ent)
return _get_entity_ld_ident(ent);
}
return _get_entity_ld_ident(ent);
}
-void
-
(set_entity_ld_ident)(ir_entity *ent, ident *ld_ident)
{
+void
(set_entity_ld_ident)(ir_entity *ent, ident *ld_ident)
+{
_set_entity_ld_ident(ent, ld_ident);
}
_set_entity_ld_ident(ent, ld_ident);
}
@@
-359,23
+360,23
@@
const char *(get_entity_ld_name)(const ir_entity *ent)
return _get_entity_ld_name(ent);
}
return _get_entity_ld_name(ent);
}
-ir_type *
-
(get_entity_type)(const ir_entity *ent)
{
+ir_type *
(get_entity_type)(const ir_entity *ent)
+{
return _get_entity_type(ent);
}
return _get_entity_type(ent);
}
-void
-
(set_entity_type)(ir_entity *ent, ir_type *type)
{
+void
(set_entity_type)(ir_entity *ent, ir_type *type)
+{
_set_entity_type(ent, type);
}
_set_entity_type(ent, type);
}
-ir_volatility
-
(get_entity_volatility)(const ir_entity *ent)
{
+ir_volatility
(get_entity_volatility)(const ir_entity *ent)
+{
return _get_entity_volatility(ent);
}
return _get_entity_volatility(ent);
}
-void
-
(set_entity_volatility)(ir_entity *ent, ir_volatility vol)
{
+void
(set_entity_volatility)(ir_entity *ent, ir_volatility vol)
+{
_set_entity_volatility(ent, vol);
}
_set_entity_volatility(ent, vol);
}
@@
-391,23
+392,23
@@
const char *get_volatility_name(ir_volatility var)
#undef X
} /* get_volatility_name */
#undef X
} /* get_volatility_name */
-ir_align
-
(get_entity_aligned)(const ir_entity *ent)
{
+ir_align
(get_entity_aligned)(const ir_entity *ent)
+{
return _get_entity_aligned(ent);
}
return _get_entity_aligned(ent);
}
-void
-
(set_entity_aligned)(ir_entity *ent, ir_align a)
{
+void
(set_entity_aligned)(ir_entity *ent, ir_align a)
+{
_set_entity_aligned(ent, a);
}
_set_entity_aligned(ent, a);
}
-unsigned
-
(get_entity_alignment)(const ir_entity *ent)
{
+unsigned
(get_entity_alignment)(const ir_entity *ent)
+{
return _get_entity_alignment(ent);
}
return _get_entity_alignment(ent);
}
-void
-
(set_entity_alignment)(ir_entity *ent, unsigned alignment)
{
+void
(set_entity_alignment)(ir_entity *ent, unsigned alignment)
+{
_set_entity_alignment(ent, alignment);
}
_set_entity_alignment(ent, alignment);
}
@@
-423,8
+424,7
@@
const char *get_align_name(ir_align a)
#undef X
} /* get_align_name */
#undef X
} /* get_align_name */
-void
-set_entity_label(ir_entity *ent, ir_label_t label)
+void set_entity_label(ir_entity *ent, ir_label_t label)
{
ent->attr.code_attr.label = label;
}
{
ent->attr.code_attr.label = label;
}
@@
-474,20
+474,24
@@
void remove_entity_linkage(ir_entity *entity, ir_linkage linkage)
}
/* Checks if an entity is compiler generated */
}
/* Checks if an entity is compiler generated */
-int (is_entity_compiler_generated)(const ir_entity *ent) {
+int (is_entity_compiler_generated)(const ir_entity *ent)
+{
return _is_entity_compiler_generated(ent);
} /* is_entity_compiler_generated */
/* Sets/resets the compiler generated flag */
return _is_entity_compiler_generated(ent);
} /* is_entity_compiler_generated */
/* Sets/resets the compiler generated flag */
-void (set_entity_compiler_generated)(ir_entity *ent, int flag) {
+void (set_entity_compiler_generated)(ir_entity *ent, int flag)
+{
_set_entity_compiler_generated(ent, flag);
} /* set_entity_compiler_generated */
_set_entity_compiler_generated(ent, flag);
} /* set_entity_compiler_generated */
-ir_entity_usage (get_entity_usage)(const ir_entity *ent) {
+ir_entity_usage (get_entity_usage)(const ir_entity *ent)
+{
return _get_entity_usage(ent);
}
return _get_entity_usage(ent);
}
-void (set_entity_usage)(ir_entity *ent, ir_entity_usage flags) {
+void (set_entity_usage)(ir_entity *ent, ir_entity_usage flags)
+{
_set_entity_usage(ent, flags);
}
_set_entity_usage(ent, flags);
}
@@
-526,7
+530,6
@@
void set_atomic_ent_value(ir_entity *entity, ir_node *val)
ir_initializer_t *initializer;
assert(is_atomic_entity(entity));
ir_initializer_t *initializer;
assert(is_atomic_entity(entity));
- assert(get_entity_peculiarity(entity) != peculiarity_description);
assert(is_Dummy(val) || get_irn_mode(val) == get_type_mode(entity->type));
initializer = create_initializer_const(val);
assert(is_Dummy(val) || get_irn_mode(val) == get_type_mode(entity->type));
initializer = create_initializer_const(val);
@@
-535,7
+538,8
@@
void set_atomic_ent_value(ir_entity *entity, ir_node *val)
/* Returns true if the the node is representable as code on
* const_code_irg. */
/* Returns true if the the node is representable as code on
* const_code_irg. */
-int is_irn_const_expression(ir_node *n) {
+int is_irn_const_expression(ir_node *n)
+{
ir_mode *m;
/* we are in danger iff an exception will arise. TODO: be more precisely,
ir_mode *m;
/* we are in danger iff an exception will arise. TODO: be more precisely,
@@
-563,7
+567,8
@@
int is_irn_const_expression(ir_node *n) {
* Copies a firm subgraph that complies to the restrictions for
* constant expressions to current_block in current_ir_graph.
*/
* Copies a firm subgraph that complies to the restrictions for
* constant expressions to current_block in current_ir_graph.
*/
-ir_node *copy_const_value(dbg_info *dbg, ir_node *n) {
+ir_node *copy_const_value(dbg_info *dbg, ir_node *n)
+{
ir_node *nn;
ir_mode *m;
ir_node *nn;
ir_mode *m;
@@
-604,9
+609,7
@@
ir_node *copy_const_value(dbg_info *dbg, ir_node *n) {
case iro_Unknown:
nn = new_Unknown(m); break;
default:
case iro_Unknown:
nn = new_Unknown(m); break;
default:
- assert(0 && "opcode invalid or not implemented");
- nn = NULL;
- break;
+ panic("opcode invalid or not implemented");
}
return nn;
} /* copy_const_value */
}
return nn;
} /* copy_const_value */
@@
-668,7
+671,7
@@
ir_initializer_t *create_initializer_compound(unsigned n_entries)
initializer->kind = IR_INITIALIZER_COMPOUND;
initializer->compound.n_initializers = n_entries;
initializer->kind = IR_INITIALIZER_COMPOUND;
initializer->compound.n_initializers = n_entries;
- for(i = 0; i < n_entries; ++i) {
+ for
(i = 0; i < n_entries; ++i) {
initializer->compound.initializers[i] = get_initializer_null();
}
initializer->compound.initializers[i] = get_initializer_null();
}
@@
-720,13
+723,17
@@
static void check_entity_initializer(ir_entity *entity)
{
#ifndef NDEBUG
ir_initializer_t *initializer = entity->initializer;
{
#ifndef NDEBUG
ir_initializer_t *initializer = entity->initializer;
+ ir_type *entity_tp = get_entity_type(entity);
switch (initializer->kind) {
case IR_INITIALIZER_COMPOUND:
switch (initializer->kind) {
case IR_INITIALIZER_COMPOUND:
- assert(is_compound_
entity(entity
));
+ assert(is_compound_
type(entity_tp
));
break;
case IR_INITIALIZER_CONST:
break;
case IR_INITIALIZER_CONST:
+ /* methods are initialized by a SymConst */
+ assert(is_atomic_type(entity_tp) || is_Method_type(entity_tp));
+ break;
case IR_INITIALIZER_TARVAL:
case IR_INITIALIZER_TARVAL:
- assert(is_atomic_
entity(entity
));
+ assert(is_atomic_
type(entity_tp
));
break;
case IR_INITIALIZER_NULL:
break;
break;
case IR_INITIALIZER_NULL:
break;
@@
-875,7
+882,7
@@
void remove_entity_overwrittenby(ir_entity *ent, ir_entity *overwrites)
n = ARR_LEN(ent->overwrittenby);
for (i = 0; i < n; ++i) {
if (ent->overwrittenby[i] == overwrites) {
n = ARR_LEN(ent->overwrittenby);
for (i = 0; i < n; ++i) {
if (ent->overwrittenby[i] == overwrites) {
- for(; i < n - 1; ++i)
+ for
(; i < n - 1; ++i)
ent->overwrittenby[i] = ent->overwrittenby[i+1];
ARR_SETLEN(ir_entity*, ent->overwrittenby, n - 1);
break;
ent->overwrittenby[i] = ent->overwrittenby[i+1];
ARR_SETLEN(ir_entity*, ent->overwrittenby, n - 1);
break;