projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ldst_only_null_ptr_exceptions and sel_based_null_check_elim flags added
[libfirm]
/
ir
/
opt
/
scalar_replace.c
diff --git
a/ir/opt/scalar_replace.c
b/ir/opt/scalar_replace.c
index
fb24faf
..
8ffa6da
100644
(file)
--- a/
ir/opt/scalar_replace.c
+++ b/
ir/opt/scalar_replace.c
@@
-37,9
+37,10
@@
#include "irgwalk.h"
#include "irgmod.h"
#include "irnode_t.h"
#include "irgwalk.h"
#include "irgmod.h"
#include "irnode_t.h"
+#include "irtools.h"
-#define SET_VNUM(node, vnum) set_irn_link(node,
(void *)vnum
)
-#define GET_VNUM(node) (unsigned)
get_irn_link(node
)
+#define SET_VNUM(node, vnum) set_irn_link(node,
INT_TO_PTR(vnum)
)
+#define GET_VNUM(node) (unsigned)
PTR_TO_INT(get_irn_link(node)
)
/**
* A path element entry: it is either an entity
/**
* A path element entry: it is either an entity
@@
-63,7
+64,7
@@
typedef struct _path_t {
typedef struct _scalars_t {
entity *ent; /**< A entity for scalar replacement. */
typedef struct _scalars_t {
entity *ent; /**< A entity for scalar replacement. */
-
type *ent_owner;
/**< The owner of this entity. */
+
ir_type *ent_owner;
/**< The owner of this entity. */
} scalars_t;
} scalars_t;
@@
-103,7
+104,7
@@
static unsigned path_hash(const path_t *path)
unsigned i;
for (i = 0; i < path->path_len; ++i)
unsigned i;
for (i = 0; i < path->path_len; ++i)
- hash ^= (unsigned)
path->path[i].ent
;
+ hash ^= (unsigned)
PTR_TO_INT(path->path[i].ent)
;
return hash >> 4;
}
return hash >> 4;
}
@@
-125,21
+126,18
@@
static int is_const_sel(ir_node *sel) {
return 1;
}
return 1;
}
-/*
*
+/*
* Returns non-zero, if the address of an entity
* represented by a Sel node (or it's successor Sels) is taken.
* Returns non-zero, if the address of an entity
* represented by a Sel node (or it's successor Sels) is taken.
- *
- * @param sel the Sel node
*/
*/
-
static
int is_address_taken(ir_node *sel)
+int is_address_taken(ir_node *sel)
{
{
- int i
, n
;
+ int i;
if (! is_const_sel(sel))
return 1;
if (! is_const_sel(sel))
return 1;
- n = get_irn_n_outs(sel);
- for (i = 0; i < n; ++i) {
+ for (i = get_irn_n_outs(sel) - 1; i >= 0; --i) {
ir_node *succ = get_irn_out(sel, i);
switch (get_irn_opcode(succ)) {
ir_node *succ = get_irn_out(sel, i);
switch (get_irn_opcode(succ)) {
@@
-270,7
+268,7
@@
static int find_possible_replacements(ir_graph *irg)
if (get_irn_op(succ) == op_Sel) {
entity *ent = get_Sel_entity(succ);
if (get_irn_op(succ) == op_Sel) {
entity *ent = get_Sel_entity(succ);
- type *ent_type;
+
ir_
type *ent_type;
if (get_entity_link(ent) == ADDRESS_TAKEN)
continue;
if (get_entity_link(ent) == ADDRESS_TAKEN)
continue;
@@
-388,7
+386,7
@@
static unsigned allocate_value_numbers(pset *sels, entity *ent, unsigned vnum, i
else
printf("[%ld]", get_tarval_long(key->path[i].tv));
}
else
printf("[%ld]", get_tarval_long(key->path[i].tv));
}
- printf(" = %u (%s)\n",
(int)get_irn_link(sel
), get_mode_name((*modes)[key->vnum]));
+ printf(" = %u (%s)\n",
PTR_TO_INT(get_irn_link(sel)
), get_mode_name((*modes)[key->vnum]));
}
#endif /* DEBUG_libfirm */
}
}
#endif /* DEBUG_libfirm */
}
@@
-676,7
+674,7
@@
void scalar_replacement_opt(ir_graph *irg)
ir_mode **modes;
set *set_ent;
pset *sels;
ir_mode **modes;
set *set_ent;
pset *sels;
-
type
*ent_type;
+
ir_type
*ent_type;
ir_graph *rem;
if (! get_opt_scalar_replacement())
ir_graph *rem;
if (! get_opt_scalar_replacement())