Commit 36332e71 authored by Michael Beck's avatar Michael Beck
Browse files

used new is_Global() and get_Global_entity() instead of SymConst calls

[r19066]
parent 030f541e
...@@ -1417,7 +1417,7 @@ void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred); ...@@ -1417,7 +1417,7 @@ void set_Cond_jmp_pred(ir_node *cond, cond_jmp_predicate pred);
int is_Global(const ir_node *node); int is_Global(const ir_node *node);
/* Returns the entity of a global address. */ /* Returns the entity of a global address. */
ir_entity *get_Global_ent(const ir_node *node); ir_entity *get_Global_entity(const ir_node *node);
/** /**
* Access custom node data. * Access custom node data.
......
...@@ -487,8 +487,8 @@ static void add_method_address_intitialzer(ir_initializer_t *initializer, ...@@ -487,8 +487,8 @@ static void add_method_address_intitialzer(ir_initializer_t *initializer,
ir_node *n = initializer->consti.value; ir_node *n = initializer->consti.value;
/* let's check if it's the address of a function */ /* let's check if it's the address of a function */
if (is_SymConst_addr_ent(n)) { if (is_Global(n)) {
ir_entity *ent = get_SymConst_entity(n); ir_entity *ent = get_Global_entity(n);
if (is_Method_type(get_entity_type(ent))) if (is_Method_type(get_entity_type(ent)))
eset_insert(set, ent); eset_insert(set, ent);
...@@ -544,8 +544,8 @@ static void add_method_address(ir_entity *ent, eset *set) ...@@ -544,8 +544,8 @@ static void add_method_address(ir_entity *ent, eset *set)
/* let's check if it's the address of a function */ /* let's check if it's the address of a function */
n = get_atomic_ent_value(ent); n = get_atomic_ent_value(ent);
if (is_SymConst_addr_ent(n)) { if (is_Global(n)) {
ent = get_SymConst_entity(n); ent = get_Global_entity(n);
if (is_Method_type(get_entity_type(ent))) if (is_Method_type(get_entity_type(ent)))
eset_insert(set, ent); eset_insert(set, ent);
...@@ -555,8 +555,8 @@ static void add_method_address(ir_entity *ent, eset *set) ...@@ -555,8 +555,8 @@ static void add_method_address(ir_entity *ent, eset *set)
n = get_compound_ent_value(ent, i); n = get_compound_ent_value(ent, i);
/* let's check if it's the address of a function */ /* let's check if it's the address of a function */
if (is_SymConst_addr_ent(n)) { if (is_Global(n)) {
ir_entity *ent = get_SymConst_entity(n); ir_entity *ent = get_Global_entity(n);
if (is_Method_type(get_entity_type(ent))) if (is_Method_type(get_entity_type(ent)))
eset_insert(set, ent); eset_insert(set, ent);
......
...@@ -339,13 +339,13 @@ static ir_alias_relation different_types(ir_node *adr1, ir_node *adr2) ...@@ -339,13 +339,13 @@ static ir_alias_relation different_types(ir_node *adr1, ir_node *adr2)
{ {
ir_entity *ent1 = NULL, *ent2 = NULL; ir_entity *ent1 = NULL, *ent2 = NULL;
if (is_SymConst_addr_ent(adr1)) if (is_Global(adr1))
ent1 = get_SymConst_entity(adr1); ent1 = get_Global_entity(adr1);
else if (is_Sel(adr1)) else if (is_Sel(adr1))
ent1 = get_Sel_entity(adr1); ent1 = get_Sel_entity(adr1);
if (is_SymConst_addr_ent(adr2)) if (is_Global(adr2))
ent2 = get_SymConst_entity(adr2); ent2 = get_Global_entity(adr2);
else if (is_Sel(adr2)) else if (is_Sel(adr2))
ent2 = get_Sel_entity(adr2); ent2 = get_Sel_entity(adr2);
...@@ -407,8 +407,8 @@ static int is_malloc_Result(ir_node *node) { ...@@ -407,8 +407,8 @@ static int is_malloc_Result(ir_node *node) {
if (! is_Call(node)) if (! is_Call(node))
return 0; return 0;
node = get_Call_ptr(node); node = get_Call_ptr(node);
if (is_SymConst_addr_ent(node)) { if (is_Global(node)) {
ir_entity *ent = get_SymConst_entity(node); ir_entity *ent = get_Global_entity(node);
if (get_entity_additional_properties(ent) & mtp_property_malloc) if (get_entity_additional_properties(ent) & mtp_property_malloc)
return 1; return 1;
...@@ -417,15 +417,6 @@ static int is_malloc_Result(ir_node *node) { ...@@ -417,15 +417,6 @@ static int is_malloc_Result(ir_node *node) {
return 0; return 0;
} /* is_malloc_Result */ } /* is_malloc_Result */
/**
* Returns true if an address represents a global variable.
*
* @param irn the node representing the address
*/
static INLINE int is_global_var(ir_node *irn) {
return is_SymConst_addr_ent(irn);
} /* is_global_var */
/** /**
* classify storage locations. * classify storage locations.
* Except STORAGE_CLASS_POINTER they are all disjoint. * Except STORAGE_CLASS_POINTER they are all disjoint.
...@@ -453,8 +444,8 @@ typedef enum { ...@@ -453,8 +444,8 @@ typedef enum {
static storage_class_class_t classify_pointer(ir_graph *irg, ir_node *irn, ir_entity *ent) static storage_class_class_t classify_pointer(ir_graph *irg, ir_node *irn, ir_entity *ent)
{ {
storage_class_class_t res = STORAGE_CLASS_POINTER; storage_class_class_t res = STORAGE_CLASS_POINTER;
if (is_SymConst_addr_ent(irn)) { if (is_Global(irn)) {
ir_entity *entity = get_SymConst_entity(irn); ir_entity *entity = get_Global_entity(irn);
res = STORAGE_CLASS_GLOBALVAR; res = STORAGE_CLASS_GLOBALVAR;
if (get_entity_address_taken(entity) == ir_address_not_taken) if (get_entity_address_taken(entity) == ir_address_not_taken)
res |= STORAGE_CLASS_MODIFIER_NOTTAKEN; res |= STORAGE_CLASS_MODIFIER_NOTTAKEN;
...@@ -939,13 +930,13 @@ static void init_taken_flag(ir_type * tp) { ...@@ -939,13 +930,13 @@ static void init_taken_flag(ir_type * tp) {
static void check_initializer_nodes(ir_initializer_t *initializer) static void check_initializer_nodes(ir_initializer_t *initializer)
{ {
switch(initializer->kind) { switch (initializer->kind) {
case IR_INITIALIZER_CONST: { case IR_INITIALIZER_CONST: {
ir_node *n = initializer->consti.value; ir_node *n = initializer->consti.value;
/* let's check if it's an address */ /* let's check if it's an address */
if (is_SymConst_addr_ent(n)) { if (is_Global(n)) {
ir_entity *ent = get_SymConst_entity(n); ir_entity *ent = get_Global_entity(n);
set_entity_address_taken(ent, ir_address_taken); set_entity_address_taken(ent, ir_address_taken);
} }
return; return;
...@@ -956,7 +947,7 @@ static void check_initializer_nodes(ir_initializer_t *initializer) ...@@ -956,7 +947,7 @@ static void check_initializer_nodes(ir_initializer_t *initializer)
case IR_INITIALIZER_COMPOUND: { case IR_INITIALIZER_COMPOUND: {
size_t i; 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];
check_initializer_nodes(sub_initializer); check_initializer_nodes(sub_initializer);
...@@ -988,8 +979,8 @@ static void check_initializer(ir_entity *ent) { ...@@ -988,8 +979,8 @@ static void check_initializer(ir_entity *ent) {
} else if (is_atomic_entity(ent)) { } else if (is_atomic_entity(ent)) {
/* let's check if it's an address */ /* let's check if it's an address */
n = get_atomic_ent_value(ent); n = get_atomic_ent_value(ent);
if (is_SymConst_addr_ent(n)) { if (is_Global(n)) {
ir_entity *ent = get_SymConst_entity(n); ir_entity *ent = get_Global_entity(n);
set_entity_address_taken(ent, ir_address_taken); set_entity_address_taken(ent, ir_address_taken);
} }
} else { } else {
...@@ -997,8 +988,8 @@ static void check_initializer(ir_entity *ent) { ...@@ -997,8 +988,8 @@ static void check_initializer(ir_entity *ent) {
n = get_compound_ent_value(ent, i); n = get_compound_ent_value(ent, i);
/* let's check if it's an address */ /* let's check if it's an address */
if (is_SymConst_addr_ent(n)) { if (is_Global(n)) {
ir_entity *ent = get_SymConst_entity(n); ir_entity *ent = get_Global_entity(n);
set_entity_address_taken(ent, ir_address_taken); set_entity_address_taken(ent, ir_address_taken);
} }
} }
...@@ -1045,9 +1036,9 @@ static void check_global_address(ir_node *irn, void *env) { ...@@ -1045,9 +1036,9 @@ static void check_global_address(ir_node *irn, void *env) {
ir_entity *ent; ir_entity *ent;
ir_address_taken_state state; ir_address_taken_state state;
if (is_SymConst_addr_ent(irn)) { if (is_Global(irn)) {
/* A global. */ /* A global. */
ent = get_SymConst_entity(irn); ent = get_Global_entity(irn);
} else if (is_Sel(irn) && get_Sel_ptr(irn) == tls) { } else if (is_Sel(irn) && get_Sel_ptr(irn) == tls) {
/* A TLS variable. */ /* A TLS variable. */
ent = get_Sel_entity(irn); ent = get_Sel_entity(irn);
......
...@@ -802,8 +802,8 @@ int dump_node_opcode(FILE *F, ir_node *n) ...@@ -802,8 +802,8 @@ int dump_node_opcode(FILE *F, ir_node *n)
ir_entity *ent = NULL; ir_entity *ent = NULL;
if (get_irn_op(addr) == op_Sel) if (get_irn_op(addr) == op_Sel)
ent = get_Sel_entity(addr); ent = get_Sel_entity(addr);
else if (is_SymConst_addr_ent(addr)) else if (is_Global(addr))
ent = get_SymConst_entity(addr); ent = get_Global_entity(addr);
fprintf(F, "%s", get_irn_opname(n)); fprintf(F, "%s", get_irn_opname(n));
if (ent) fprintf(F, " %s", get_entity_name(ent)); if (ent) fprintf(F, " %s", get_entity_name(ent));
break; break;
......
...@@ -88,7 +88,7 @@ static INLINE void do_local_optimize(ir_node *n) { ...@@ -88,7 +88,7 @@ static INLINE void do_local_optimize(ir_node *n) {
assert(get_irg_phase_state(current_ir_graph) != phase_building); assert(get_irg_phase_state(current_ir_graph) != phase_building);
if (get_opt_global_cse()) if (get_opt_global_cse())
set_irg_pinned(current_ir_graph, op_pin_state_floats); set_irg_pinned(current_ir_graph, op_pin_state_floats);
set_irg_outs_inconsistent(current_ir_graph); set_irg_outs_inconsistent(current_ir_graph);
set_irg_doms_inconsistent(current_ir_graph); set_irg_doms_inconsistent(current_ir_graph);
set_irg_loopinfo_inconsistent(current_ir_graph); set_irg_loopinfo_inconsistent(current_ir_graph);
...@@ -1359,8 +1359,8 @@ static ir_graph *get_call_called_irg(ir_node *call) { ...@@ -1359,8 +1359,8 @@ static ir_graph *get_call_called_irg(ir_node *call) {
ir_node *addr; ir_node *addr;
addr = get_Call_ptr(call); addr = get_Call_ptr(call);
if (is_SymConst_addr_ent(addr)) { if (is_Global(addr)) {
ir_entity *ent = get_SymConst_entity(addr); ir_entity *ent = get_Global_entity(addr);
return get_entity_irg(ent); return get_entity_irg(ent);
} }
...@@ -1499,8 +1499,8 @@ static void collect_calls2(ir_node *call, void *ctx) { ...@@ -1499,8 +1499,8 @@ static void collect_calls2(ir_node *call, void *ctx) {
if (env->ignore_runtime) { if (env->ignore_runtime) {
ir_node *symc = get_Call_ptr(call); ir_node *symc = get_Call_ptr(call);
if (is_SymConst_addr_ent(symc)) { if (is_Global(symc)) {
ir_entity *ent = get_SymConst_entity(symc); ir_entity *ent = get_Global_entity(symc);
if (get_entity_additional_properties(ent) & mtp_property_runtime) if (get_entity_additional_properties(ent) & mtp_property_runtime)
return; return;
......
...@@ -3098,7 +3098,7 @@ int is_Global(const ir_node *node) { ...@@ -3098,7 +3098,7 @@ int is_Global(const ir_node *node) {
} }
/* returns the entity of a global address */ /* returns the entity of a global address */
ir_entity *get_Global_ent(const ir_node *node) { ir_entity *get_Global_entity(const ir_node *node) {
if (is_SymConst(node)) if (is_SymConst(node))
return get_SymConst_entity(node); return get_SymConst_entity(node);
else else
......
...@@ -52,13 +52,14 @@ static void lower_sel(ir_node *sel) { ...@@ -52,13 +52,14 @@ static void lower_sel(ir_node *sel) {
assert(is_Sel(sel)); assert(is_Sel(sel));
/* Do not lower frame type/global offset table access: must be lowered by the backend. */
ptr = get_Sel_ptr(sel);
if (ptr == get_irg_frame(current_ir_graph) || ptr == get_irg_globals(current_ir_graph))
return;
ent = get_Sel_entity(sel); ent = get_Sel_entity(sel);
owner = get_entity_owner(ent); owner = get_entity_owner(ent);
/* Do not lower frame type access: must be lowered by the backend. */
if (is_frame_type(owner))
return;
/* /*
* Cannot handle value param entities here. * Cannot handle value param entities here.
* Must be lowered by the backend. * Must be lowered by the backend.
...@@ -66,7 +67,6 @@ static void lower_sel(ir_node *sel) { ...@@ -66,7 +67,6 @@ static void lower_sel(ir_node *sel) {
if (is_value_param_type(owner)) if (is_value_param_type(owner))
return; return;
ptr = get_Sel_ptr(sel);
dbg = get_irn_dbg_info(sel); dbg = get_irn_dbg_info(sel);
mode = get_irn_mode(sel); mode = get_irn_mode(sel);
......
...@@ -64,10 +64,10 @@ static void call_mapper(ir_node *node, void *env) { ...@@ -64,10 +64,10 @@ static void call_mapper(ir_node *node, void *env) {
ir_entity *ent; ir_entity *ent;
symconst = get_Call_ptr(node); symconst = get_Call_ptr(node);
if (! is_SymConst_addr_ent(symconst)) if (! is_Global(symconst))
return; return;
ent = get_SymConst_entity(symconst); ent = get_Global_entity(symconst);
p = pmap_find(wenv->c_map, ent); p = pmap_find(wenv->c_map, ent);
if (p) { if (p) {
...@@ -484,8 +484,8 @@ int i_mapper_tanh(ir_node *call, void *ctx) { ...@@ -484,8 +484,8 @@ int i_mapper_tanh(ir_node *call, void *ctx) {
*/ */
static ir_entity *get_const_entity(ir_node *ptr) { static ir_entity *get_const_entity(ir_node *ptr) {
/* FIXME: this cannot handle constant strings inside struct initializers yet */ /* FIXME: this cannot handle constant strings inside struct initializers yet */
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
ir_entity *ent = get_SymConst_entity(ptr); ir_entity *ent = get_Global_entity(ptr);
if (get_entity_variability(ent) == variability_constant) { if (get_entity_variability(ent) == variability_constant) {
/* a constant entity */ /* a constant entity */
......
...@@ -90,8 +90,8 @@ static void collect_const_and_pure_calls(ir_node *node, void *env) { ...@@ -90,8 +90,8 @@ static void collect_const_and_pure_calls(ir_node *node, void *env) {
/* set the link to NULL for all non-const/pure calls */ /* set the link to NULL for all non-const/pure calls */
set_irn_link(call, NULL); set_irn_link(call, NULL);
ptr = get_Call_ptr(call); ptr = get_Call_ptr(call);
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
ent = get_SymConst_entity(ptr); ent = get_Global_entity(ptr);
prop = get_entity_additional_properties(ent); prop = get_entity_additional_properties(ent);
if ((prop & (mtp_property_const|mtp_property_pure)) == 0) if ((prop & (mtp_property_const|mtp_property_pure)) == 0)
...@@ -261,8 +261,8 @@ static void collect_nothrow_calls(ir_node *node, void *env) { ...@@ -261,8 +261,8 @@ static void collect_nothrow_calls(ir_node *node, void *env) {
/* set the link to NULL for all non-const/pure calls */ /* set the link to NULL for all non-const/pure calls */
set_irn_link(call, NULL); set_irn_link(call, NULL);
ptr = get_Call_ptr(call); ptr = get_Call_ptr(call);
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
ent = get_SymConst_entity(ptr); ent = get_Global_entity(ptr);
prop = get_entity_additional_properties(ent); prop = get_entity_additional_properties(ent);
if ((prop & mtp_property_nothrow) == 0) if ((prop & mtp_property_nothrow) == 0)
...@@ -677,8 +677,8 @@ static int is_malloc_call_result(const ir_node *node) { ...@@ -677,8 +677,8 @@ static int is_malloc_call_result(const ir_node *node) {
if (is_alloc_entity != NULL && is_Call(node)) { if (is_alloc_entity != NULL && is_Call(node)) {
ir_node *ptr = get_Call_ptr(node); ir_node *ptr = get_Call_ptr(node);
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
ir_entity *ent = get_SymConst_entity(ptr); ir_entity *ent = get_Global_entity(ptr);
return is_alloc_entity(ent); return is_alloc_entity(ent);
} }
} }
...@@ -723,8 +723,8 @@ static int is_stored(const ir_node *n) { ...@@ -723,8 +723,8 @@ static int is_stored(const ir_node *n) {
break; break;
case iro_Call: case iro_Call:
ptr = get_Call_ptr(succ); ptr = get_Call_ptr(succ);
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
ir_entity *ent = get_SymConst_entity(ptr); ir_entity *ent = get_Global_entity(ptr);
int i; int i;
/* we know the called entity */ /* we know the called entity */
...@@ -831,9 +831,9 @@ static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) { ...@@ -831,9 +831,9 @@ static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) {
} else if (is_Call(res)) { } else if (is_Call(res)) {
ir_node *ptr = get_Call_ptr(res); ir_node *ptr = get_Call_ptr(res);
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
/* a direct call */ /* a direct call */
ir_entity *ent = get_SymConst_entity(ptr); ir_entity *ent = get_Global_entity(ptr);
ir_graph *callee = get_entity_irg(ent); ir_graph *callee = get_entity_irg(ent);
if (callee == irg) { if (callee == irg) {
...@@ -887,9 +887,9 @@ static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) { ...@@ -887,9 +887,9 @@ static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) {
if (is_Call(pred)) { if (is_Call(pred)) {
ir_node *ptr = get_Call_ptr(pred); ir_node *ptr = get_Call_ptr(pred);
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
/* a direct call */ /* a direct call */
ir_entity *ent = get_SymConst_entity(ptr); ir_entity *ent = get_Global_entity(ptr);
ir_graph *callee = get_entity_irg(ent); ir_graph *callee = get_entity_irg(ent);
if (callee == irg) { if (callee == irg) {
......
...@@ -446,8 +446,8 @@ static unsigned is_Call_pure(ir_node *call) { ...@@ -446,8 +446,8 @@ static unsigned is_Call_pure(ir_node *call) {
/* try the called entity */ /* try the called entity */
ir_node *ptr = get_Call_ptr(call); ir_node *ptr = get_Call_ptr(call);
if (is_SymConst_addr_ent(ptr)) { if (is_Global(ptr)) {
ir_entity *ent = get_SymConst_entity(ptr); ir_entity *ent = get_Global_entity(ptr);
prop = get_entity_additional_properties(ent); prop = get_entity_additional_properties(ent);
} }
...@@ -1351,10 +1351,10 @@ static void move_loads_out_of_loops(scc *pscc, loop_env *env) { ...@@ -1351,10 +1351,10 @@ static void move_loads_out_of_loops(scc *pscc, loop_env *env) {
if (info->projs[pn_Load_res] == NULL || info->projs[pn_Load_X_regular] != NULL || info->projs[pn_Load_X_except] != NULL) if (info->projs[pn_Load_res] == NULL || info->projs[pn_Load_X_regular] != NULL || info->projs[pn_Load_X_except] != NULL)
continue; continue;
/* for now, we can only handle Load(SymConst) */ /* for now, we can only handle Load(Global) */
if (! is_SymConst_addr_ent(ptr)) if (! is_Global(ptr))
continue; continue;
ent = get_SymConst_entity(ptr); ent = get_Global_entity(ptr);
load_mode = get_Load_mode(load); load_mode = get_Load_mode(load);
for (other = pscc->head; other != NULL; other = next_other) { for (other = pscc->head; other != NULL; other = next_other) {
node_entry *ne = get_irn_ne(other, env); node_entry *ne = get_irn_ne(other, env);
......
...@@ -187,10 +187,10 @@ static void collect_irg_calls(ir_node *call, void *env) { ...@@ -187,10 +187,10 @@ static void collect_irg_calls(ir_node *call, void *env) {
if (is_Call(call)) { if (is_Call(call)) {
call_ptr = get_Call_ptr(call); call_ptr = get_Call_ptr(call);
if (! is_SymConst_addr_ent(call_ptr)) if (! is_Global(call_ptr))
return; return;
callee = get_SymConst_entity(call_ptr); callee = get_Global_entity(call_ptr);
/* we can only clone calls to existing entities */ /* we can only clone calls to existing entities */
if (get_entity_visibility(callee) == visibility_external_allocated) if (get_entity_visibility(callee) == visibility_external_allocated)
......
...@@ -632,10 +632,10 @@ int opt_tail_rec_irg(ir_graph *irg) { ...@@ -632,10 +632,10 @@ int opt_tail_rec_irg(ir_graph *irg) {
/* check if it's a recursive call */ /* check if it's a recursive call */
call_ptr = get_Call_ptr(call); call_ptr = get_Call_ptr(call);
if (! is_SymConst_addr_ent(call_ptr)) if (! is_Global(call_ptr))
continue; continue;
ent = get_SymConst_entity(call_ptr); ent = get_Global_entity(call_ptr);
if (!ent || get_entity_irg(ent) != irg) if (!ent || get_entity_irg(ent) != irg)
continue; continue;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment