memset((void *)i_map, 0, sizeof(*i_map) * n_ops);
/* fill a map for faster search */
memset((void *)i_map, 0, sizeof(*i_map) * n_ops);
/* fill a map for faster search */
/**
* Wrapper for running lower_intrinsics() as an ir_prog pass.
*/
static int pass_wrapper(ir_prog *irp, void *context)
{
/**
* Wrapper for running lower_intrinsics() as an ir_prog pass.
*/
static int pass_wrapper(ir_prog *irp, void *context)
{
(void) irp; /* TODO: set current irp, or remove parameter */
lower_intrinsics(pass->list, pass->length, pass->part_block_used);
/* probably this pass should not run again */
(void) irp; /* TODO: set current irp, or remove parameter */
lower_intrinsics(pass->list, pass->length, pass->part_block_used);
/* probably this pass should not run again */
*/
static void replace_call(ir_node *irn, ir_node *call, ir_node *mem, ir_node *reg_jmp, ir_node *exc_jmp)
{
*/
static void replace_call(ir_node *irn, ir_node *call, ir_node *mem, ir_node *reg_jmp, ir_node *exc_jmp)
{
set_Tuple_pred(call, pn_Call_X_regular, reg_jmp);
set_Tuple_pred(call, pn_Call_X_except, exc_jmp);
set_Tuple_pred(call, pn_Call_T_result, irn);
set_Tuple_pred(call, pn_Call_X_regular, reg_jmp);
set_Tuple_pred(call, pn_Call_X_except, exc_jmp);
set_Tuple_pred(call, pn_Call_T_result, irn);
/* A mapper for the floating point sqrt. */
int i_mapper_sqrt(ir_node *call, void *ctx)
{
/* A mapper for the floating point sqrt. */
int i_mapper_sqrt(ir_node *call, void *ctx)
{
/* A mapper for the floating point cbrt. */
int i_mapper_cbrt(ir_node *call, void *ctx)
{
/* A mapper for the floating point cbrt. */
int i_mapper_cbrt(ir_node *call, void *ctx)
{
- ir_node *mem;
- ir_node *left = get_Call_param(call, 0);
- ir_node *right = get_Call_param(call, 1);
- ir_node *block = get_nodes_block(call);
- ir_node *irn, *reg_jmp = NULL, *exc_jmp = NULL;
+ ir_node *mem;
+ ir_node *left = get_Call_param(call, 0);
+ ir_node *right = get_Call_param(call, 1);
+ ir_node *block = get_nodes_block(call);
+ ir_graph *irg = get_irn_irg(block);
+ ir_node *irn, *reg_jmp = NULL, *exc_jmp = NULL;
quot = new_rd_Quot(dbg, block, mem, irn, left, mode, op_pin_state_pinned);
mem = new_r_Proj(quot, mode_M, pn_Quot_M);
irn = new_r_Proj(quot, mode, pn_Quot_res);
quot = new_rd_Quot(dbg, block, mem, irn, left, mode, op_pin_state_pinned);
mem = new_r_Proj(quot, mode_M, pn_Quot_M);
irn = new_r_Proj(quot, mode, pn_Quot_res);
ir_node *mem = get_Call_mem(call);
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_EXP);
replace_call(irn, call, mem, NULL, NULL);
ir_node *mem = get_Call_mem(call);
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_EXP);
replace_call(irn, call, mem, NULL, NULL);
- ir_mode *mode = get_irn_mode(val);
- ir_node *irn = new_Const(get_mode_null(mode));
- ir_node *mem = get_Call_mem(call);
+ ir_graph *irg = get_irn_irg(val);
+ ir_mode *mode = get_irn_mode(val);
+ ir_node *irn = new_r_Const(irg, get_mode_null(mode));
+ ir_node *mem = get_Call_mem(call);
DBG_OPT_ALGSIM0(call, irn, reason);
replace_call(irn, call, mem, NULL, NULL);
return 1;
DBG_OPT_ALGSIM0(call, irn, reason);
replace_call(irn, call, mem, NULL, NULL);
return 1;
ir_node *mem = get_Call_mem(call);
DBG_OPT_ALGSIM0(call, irn, reason);
replace_call(irn, call, mem, NULL, NULL);
ir_node *mem = get_Call_mem(call);
DBG_OPT_ALGSIM0(call, irn, reason);
replace_call(irn, call, mem, NULL, NULL);
- tarval *tv = new_tarval_from_long(len, get_type_mode(res_tp));
- return new_Const_type(tv, res_tp);
+ ir_tarval *tv = new_tarval_from_long(len, get_type_mode(res_tp));
+ return new_r_Const(irg, tv);
for (i = 0; i < size; ++i) {
ir_initializer_t *val = get_initializer_compound_value(initializer, i);
if (initializer_val_is_null(val)) {
for (i = 0; i < size; ++i) {
ir_initializer_t *val = get_initializer_compound_value(initializer, i);
if (initializer_val_is_null(val)) {
- tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp));
- return new_Const_type(tv, res_tp);
+ ir_tarval *tv = new_tarval_from_long(i, get_type_mode(res_tp));
+ return new_r_Const(irg, tv);
-static ir_node *eval_strcmp(ir_entity *left, ir_entity *right, ir_type *res_tp)
+static ir_node *eval_strcmp(ir_graph *irg, ir_entity *left, ir_entity *right,
+ ir_type *res_tp)
- tarval *tv = new_tarval_from_long(res, get_type_mode(res_tp));
- return new_Const_type(tv, res_tp);
+ ir_tarval *tv = new_tarval_from_long(res, get_type_mode(res_tp));
+ return new_r_Const(irg, tv);
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRCMP);
replace_call(irn, call, mem, NULL, NULL);
return 1;
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRCMP);
replace_call(irn, call, mem, NULL, NULL);
return 1;
if (ent_l != NULL && ent_r != NULL) {
/* both entities are const, try to evaluate */
if (ent_l != NULL && ent_r != NULL) {
/* both entities are const, try to evaluate */
- irn = eval_strcmp(ent_l, ent_r, res_tp);
+ irn = eval_strcmp(get_irn_irg(call), ent_l, ent_r, res_tp);
} else if (ent_l != NULL) {
if (is_empty_string(ent_l)) {
/* s strcmp("", s) ==> -(*s)*/
} else if (ent_l != NULL) {
if (is_empty_string(ent_l)) {
/* s strcmp("", s) ==> -(*s)*/
- irn = new_rd_Load(dbg, block, mem, v, mode, 0);
+ irn = new_rd_Load(dbg, block, mem, v, mode, cons_none);
mem = new_r_Proj(irn, mode_M, pn_Load_M);
exc = new_r_Proj(irn, mode_X, pn_Load_X_except);
reg = new_r_Proj(irn, mode_X, pn_Load_X_regular);
mem = new_r_Proj(irn, mode_M, pn_Load_M);
exc = new_r_Proj(irn, mode_X, pn_Load_X_except);
reg = new_r_Proj(irn, mode_X, pn_Load_X_regular);
if (left == right || (is_Const(len) && is_Const_null(len))) {
/* a strncmp(s, s, len) ==> 0 OR
a strncmp(a, b, 0) ==> 0 */
if (left == right || (is_Const(len) && is_Const_null(len))) {
/* a strncmp(s, s, len) ==> 0 OR
a strncmp(a, b, 0) ==> 0 */
ir_node *mem = get_Call_mem(call);
ir_node *adr = get_Call_ptr(call);
ir_entity *ent = get_SymConst_entity(adr);
ir_node *mem = get_Call_mem(call);
ir_node *adr = get_Call_ptr(call);
ir_entity *ent = get_SymConst_entity(adr);
ir_type *res_tp = get_method_res_type(call_tp, 0);
ir_mode *mode = get_type_mode(res_tp);
ir_type *res_tp = get_method_res_type(call_tp, 0);
ir_mode *mode = get_type_mode(res_tp);
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRNCMP);
replace_call(irn, call, mem, NULL, NULL);
return 1;
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRNCMP);
replace_call(irn, call, mem, NULL, NULL);
return 1;
if (left == right || (is_Const(len) && is_Const_null(len))) {
/* a memcmp(s, s, len) ==> 0 OR
a memcmp(a, b, 0) ==> 0 */
if (left == right || (is_Const(len) && is_Const_null(len))) {
/* a memcmp(s, s, len) ==> 0 OR
a memcmp(a, b, 0) ==> 0 */
ir_node *mem = get_Call_mem(call);
ir_node *adr = get_Call_ptr(call);
ir_entity *ent = get_SymConst_entity(adr);
ir_node *mem = get_Call_mem(call);
ir_node *adr = get_Call_ptr(call);
ir_entity *ent = get_SymConst_entity(adr);
ir_type *res_tp = get_method_res_type(call_tp, 0);
ir_mode *mode = get_type_mode(res_tp);
ir_type *res_tp = get_method_res_type(call_tp, 0);
ir_mode *mode = get_type_mode(res_tp);
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRNCMP);
replace_call(irn, call, mem, NULL, NULL);
return 1;
DBG_OPT_ALGSIM0(call, irn, FS_OPT_RTS_STRNCMP);
replace_call(irn, call, mem, NULL, NULL);
return 1;