int is_Global(const ir_node *node);
/* 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.
ir_node *n = initializer->consti.value;
/* let's check if it's the address of a function */
- if (is_SymConst_addr_ent(n)) {
- ir_entity *ent = get_SymConst_entity(n);
+ if (is_Global(n)) {
+ ir_entity *ent = get_Global_entity(n);
if (is_Method_type(get_entity_type(ent)))
eset_insert(set, ent);
/* let's check if it's the address of a function */
n = get_atomic_ent_value(ent);
- if (is_SymConst_addr_ent(n)) {
- ent = get_SymConst_entity(n);
+ if (is_Global(n)) {
+ ent = get_Global_entity(n);
if (is_Method_type(get_entity_type(ent)))
eset_insert(set, ent);
n = get_compound_ent_value(ent, i);
/* let's check if it's the address of a function */
- if (is_SymConst_addr_ent(n)) {
- ir_entity *ent = get_SymConst_entity(n);
+ if (is_Global(n)) {
+ ir_entity *ent = get_Global_entity(n);
if (is_Method_type(get_entity_type(ent)))
eset_insert(set, ent);
{
ir_entity *ent1 = NULL, *ent2 = NULL;
- if (is_SymConst_addr_ent(adr1))
- ent1 = get_SymConst_entity(adr1);
+ if (is_Global(adr1))
+ ent1 = get_Global_entity(adr1);
else if (is_Sel(adr1))
ent1 = get_Sel_entity(adr1);
- if (is_SymConst_addr_ent(adr2))
- ent2 = get_SymConst_entity(adr2);
+ if (is_Global(adr2))
+ ent2 = get_Global_entity(adr2);
else if (is_Sel(adr2))
ent2 = get_Sel_entity(adr2);
if (! is_Call(node))
return 0;
node = get_Call_ptr(node);
- if (is_SymConst_addr_ent(node)) {
- ir_entity *ent = get_SymConst_entity(node);
+ if (is_Global(node)) {
+ ir_entity *ent = get_Global_entity(node);
if (get_entity_additional_properties(ent) & mtp_property_malloc)
return 1;
return 0;
} /* 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.
* Except STORAGE_CLASS_POINTER they are all disjoint.
static storage_class_class_t classify_pointer(ir_graph *irg, ir_node *irn, ir_entity *ent)
{
storage_class_class_t res = STORAGE_CLASS_POINTER;
- if (is_SymConst_addr_ent(irn)) {
- ir_entity *entity = get_SymConst_entity(irn);
+ if (is_Global(irn)) {
+ ir_entity *entity = get_Global_entity(irn);
res = STORAGE_CLASS_GLOBALVAR;
if (get_entity_address_taken(entity) == ir_address_not_taken)
res |= STORAGE_CLASS_MODIFIER_NOTTAKEN;
static void check_initializer_nodes(ir_initializer_t *initializer)
{
- switch(initializer->kind) {
+ switch (initializer->kind) {
case IR_INITIALIZER_CONST: {
ir_node *n = initializer->consti.value;
/* let's check if it's an address */
- if (is_SymConst_addr_ent(n)) {
- ir_entity *ent = get_SymConst_entity(n);
+ if (is_Global(n)) {
+ ir_entity *ent = get_Global_entity(n);
set_entity_address_taken(ent, ir_address_taken);
}
return;
case IR_INITIALIZER_COMPOUND: {
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
= initializer->compound.initializers[i];
check_initializer_nodes(sub_initializer);
} else if (is_atomic_entity(ent)) {
/* let's check if it's an address */
n = get_atomic_ent_value(ent);
- if (is_SymConst_addr_ent(n)) {
- ir_entity *ent = get_SymConst_entity(n);
+ if (is_Global(n)) {
+ ir_entity *ent = get_Global_entity(n);
set_entity_address_taken(ent, ir_address_taken);
}
} else {
n = get_compound_ent_value(ent, i);
/* let's check if it's an address */
- if (is_SymConst_addr_ent(n)) {
- ir_entity *ent = get_SymConst_entity(n);
+ if (is_Global(n)) {
+ ir_entity *ent = get_Global_entity(n);
set_entity_address_taken(ent, ir_address_taken);
}
}
ir_entity *ent;
ir_address_taken_state state;
- if (is_SymConst_addr_ent(irn)) {
+ if (is_Global(irn)) {
/* A global. */
- ent = get_SymConst_entity(irn);
+ ent = get_Global_entity(irn);
} else if (is_Sel(irn) && get_Sel_ptr(irn) == tls) {
/* A TLS variable. */
ent = get_Sel_entity(irn);
ir_entity *ent = NULL;
if (get_irn_op(addr) == op_Sel)
ent = get_Sel_entity(addr);
- else if (is_SymConst_addr_ent(addr))
- ent = get_SymConst_entity(addr);
+ else if (is_Global(addr))
+ ent = get_Global_entity(addr);
fprintf(F, "%s", get_irn_opname(n));
if (ent) fprintf(F, " %s", get_entity_name(ent));
break;
assert(get_irg_phase_state(current_ir_graph) != phase_building);
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_doms_inconsistent(current_ir_graph);
set_irg_loopinfo_inconsistent(current_ir_graph);
ir_node *addr;
addr = get_Call_ptr(call);
- if (is_SymConst_addr_ent(addr)) {
- ir_entity *ent = get_SymConst_entity(addr);
+ if (is_Global(addr)) {
+ ir_entity *ent = get_Global_entity(addr);
return get_entity_irg(ent);
}
if (env->ignore_runtime) {
ir_node *symc = get_Call_ptr(call);
- if (is_SymConst_addr_ent(symc)) {
- ir_entity *ent = get_SymConst_entity(symc);
+ if (is_Global(symc)) {
+ ir_entity *ent = get_Global_entity(symc);
if (get_entity_additional_properties(ent) & mtp_property_runtime)
return;
}
/* 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))
return get_SymConst_entity(node);
else
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);
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.
* Must be lowered by the backend.
if (is_value_param_type(owner))
return;
- ptr = get_Sel_ptr(sel);
dbg = get_irn_dbg_info(sel);
mode = get_irn_mode(sel);
ir_entity *ent;
symconst = get_Call_ptr(node);
- if (! is_SymConst_addr_ent(symconst))
+ if (! is_Global(symconst))
return;
- ent = get_SymConst_entity(symconst);
+ ent = get_Global_entity(symconst);
p = pmap_find(wenv->c_map, ent);
if (p) {
*/
static ir_entity *get_const_entity(ir_node *ptr) {
/* FIXME: this cannot handle constant strings inside struct initializers yet */
- if (is_SymConst_addr_ent(ptr)) {
- ir_entity *ent = get_SymConst_entity(ptr);
+ if (is_Global(ptr)) {
+ ir_entity *ent = get_Global_entity(ptr);
if (get_entity_variability(ent) == variability_constant) {
/* a constant entity */
/* set the link to NULL for all non-const/pure calls */
set_irn_link(call, NULL);
ptr = get_Call_ptr(call);
- if (is_SymConst_addr_ent(ptr)) {
- ent = get_SymConst_entity(ptr);
+ if (is_Global(ptr)) {
+ ent = get_Global_entity(ptr);
prop = get_entity_additional_properties(ent);
if ((prop & (mtp_property_const|mtp_property_pure)) == 0)
/* set the link to NULL for all non-const/pure calls */
set_irn_link(call, NULL);
ptr = get_Call_ptr(call);
- if (is_SymConst_addr_ent(ptr)) {
- ent = get_SymConst_entity(ptr);
+ if (is_Global(ptr)) {
+ ent = get_Global_entity(ptr);
prop = get_entity_additional_properties(ent);
if ((prop & mtp_property_nothrow) == 0)
if (is_alloc_entity != NULL && is_Call(node)) {
ir_node *ptr = get_Call_ptr(node);
- if (is_SymConst_addr_ent(ptr)) {
- ir_entity *ent = get_SymConst_entity(ptr);
+ if (is_Global(ptr)) {
+ ir_entity *ent = get_Global_entity(ptr);
return is_alloc_entity(ent);
}
}
break;
case iro_Call:
ptr = get_Call_ptr(succ);
- if (is_SymConst_addr_ent(ptr)) {
- ir_entity *ent = get_SymConst_entity(ptr);
+ if (is_Global(ptr)) {
+ ir_entity *ent = get_Global_entity(ptr);
int i;
/* we know the called entity */
} else if (is_Call(res)) {
ir_node *ptr = get_Call_ptr(res);
- if (is_SymConst_addr_ent(ptr)) {
+ if (is_Global(ptr)) {
/* a direct call */
- ir_entity *ent = get_SymConst_entity(ptr);
+ ir_entity *ent = get_Global_entity(ptr);
ir_graph *callee = get_entity_irg(ent);
if (callee == irg) {
if (is_Call(pred)) {
ir_node *ptr = get_Call_ptr(pred);
- if (is_SymConst_addr_ent(ptr)) {
+ if (is_Global(ptr)) {
/* a direct call */
- ir_entity *ent = get_SymConst_entity(ptr);
+ ir_entity *ent = get_Global_entity(ptr);
ir_graph *callee = get_entity_irg(ent);
if (callee == irg) {
/* try the called entity */
ir_node *ptr = get_Call_ptr(call);
- if (is_SymConst_addr_ent(ptr)) {
- ir_entity *ent = get_SymConst_entity(ptr);
+ if (is_Global(ptr)) {
+ ir_entity *ent = get_Global_entity(ptr);
prop = get_entity_additional_properties(ent);
}
if (info->projs[pn_Load_res] == NULL || info->projs[pn_Load_X_regular] != NULL || info->projs[pn_Load_X_except] != NULL)
continue;
- /* for now, we can only handle Load(SymConst) */
- if (! is_SymConst_addr_ent(ptr))
+ /* for now, we can only handle Load(Global) */
+ if (! is_Global(ptr))
continue;
- ent = get_SymConst_entity(ptr);
+ ent = get_Global_entity(ptr);
load_mode = get_Load_mode(load);
for (other = pscc->head; other != NULL; other = next_other) {
node_entry *ne = get_irn_ne(other, env);
if (is_Call(call)) {
call_ptr = get_Call_ptr(call);
- if (! is_SymConst_addr_ent(call_ptr))
+ if (! is_Global(call_ptr))
return;
- callee = get_SymConst_entity(call_ptr);
+ callee = get_Global_entity(call_ptr);
/* we can only clone calls to existing entities */
if (get_entity_visibility(callee) == visibility_external_allocated)
/* check if it's a recursive call */
call_ptr = get_Call_ptr(call);
- if (! is_SymConst_addr_ent(call_ptr))
+ if (! is_Global(call_ptr))
continue;
- ent = get_SymConst_entity(call_ptr);
+ ent = get_Global_entity(call_ptr);
if (!ent || get_entity_irg(ent) != irg)
continue;