From: Matthias Braun Date: Thu, 20 Oct 2011 16:32:37 +0000 (+0200) Subject: remove is_Global/get_GlobalEntity X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=2e179fbd54125606903fc7e438d02a6d3aacc6eb;p=libfirm remove is_Global/get_GlobalEntity They have been unnecessary aliases for is_SymConst_addr_ent() and get_SymConst_entity(). --- diff --git a/include/libfirm/irnode.h b/include/libfirm/irnode.h index b36594bdb..1c0a96ad7 100644 --- a/include/libfirm/irnode.h +++ b/include/libfirm/irnode.h @@ -657,12 +657,6 @@ FIRM_API int is_irn_cse_neutral(const ir_node *node); /** Gets the string representation of the jump prediction. */ FIRM_API const char *get_cond_jmp_predicate_name(cond_jmp_predicate pred); -/** Checks whether a node represents a global address. */ -FIRM_API int is_Global(const ir_node *node); - -/** Returns the entity of a global address. */ -FIRM_API ir_entity *get_Global_entity(const ir_node *node); - /** * Access custom node data. * The data must have been registered with diff --git a/ir/ana/analyze_irg_args.c b/ir/ana/analyze_irg_args.c index 82a04062c..741b4dabc 100644 --- a/ir/ana/analyze_irg_args.c +++ b/ir/ana/analyze_irg_args.c @@ -80,8 +80,8 @@ static ptr_access_kind analyze_arg(ir_node *arg, ptr_access_kind bits) } else { ir_entity *meth_ent; - if (is_Global(ptr)) { - meth_ent = get_Global_entity(ptr); + if (is_SymConst_addr_ent(ptr)) { + meth_ent = get_SymConst_entity(ptr); for (p = get_Call_n_params(succ) - 1; p >= 0; --p) { if (get_Call_param(succ, p) == arg) { diff --git a/ir/ana/cgana.c b/ir/ana/cgana.c index 7a5e26e48..9a867651e 100644 --- a/ir/ana/cgana.c +++ b/ir/ana/cgana.c @@ -465,8 +465,8 @@ static void add_method_address_inititializer(ir_initializer_t *initializer, n = initializer->consti.value; /* let's check if it's the address of a function */ - if (is_Global(n)) { - ir_entity *ent = get_Global_entity(n); + if (is_SymConst_addr_ent(n)) { + ir_entity *ent = get_SymConst_entity(n); if (is_Method_type(get_entity_type(ent))) eset_insert(set, ent); @@ -516,8 +516,8 @@ static void add_method_address(ir_entity *ent, eset *set) ir_node *irn = get_compound_ent_value(ent, i); /* let's check if it's the address of a function */ - if (is_Global(irn)) { - ir_entity *ent2 = get_Global_entity(irn); + if (is_SymConst_addr_ent(irn)) { + ir_entity *ent2 = get_SymConst_entity(irn); if (is_Method_type(get_entity_type(ent2))) eset_insert(set, ent2); diff --git a/ir/ana/irmemory.c b/ir/ana/irmemory.c index a201e4ebb..20d980492 100644 --- a/ir/ana/irmemory.c +++ b/ir/ana/irmemory.c @@ -367,13 +367,13 @@ static ir_alias_relation different_types(const ir_node *adr1, const ir_node *adr { ir_entity *ent1 = NULL, *ent2 = NULL; - if (is_Global(adr1)) - ent1 = get_Global_entity(adr1); + if (is_SymConst_addr_ent(adr1)) + ent1 = get_SymConst_entity(adr1); else if (is_Sel(adr1)) ent1 = get_Sel_entity(adr1); - if (is_Global(adr2)) - ent2 = get_Global_entity(adr2); + if (is_SymConst_addr_ent(adr2)) + ent2 = get_SymConst_entity(adr2); else if (is_Sel(adr2)) ent2 = get_Sel_entity(adr2); @@ -420,8 +420,8 @@ static int is_malloc_Result(const ir_node *node) if (! is_Call(node)) return 0; node = get_Call_ptr(node); - if (is_Global(node)) { - ir_entity *ent = get_Global_entity(node); + if (is_SymConst_addr_ent(node)) { + ir_entity *ent = get_SymConst_entity(node); if (get_entity_additional_properties(ent) & mtp_property_malloc) return 1; @@ -435,8 +435,8 @@ ir_storage_class_class_t classify_pointer(const ir_node *irn, { ir_graph *irg = get_irn_irg(irn); ir_storage_class_class_t res = ir_sc_pointer; - if (is_Global(irn)) { - ir_entity *entity = get_Global_entity(irn); + if (is_SymConst_addr_ent(irn)) { + ir_entity *entity = get_SymConst_entity(irn); ir_type *owner = get_entity_owner(entity); res = owner == get_tls_type() ? ir_sc_tls : ir_sc_globalvar; if (! (get_entity_usage(entity) & ir_usage_address_taken)) @@ -1086,8 +1086,8 @@ static void check_initializer_nodes(ir_initializer_t *initializer) case IR_INITIALIZER_CONST: /* let's check if it's an address */ n = initializer->consti.value; - if (is_Global(n)) { - ir_entity *ent = get_Global_entity(n); + if (is_SymConst_addr_ent(n)) { + ir_entity *ent = get_SymConst_entity(n); set_entity_usage(ent, ir_usage_unknown); } return; @@ -1129,8 +1129,8 @@ static void check_initializer(ir_entity *ent) ir_node *irn = get_compound_ent_value(ent, i); /* let's check if it's an address */ - if (is_Global(irn)) { - ir_entity *symconst_ent = get_Global_entity(irn); + if (is_SymConst_addr_ent(irn)) { + ir_entity *symconst_ent = get_SymConst_entity(irn); set_entity_usage(symconst_ent, ir_usage_unknown); } } @@ -1192,9 +1192,9 @@ static void check_global_address(ir_node *irn, void *data) unsigned flags; (void) data; - if (is_Global(irn)) { + if (is_SymConst_addr_ent(irn)) { /* A global. */ - ent = get_Global_entity(irn); + ent = get_SymConst_entity(irn); } else return; diff --git a/ir/be/ia32/ia32_common_transform.c b/ir/be/ia32/ia32_common_transform.c index 85e7d7176..e374eead1 100644 --- a/ir/be/ia32/ia32_common_transform.c +++ b/ir/be/ia32/ia32_common_transform.c @@ -972,7 +972,7 @@ ir_node *ia32_try_create_Immediate(ir_node *node, char immediate_constraint_type return NULL; } - symconst_ent = get_Global_entity(symconst); + symconst_ent = get_SymConst_entity(symconst); } if (cnst == NULL && symconst == NULL) return NULL; diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index ec62d77b3..99a7b2e95 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -1709,18 +1709,6 @@ dbg_info *(get_irn_dbg_info)(const ir_node *n) return _get_irn_dbg_info(n); } -/* checks whether a node represents a global address */ -int is_Global(const ir_node *node) -{ - return is_SymConst_addr_ent(node); -} - -/* returns the entity of a global address */ -ir_entity *get_Global_entity(const ir_node *node) -{ - return get_SymConst_entity(node); -} - /* * Calculate a hash value of a node. */ diff --git a/ir/lower/lower_intrinsics.c b/ir/lower/lower_intrinsics.c index a185916e5..9e777bdce 100644 --- a/ir/lower/lower_intrinsics.c +++ b/ir/lower/lower_intrinsics.c @@ -67,10 +67,10 @@ static void call_mapper(ir_node *node, void *env) ir_entity *ent; symconst = get_Call_ptr(node); - if (! is_Global(symconst)) + if (! is_SymConst_addr_ent(symconst)) return; - ent = get_Global_entity(symconst); + ent = get_SymConst_entity(symconst); p = pmap_find(wenv->c_map, ent); if (p) { @@ -605,8 +605,8 @@ int i_mapper_tanh(ir_node *call, void *ctx) */ static ir_entity *get_const_entity(ir_node *ptr) { - if (is_Global(ptr)) { - ir_entity *ent = get_Global_entity(ptr); + if (is_SymConst_addr_ent(ptr)) { + ir_entity *ent = get_SymConst_entity(ptr); if (get_entity_linkage(ent) & IR_LINKAGE_CONSTANT) { /* a constant entity */ diff --git a/ir/opt/funccall.c b/ir/opt/funccall.c index 7e70ec548..b5e14ed8b 100644 --- a/ir/opt/funccall.c +++ b/ir/opt/funccall.c @@ -89,8 +89,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_irn_link(call, NULL); ptr = get_Call_ptr(call); - if (is_Global(ptr)) { - ent = get_Global_entity(ptr); + if (is_SymConst_addr_ent(ptr)) { + ent = get_SymConst_entity(ptr); prop = get_entity_additional_properties(ent); if ((prop & (mtp_property_const|mtp_property_pure)) == 0) @@ -262,8 +262,8 @@ static void collect_nothrow_calls(ir_node *node, void *env) /* set the link to NULL for all non-const/pure calls */ set_irn_link(call, NULL); ptr = get_Call_ptr(call); - if (is_Global(ptr)) { - ent = get_Global_entity(ptr); + if (is_SymConst_addr_ent(ptr)) { + ent = get_SymConst_entity(ptr); prop = get_entity_additional_properties(ent); if ((prop & mtp_property_nothrow) == 0) @@ -725,8 +725,8 @@ static int is_stored(const ir_node *n) break; case iro_Call: ptr = get_Call_ptr(succ); - if (is_Global(ptr)) { - ir_entity *ent = get_Global_entity(ptr); + if (is_SymConst_addr_ent(ptr)) { + ir_entity *ent = get_SymConst_entity(ptr); size_t i; /* we know the called entity */ @@ -838,9 +838,9 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top) } else if (is_Call(res)) { ir_node *ptr = get_Call_ptr(res); - if (is_Global(ptr)) { + if (is_SymConst_addr_ent(ptr)) { /* a direct call */ - ir_entity *ent = get_Global_entity(ptr); + ir_entity *ent = get_SymConst_entity(ptr); ir_graph *callee = get_entity_irg(ent); if (callee == irg) { @@ -894,9 +894,9 @@ static mtp_additional_properties check_nothrow_or_malloc(ir_graph *irg, int top) if (is_Call(pred)) { ir_node *ptr = get_Call_ptr(pred); - if (is_Global(ptr)) { + if (is_SymConst_addr_ent(ptr)) { /* a direct call */ - ir_entity *ent = get_Global_entity(ptr); + ir_entity *ent = get_SymConst_entity(ptr); ir_graph *callee = get_entity_irg(ent); if (callee == irg) { diff --git a/ir/opt/ldstopt.c b/ir/opt/ldstopt.c index 27810dd76..412686f3a 100644 --- a/ir/opt/ldstopt.c +++ b/ir/opt/ldstopt.c @@ -782,8 +782,8 @@ static unsigned is_Call_pure(ir_node *call) /* try the called entity */ ir_node *ptr = get_Call_ptr(call); - if (is_Global(ptr)) { - ir_entity *ent = get_Global_entity(ptr); + if (is_SymConst_addr_ent(ptr)) { + ir_entity *ent = get_SymConst_entity(ptr); prop = get_entity_additional_properties(ent); } @@ -1887,7 +1887,7 @@ static void move_loads_out_of_loops(scc *pscc, loop_env *env) continue; /* for now, we can only move Load(Global) */ - if (! is_Global(ptr)) + if (! is_SymConst_addr_ent(ptr)) continue; load_mode = get_Load_mode(load); for (other = pscc->head; other != NULL; other = next_other) { diff --git a/ir/opt/opt_confirms.c b/ir/opt/opt_confirms.c index 8a0500a05..ffac69f55 100644 --- a/ir/opt/opt_confirms.c +++ b/ir/opt/opt_confirms.c @@ -198,7 +198,7 @@ FIRM_API int value_not_null(const ir_node *n, ir_node_cnst_ptr *confirm) break; } - if (is_Global(n)) { + if (is_SymConst_addr_ent(n)) { /* global references are never NULL */ return 1; } else if (n == get_irg_frame(get_irn_irg(n))) { diff --git a/ir/opt/opt_inline.c b/ir/opt/opt_inline.c index b100d6232..4afdc285f 100644 --- a/ir/opt/opt_inline.c +++ b/ir/opt/opt_inline.c @@ -661,8 +661,8 @@ static ir_graph *get_call_called_irg(ir_node *call) ir_node *addr; addr = get_Call_ptr(call); - if (is_Global(addr)) { - ir_entity *ent = get_Global_entity(addr); + if (is_SymConst_addr_ent(addr)) { + ir_entity *ent = get_SymConst_entity(addr); /* we don't know which function gets finally bound to a weak symbol */ if (get_entity_linkage(ent) & IR_LINKAGE_WEAK) return NULL; @@ -847,8 +847,8 @@ static void collect_calls2(ir_node *call, void *ctx) if (env->ignore_runtime) { ir_node *symc = get_Call_ptr(call); - if (is_Global(symc)) { - ir_entity *ent = get_Global_entity(symc); + if (is_SymConst_addr_ent(symc)) { + ir_entity *ent = get_SymConst_entity(symc); if (get_entity_additional_properties(ent) & mtp_property_runtime) return; diff --git a/ir/opt/opt_ldst.c b/ir/opt/opt_ldst.c index 9cc267526..e330ff009 100644 --- a/ir/opt/opt_ldst.c +++ b/ir/opt/opt_ldst.c @@ -525,8 +525,8 @@ static unsigned get_Call_memory_properties(ir_node *call) /* try the called entity */ ir_node *ptr = get_Call_ptr(call); - if (is_Global(ptr)) { - ir_entity *ent = get_Global_entity(ptr); + if (is_SymConst_addr_ent(ptr)) { + ir_entity *ent = get_SymConst_entity(ptr); prop = get_entity_additional_properties(ent); } diff --git a/ir/opt/proc_cloning.c b/ir/opt/proc_cloning.c index 06d7a9c84..ab5d99aaa 100644 --- a/ir/opt/proc_cloning.c +++ b/ir/opt/proc_cloning.c @@ -183,10 +183,10 @@ static void collect_irg_calls(ir_node *call, void *env) if (is_Call(call)) { call_ptr = get_Call_ptr(call); - if (! is_Global(call_ptr)) + if (! is_SymConst_addr_ent(call_ptr)) return; - callee = get_Global_entity(call_ptr); + callee = get_SymConst_entity(call_ptr); /* we don't know which function gets finally bound to a weak symbol */ if (get_entity_linkage(callee) & IR_LINKAGE_WEAK) diff --git a/ir/opt/tailrec.c b/ir/opt/tailrec.c index 76a765add..d75391bd8 100644 --- a/ir/opt/tailrec.c +++ b/ir/opt/tailrec.c @@ -628,10 +628,10 @@ int opt_tail_rec_irg(ir_graph *irg) /* check if it's a recursive call */ call_ptr = get_Call_ptr(call); - if (! is_Global(call_ptr)) + if (! is_SymConst_addr_ent(call_ptr)) continue; - ent = get_Global_entity(call_ptr); + ent = get_SymConst_entity(call_ptr); if (!ent || get_entity_irg(ent) != irg) continue;