Commit 31eaa75d authored by Michael Beck's avatar Michael Beck
Browse files

rename type entity into ir_entity

[r8456]
parent db258b68
......@@ -128,9 +128,9 @@ static void do_mode_conv(ir_node *n, void *env)
/* special case: fix the Return */
if (is_Return(n)) {
entity *ent = get_irg_entity(current_ir_graph);
ir_type *mt = get_entity_type(ent);
int i, n_ress = get_method_n_ress(mt);
ir_entity *ent = get_irg_entity(current_ir_graph);
ir_type *mt = get_entity_type(ent);
int i, n_ress = get_method_n_ress(mt);
mode = mode_is_signed(mode) ? wenv->s_mode : wenv->u_mode;
block = get_nodes_block(n);
......
......@@ -59,11 +59,11 @@ get_irn_dbg_info(const ir_node *n) {
/* Routines to access the field of an entity containing the
debugging information. */
void set_entity_dbg_info(entity *ent, dbg_info* db) {
void set_entity_dbg_info(ir_entity *ent, dbg_info* db) {
ent->dbi = db;
}
dbg_info *get_entity_dbg_info(entity *ent) {
dbg_info *get_entity_dbg_info(ir_entity *ent) {
return ent->dbi;
}
......
......@@ -65,12 +65,12 @@ dbg_info *get_irn_dbg_info(const ir_node *n);
/**
* Sets the debug information of an entity.
*/
void set_entity_dbg_info(entity *ent, dbg_info *db);
void set_entity_dbg_info(ir_entity *ent, dbg_info *db);
/**
* Returns the debug information of an entity.
*/
dbg_info *get_entity_dbg_info(entity *ent);
dbg_info *get_entity_dbg_info(ir_entity *ent);
/**
* Sets the debug information of a type.
......
......@@ -312,7 +312,7 @@ static void dbg_free_graph(void *ctx, ir_graph *irg)
}
{
bp_ident_t key, *elem;
entity *ent = get_irg_entity(irg);
ir_entity *ent = get_irg_entity(irg);
if (! ent)
return;
......@@ -334,7 +334,7 @@ static void dbg_free_graph(void *ctx, ir_graph *irg)
* @param ctx the hook context
* @param ent the newly created entity
*/
static void dbg_new_entity(void *ctx, entity *ent)
static void dbg_new_entity(void *ctx, ir_entity *ent)
{
{
bp_ident_t key, *elem;
......@@ -729,14 +729,14 @@ typedef struct find_env {
long nr; /**< the number that is searched for */
const char *name; /**< the name that is searched for */
} u;
entity *res; /**< the result */
ir_entity *res; /**< the result */
} find_env_t;
/**
* Type-walker: Find an entity with given number.
*/
static void check_ent_nr(type_or_ent *tore, void *ctx) {
entity *ent = (entity *)tore;
ir_entity *ent = (ir_entity *)tore;
find_env_t *env = ctx;
if (is_entity(ent))
......@@ -749,7 +749,7 @@ static void check_ent_nr(type_or_ent *tore, void *ctx) {
* Type-walker: Find an entity with given name.
*/
static void check_ent_name(type_or_ent *tore, void *ctx) {
entity *ent = (entity *)tore;
ir_entity *ent = (ir_entity *)tore;
find_env_t *env = ctx;
if (is_entity(ent))
......@@ -761,7 +761,7 @@ static void check_ent_name(type_or_ent *tore, void *ctx) {
/**
* Find a firm entity by its number.
*/
static entity *find_entity_nr(long nr) {
static ir_entity *find_entity_nr(long nr) {
find_env_t env;
env.u.nr = nr;
......@@ -773,7 +773,7 @@ static entity *find_entity_nr(long nr) {
/**
* Find a firm entity by its name.
*/
static entity *find_entity_name(const char *name) {
static ir_entity *find_entity_name(const char *name) {
find_env_t env;
env.u.name = name;
......@@ -789,7 +789,7 @@ static void show_by_name(type_or_ent *tore, void *env) {
ident *id = (ident *)env;
if (is_entity(tore)) {
entity *ent = (entity *)tore;
ir_entity *ent = (ir_entity *)tore;
if (is_method_entity(ent)) {
if (get_entity_ident(ent) == id) {
......@@ -817,7 +817,7 @@ static void show_by_ldname(type_or_ent *tore, void *env) {
ident *id = (ident *)env;
if (is_entity(tore)) {
entity *ent = (entity *)tore;
ir_entity *ent = (ir_entity *)tore;
if (is_method_entity(ent)) {
if (get_entity_ld_ident(ent) == id) {
......
......@@ -290,7 +290,7 @@ static void firm_ycomp_debug_new_node(void *context, ir_graph *graph, ir_node *n
/**
* Clear the old irg if it has some data and create a new one.
*/
static void firm_ycomp_debug_new_irg(void *context, ir_graph *irg, entity *ent) {
static void firm_ycomp_debug_new_irg(void *context, ir_graph *irg, ir_entity *ent) {
firm_ycomp_dbg_t *dbg = context;
char buf[SEND_BUF_SIZE];
......
......@@ -49,13 +49,13 @@
typedef struct _ent_leaves_t{
entity *ent; /**< An entity, that contains scalars for replace.*/
ir_entity *ent; /**< An entity, that contains scalars for replace.*/
pset *leaves; /**< All leaves of this entity.*/
} ent_leaves_t;
typedef struct _sels_t {
ir_node *sel; /**< A sel node, thats entity have scalars.*/
entity *ent; /**< The entity of this sel node.*/
ir_entity *ent; /**< The entity of this sel node.*/
}sels_t;
typedef struct _call_access_t {
......@@ -88,7 +88,7 @@ typedef struct _leave_t {
* accesses like a.b.c[8].d
*/
typedef union {
entity *ent;
ir_entity *ent;
tarval *tv;
} path_elem_t;
......@@ -140,8 +140,8 @@ static int ent_leaves_t_cmp(const void *elt, const void *key, size_t size)
*/
static int ent_cmp(const void *elt, const void *key)
{
const entity *c1 = elt;
const entity *c2 = key;
const ir_entity *c1 = elt;
const ir_entity *c2 = key;
return c1 != c2;
}
......@@ -285,7 +285,7 @@ static int is_address_taken(ir_node *sel)
* @param ent the entity that will be scalar replaced
* @param sel a Sel node that selects some fields of this entity
*/
static void link_all_leave_sels(entity *ent, ir_node *sel)
static void link_all_leave_sels(ir_entity *ent, ir_node *sel)
{
int i, n;
......@@ -353,7 +353,7 @@ static int find_possible_replacements(ir_graph *irg)
ir_node *succ = get_irn_out(irg_frame, i);
if (get_irn_op(succ) == op_Sel) {
entity *ent = get_Sel_entity(succ);
ir_entity *ent = get_Sel_entity(succ);
set_entity_link(ent, NULL);
}
}
......@@ -367,7 +367,7 @@ static int find_possible_replacements(ir_graph *irg)
ir_node *succ = get_irn_out(irg_frame, i);
if (get_irn_op(succ) == op_Sel) {
entity *ent = get_Sel_entity(succ);
ir_entity *ent = get_Sel_entity(succ);
ir_type *ent_type;
if (get_entity_link(ent) == ADDRESS_TAKEN)
......@@ -468,7 +468,7 @@ static path_t *find_path(ir_node *sel, unsigned len)
*
* @return the next free value number
*/
static unsigned allocate_value_numbers(set *set_sels, pset *leaves, entity *ent, unsigned vnum)
static unsigned allocate_value_numbers(set *set_sels, pset *leaves, ir_entity *ent, unsigned vnum)
{
ir_node *sel, *next;
path_t *key, *path;
......@@ -612,13 +612,13 @@ static void sync_stored_scalars(ir_node *blk, env_t *env) {
val_arr = get_irn_link(pred);
if(val_arr[GET_ENT_VNUM(value_ent->ent)].access_type == SYNCED)
/* This entity was synced.*/
continue;
/* This entity was synced.*/
continue;
if(val_arr[GET_ENT_VNUM(value_ent->ent)].access_type <= 3) {
/* To avoid repeated sync of this entity in this block.*/
val_arr[GET_ENT_VNUM(value_ent->ent)].access_type = SYNCED;
/* To avoid repeated sync of this entity in this block.*/
val_arr[GET_ENT_VNUM(value_ent->ent)].access_type = SYNCED;
/* In this predecessor block is this entity not acessed.
* We must sync in the end ot this block.*/
if(get_Block_n_cfgpreds(blk) > 1)
......@@ -791,7 +791,7 @@ static void split_call_mem_edge(env_t *env, ir_node *call, pset *accessed_entiti
call_access_t key_call, *value_call;
ir_node *call_blk, *new_mem_state, *leave;
ir_node *sync, **in;
entity *ent;
ir_entity *ent;
unsigned ent_vnum;
int fix_irn = 0; /**< Set to 1 if we must add this call to it fix list.*/
int *accessed_leaves_vnum = NULL; /**< An arraw, where are saved the value number, that
......@@ -1213,7 +1213,7 @@ static void analyse_calls(ir_node *irn, void *ctx) {
unsigned int acces_type;
ir_node *param, *call_ptr, *blk;
ir_op *op;
entity *meth_ent;
ir_entity *meth_ent;
sels_t key_sels, *value_sels;
call_access_t key_call, *value_call;
value_arr_entry_t *val_arr;
......@@ -1330,7 +1330,7 @@ static void set_block_access(ir_node *irn, void *ctx){
vnum = GET_ENT_VNUM(value_leaves->ent);
if((get_Block_n_cfgpreds(irn) > 1) && (val_arr[vnum].access_type > 3))
env->changes = set_block_dominated_first_access(irn, vnum, val_arr[vnum].access_type);
env->changes = set_block_dominated_first_access(irn, vnum, val_arr[vnum].access_type);
if((val_arr_pred[vnum].access_type > 3) && (val_arr[vnum].access_type < 3)) {
/* We have found a block for update it access and value number information.*/
......@@ -1511,7 +1511,7 @@ void data_flow_scalar_replacement_opt(ir_graph *irg) {
ir_node *succ = get_irn_out(irg_frame, i);
if (get_irn_op(succ) == op_Sel) {
entity *ent = get_Sel_entity(succ);
ir_entity *ent = get_Sel_entity(succ);
if (get_entity_link(ent) == NULL || get_entity_link(ent) == ADDRESS_TAKEN)
continue;
......
......@@ -42,7 +42,7 @@ static void collect_calls(ir_node *node, void *env)
{
env_t *ctx = env;
ir_node *call, *ptr;
entity *ent;
ir_entity *ent;
unsigned mode;
if (is_Call(node)) {
......@@ -330,8 +330,8 @@ static unsigned _follow_mem(ir_node *node) {
ptr = get_Call_ptr(node);
if (get_irn_op(ptr) == op_SymConst &&
get_SymConst_kind(ptr) == symconst_addr_ent) {
entity *ent = get_SymConst_entity(ptr);
ir_graph *irg = get_entity_irg(ent);
ir_entity *ent = get_SymConst_entity(ptr);
ir_graph *irg = get_entity_irg(ent);
if (irg == current_ir_graph) {
/* A recursive call. The did not mode depend on this call */
......
......@@ -271,7 +271,7 @@ static void collect_nodes(ir_node *node, void *env)
/**
* Returns an entity if the address ptr points to a constant one.
*/
static entity *find_constant_entity(ir_node *ptr)
static ir_entity *find_constant_entity(ir_node *ptr)
{
for (;;) {
ir_op *op = get_irn_op(ptr);
......@@ -280,8 +280,8 @@ static entity *find_constant_entity(ir_node *ptr)
return get_SymConst_entity(ptr);
}
else if (op == op_Sel) {
entity *ent = get_Sel_entity(ptr);
ir_type *tp = get_entity_owner(ent);
ir_entity *ent = get_Sel_entity(ptr);
ir_type *tp = get_entity_owner(ent);
/* Do not fiddle with polymorphism. */
if (is_Class_type(get_entity_owner(ent)) &&
......@@ -350,7 +350,7 @@ static long get_Sel_array_index_long(ir_node *n, int dim) {
*/
static compound_graph_path *rec_get_accessed_path(ir_node *ptr, int depth) {
compound_graph_path *res = NULL;
entity *root, *field;
ir_entity *root, *field;
int path_len, pos;
if (get_irn_op(ptr) == op_SymConst) {
......@@ -575,7 +575,7 @@ static unsigned optimize_load(ir_node *load)
{
ldst_info_t *info = get_irn_link(load);
ir_node *mem, *ptr, *new_node;
entity *ent;
ir_entity *ent;
unsigned res = 0;
/* do NOT touch volatile loads for now */
......@@ -599,9 +599,9 @@ static unsigned optimize_load(ir_node *load)
if (get_irn_op(skip_Proj(mem)) == op_Alloc) {
/* ok, check the types */
entity *ent = get_Sel_entity(ptr);
ir_type *s_type = get_entity_type(ent);
ir_type *a_type = get_Alloc_type(mem);
ir_entity *ent = get_Sel_entity(ptr);
ir_type *s_type = get_entity_type(ent);
ir_type *a_type = get_Alloc_type(mem);
if (is_SubClass_of(s_type, a_type)) {
/* ok, condition met: there can't be an exception because
......@@ -713,7 +713,7 @@ static unsigned optimize_load(ir_node *load)
{
int j;
for (j = 0; j < get_compound_graph_path_length(path); ++j) {
entity *node = get_compound_graph_path_node(path, j);
ir_entity *node = get_compound_graph_path_node(path, j);
fprintf(stdout, ".%s", get_entity_name(node));
if (is_Array_type(get_entity_owner(node)))
fprintf(stdout, "[%d]", get_compound_graph_path_array_index(path, j));
......
......@@ -31,7 +31,7 @@
*/
void opt_frame_irg(ir_graph *irg) {
ir_type *frame_tp = get_irg_frame_type(irg);
entity *ent, *list;
ir_entity *ent, *list;
ir_node *frame, *sel;
int i, n = get_class_n_members(frame_tp);
......
......@@ -84,7 +84,7 @@ static ir_type *get_dynamic_type(ir_node *ptr) {
/**
* Check, if a entity is final, i.e. is not anymore overridden.
*/
static int is_final_ent(entity *ent) {
static int is_final_ent(ir_entity *ent) {
if (get_entity_final(ent)) {
/* not possible to override this entity. */
return 1;
......@@ -102,9 +102,9 @@ static int is_final_ent(entity *ent) {
*/
ir_node *transform_node_Sel(ir_node *node)
{
ir_node *new_node, *ptr;
ir_type *dyn_tp;
entity *ent = get_Sel_entity(node);
ir_node *new_node, *ptr;
ir_type *dyn_tp;
ir_entity *ent = get_Sel_entity(node);
if (get_irp_phase_state() == phase_building) return node;
......@@ -137,7 +137,7 @@ ir_node *transform_node_Sel(ir_node *node)
dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
if (dyn_tp != firm_unknown_type) {
entity *called_ent;
ir_entity *called_ent;
ir_node *rem_block;
/* We know which method will be called, no dispatch necessary. */
......@@ -168,7 +168,7 @@ ir_node *transform_node_Sel(ir_node *node)
ir_node *transform_node_Load(ir_node *n)
{
ir_node *field_ptr, *new_node, *ptr;
entity *ent;
ir_entity *ent;
ir_type *dyn_tp;
if (!(get_opt_optimize() && get_opt_dyn_meth_dispatch()))
......@@ -197,7 +197,7 @@ ir_node *transform_node_Load(ir_node *n)
dyn_tp = get_dynamic_type(ptr); /* The runtime type of ptr. */
if (dyn_tp != firm_unknown_type) {
entity *loaded_ent;
ir_entity *loaded_ent;
/* We know which method will be called, no dispatch necessary. */
loaded_ent = resolve_ent_polymorphy(dyn_tp, ent);
......
......@@ -59,7 +59,7 @@
* decide if this function must be cloned.
*/
typedef struct quadruple {
entity *ent; /**< The entity of our Call. */
ir_entity *ent; /**< The entity of our Call. */
int pos; /**< Position of a constant argument of our Call. */
tarval *tv; /**< The tarval of this argument if Const node. */
ir_node **calls; /**< The list of all calls with the same characteristics */
......@@ -120,7 +120,7 @@ static void kill_entry(entry_t *entry) {
* @param callee The entity of the callee
* @param hmap The quadruple-set containing the calls with constant parameters
*/
static void process_call(ir_node *call, entity *callee, q_set *hmap)
static void process_call(ir_node *call, ir_entity *callee, q_set *hmap)
{
ir_type *mtp;
entry_t *key, *entry;
......@@ -184,7 +184,7 @@ static void collect_irg_calls(ir_node *call, void *env)
{
q_set *hmap = env;
ir_node *call_ptr;
entity *callee;
ir_entity *callee;
/* We collect just "Call" nodes */
if (is_Call(call)) {
......@@ -345,7 +345,7 @@ static ir_node *get_irg_arg(ir_graph *irg, int pos)
* @param ent The entity of the method that must be cloned.
* @param q Our quadruplet.
*/
static void create_clone_proc_irg(entity *ent, quad_t *q)
static void create_clone_proc_irg(ir_entity *ent, quad_t *q)
{
ir_graph *method_irg, *clone_irg;
ir_node *arg, *const_arg;
......@@ -384,7 +384,7 @@ static void create_clone_proc_irg(entity *ent, quad_t *q)
* @param ent The entity of the clone.
* @param nr A pointer to the counter of clones.
**/
static void change_entity_type(quad_t *q, entity *ent, unsigned *nr)
static void change_entity_type(quad_t *q, ir_entity *ent, unsigned *nr)
{
ir_type *mtp, *new_mtp, *tp;
ident *tp_name;
......@@ -422,9 +422,9 @@ static void change_entity_type(quad_t *q, entity *ent, unsigned *nr)
*
* @param q Contains information for the method to clone.
*/
static entity *clone_method(quad_t *q)
static ir_entity *clone_method(quad_t *q)
{
entity *new_entity;
ir_entity *new_entity;
ident *clone_ident;
ir_graph *rem;
symconst_symbol sym;
......@@ -469,7 +469,7 @@ static entity *clone_method(quad_t *q)
* @param new_entity The entity of the cloned function.
* @param pos The position of the replaced parameter of this call.
**/
static ir_node *new_cl_Call(ir_node *call, entity *new_entity, int pos)
static ir_node *new_cl_Call(ir_node *call, ir_entity *new_entity, int pos)
{
ir_node **in;
ir_type *mtp;
......@@ -504,7 +504,7 @@ static ir_node *new_cl_Call(ir_node *call, entity *new_entity, int pos)
* @param cloned_ent The entity of the new function that must be called
* from the new Call.
*/
static void exchange_calls(quad_t *q, entity *cloned_ent)
static void exchange_calls(quad_t *q, ir_entity *cloned_ent)
{
int pos = q->pos;
ir_node *new_call, *call;
......@@ -540,7 +540,7 @@ static void reorder_weights(q_set *hmap, float threshold)
{
entry_t **adr, *p, *entry;
int i, len;
entity *callee;
ir_entity *callee;
restart:
entry = hmap->heavy_uses;
......@@ -682,7 +682,7 @@ void proc_cloning(float threshold)
entry = hmap.heavy_uses;
if (entry) {
entity *ent = clone_method(&entry->q);
ir_entity *ent = clone_method(&entry->q);
hmap.heavy_uses = entry->next;
......
......@@ -48,7 +48,7 @@
* accesses like a.b.c[8].d
*/
typedef union {
entity *ent;
ir_entity *ent;
tarval *tv;
} path_elem_t;
......@@ -66,7 +66,7 @@ typedef struct _path_t {
#define PATH_SIZE(p) (sizeof(*(p)) + sizeof((p)->path[0]) * ((p)->path_len - 1))
typedef struct _scalars_t {
entity *ent; /**< A entity for scalar replacement. */
ir_entity *ent; /**< A entity for scalar replacement. */
ir_type *ent_owner; /**< The owner of this entity. */
} scalars_t;
......@@ -167,7 +167,7 @@ int is_address_taken(ir_node *sel)
int i;
ir_mode *emode, *mode;
ir_node *value;
entity *ent;
ir_entity *ent;
if (! is_const_sel(sel))
return 1;
......@@ -228,7 +228,7 @@ int is_address_taken(ir_node *sel)
* @param ent the entity that will be scalar replaced
* @param sel a Sel node that selects some fields of this entity
*/
static void link_all_leave_sels(entity *ent, ir_node *sel)
static void link_all_leave_sels(ir_entity *ent, ir_node *sel)
{
int i, n, flag = 1;
......@@ -300,7 +300,7 @@ static int find_possible_replacements(ir_graph *irg)
ir_node *succ = get_irn_out(irg_frame, i);
if (is_Sel(succ)) {
entity *ent = get_Sel_entity(succ);
ir_entity *ent = get_Sel_entity(succ);
set_entity_link(ent, NULL);
}
}
......@@ -314,7 +314,7 @@ static int find_possible_replacements(ir_graph *irg)
ir_node *succ = get_irn_out(irg_frame, i);
if (is_Sel(succ)) {
entity *ent = get_Sel_entity(succ);
ir_entity *ent = get_Sel_entity(succ);
ir_type *ent_type;
if (get_entity_link(ent) == ADDRESS_TAKEN)
......@@ -402,7 +402,7 @@ static path_t *find_path(ir_node *sel, unsigned len)
*
* @return the next free value number
*/
static unsigned allocate_value_numbers(pset *sels, entity *ent, unsigned vnum, ir_mode ***modes)
static unsigned allocate_value_numbers(pset *sels, ir_entity *ent, unsigned vnum, ir_mode ***modes)
{
ir_node *sel, *next;
path_t *key, *path;
......@@ -780,7 +780,7 @@ void scalar_replacement_opt(ir_graph *irg)
ir_node *succ = get_irn_out(irg_frame, i);
if (is_Sel(succ)) {
entity *ent = get_Sel_entity(succ);
ir_entity *ent = get_Sel_entity(succ);
if (get_entity_link(ent) == NULL || get_entity_link(ent) == ADDRESS_TAKEN)
continue;
......
......@@ -38,10 +38,10 @@ static int n_made_new_phis;
* @verbatim
*
* init
* /|\
* ^
* |
* +-- Phi
* | /|\
* | ^
* | |
* +-->op
*
......@@ -568,12 +568,13 @@ static void reduce_itervar(ir_node *itervar_phi, void *env)
/* check if a iteration variable be reduced.*/
int reduced = 0;
if (get_irn_op(itervar_phi) != op_Phi)
if (! is_Phi(itervar_phi))
return;
/* A candidate is found.*/
/* A potential candidate is found.*/
ivi.itervar_phi = itervar_phi;
/* It musss be a induction variable.*/
/* check if it's a induction variable.*/
if (is_induction_variable(&ivi)) {
int i, op_out;
......
......@@ -123,7 +123,7 @@ static void do_opt_tail_rec(ir_graph *irg, ir_node *rets, int n_tail_calls)
int i, j, n_params;
collect_t data;
int rem = get_optimize();
entity *ent = get_irg_entity(irg);
ir_entity *ent = get_irg_entity(irg);
ir_type *method_tp = get_entity_type(ent);
assert(n_tail_calls);
......@@ -313,7 +313,7 @@ int opt_tail_rec_irg(ir_graph *irg)
for (i = get_Block_n_cfgpreds(end_block) - 1; i >= 0; --i) {
ir_node *ret = get_Block_cfgpred(end_block, i);
ir_node *call, *call_ptr;
entity *ent;
ir_entity *ent;
int j;
ir_node **ress;
......
......@@ -289,7 +289,7 @@ static void cancel_out_casts(ir_node *cast) {
static void concretize_selected_entity(ir_node *sel) {
ir_node *cast, *ptr = get_Sel_ptr(sel);
ir_type *orig_tp, *cast_tp;
entity *new_ent, *sel_ent;
ir_entity *new_ent, *sel_ent;
sel_ent = get_Sel_entity(sel);
cast = get_Sel_ptr(sel);
......
......@@ -712,11 +712,11 @@ static int cnt_const_args(ir_node *call) {
*/
static void stat_update_call(ir_node *call, graph_entry_t *graph)
{
ir_node *block = get_nodes_block(call);
ir_node *ptr = get_Call_ptr(call);
entity *ent = NULL;
ir_graph *callee = NULL;
int num_const_args;
ir_node *block = get_nodes_block(call);
ir_node *ptr = get_Call_ptr(call);
ir_entity *ent = NULL;
ir_graph *callee = NULL;
int num_const_args;
/*
* If the block is bad, the whole subgraph will collapse later