projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleanup space generation logic and make it more robust for union constructs
[libfirm]
/
ir
/
opt
/
funccall.c
diff --git
a/ir/opt/funccall.c
b/ir/opt/funccall.c
index
1640ddf
..
8fb3d0c
100644
(file)
--- a/
ir/opt/funccall.c
+++ b/
ir/opt/funccall.c
@@
-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_irn_link(call, NULL);
ptr = get_Call_ptr(call);
/* 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)
prop = get_entity_additional_properties(ent);
if ((prop & (mtp_property_const|mtp_property_pure)) == 0)
@@
-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_irn_link(call, NULL);
ptr = get_Call_ptr(call);
/* 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)
prop = get_entity_additional_properties(ent);
if ((prop & mtp_property_nothrow) == 0)
@@
-677,8
+677,8
@@
static int is_malloc_call_result(const ir_node *node) {
if (is_alloc_entity != NULL && is_Call(node)) {
ir_node *ptr = get_Call_ptr(node);
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);
}
}
return is_alloc_entity(ent);
}
}
@@
-712,19
+712,19
@@
static int is_stored(const ir_node *n) {
break;
case iro_Store:
if (get_Store_value(succ) == n)
break;
case iro_Store:
if (get_Store_value(succ) == n)
- return
0
;
+ return
1
;
/* ok if its only the address input */
break;
case iro_Sel:
case iro_Cast:
case iro_Confirm:
if (is_stored(succ))
/* ok if its only the address input */
break;
case iro_Sel:
case iro_Cast:
case iro_Confirm:
if (is_stored(succ))
- return
0
;
+ return
1
;
break;
case iro_Call:
ptr = get_Call_ptr(succ);
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 */
int i;
/* we know the called entity */
@@
-733,19
+733,21
@@
static int is_stored(const ir_node *n) {
/* n is the i'th param of the call */
if (get_method_param_access(ent, i) & ptr_access_store) {
/* n is store in ent */
/* n is the i'th param of the call */
if (get_method_param_access(ent, i) & ptr_access_store) {
/* n is store in ent */
- return
0
;
+ return
1
;
}
}
}
} else {
}
}
}
} else {
- return 0;
+ /* unknown call address */
+ return 1;
}
break;
default:
/* bad, potential alias */
}
break;
default:
/* bad, potential alias */
- return
0
;
+ return
1
;
}
}
}
}
+ return 0;
} /* is_stored */
/**
} /* is_stored */
/**
@@
-765,9
+767,9
@@
static unsigned check_stored_result(ir_graph *irg) {
if (! is_Return(pred))
continue;
for (j = get_Return_n_ress(pred) - 1; j >= 0; --j) {
if (! is_Return(pred))
continue;
for (j = get_Return_n_ress(pred) - 1; j >= 0; --j) {
- const ir_node *
res
= get_Return_res(pred, j);
+ const ir_node *
irn
= get_Return_res(pred, j);
- if (is_stored(
res
)) {
+ if (is_stored(
irn
)) {
/* bad, might create an alias */
res = ~mtp_property_malloc;
goto finish;
/* bad, might create an alias */
res = ~mtp_property_malloc;
goto finish;
@@
-829,9
+831,9
@@
static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) {
} else if (is_Call(res)) {
ir_node *ptr = get_Call_ptr(res);
} 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 */
/* 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) {
ir_graph *callee = get_entity_irg(ent);
if (callee == irg) {
@@
-885,9
+887,9
@@
static unsigned check_nothrow_or_malloc(ir_graph *irg, int top) {
if (is_Call(pred)) {
ir_node *ptr = get_Call_ptr(pred);
if (is_Call(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);
if (callee == irg) {
ir_graph *callee = get_entity_irg(ent);
if (callee == irg) {