Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
7fa38f2c
Commit
7fa38f2c
authored
Nov 06, 2014
by
Christoph Mallon
Browse files
ir: Use get_Proj_for_pn().
parent
eb59f4f2
Changes
8
Hide whitespace changes
Inline
Side-by-side
ir/ana/irconsconfirm.c
View file @
7fa38f2c
...
...
@@ -162,16 +162,10 @@ static void handle_modeb(ir_node *block, ir_node *selector, pn_Cond pnc, env_t *
/* get the other block */
if
(
other_blk
==
NULL
)
{
/* we have already tested, that block has only ONE Cond predecessor */
ir_node
*
cond
=
get_Proj_pred
(
get_Block_cfgpred
(
block
,
0
));
foreach_out_edge
(
cond
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
if
(
get_Proj_num
(
proj
)
==
pnc
)
continue
;
edge
=
get_irn_out_edge_first
(
proj
);
other_blk
=
get_edge_src_irn
(
edge
);
break
;
}
assert
(
other_blk
);
ir_node
*
const
cond
=
get_Proj_pred
(
get_Block_cfgpred
(
block
,
0
));
ir_node
*
const
proj
=
get_Proj_for_pn
(
cond
,
pn_Cond_false
+
pn_Cond_true
-
pnc
);
assert
(
proj
);
other_blk
=
get_edge_src_irn
(
get_irn_out_edge_first
(
proj
));
/*
* Note the special case here: if block is a then, there might be no else
...
...
ir/be/benode.c
View file @
7fa38f2c
...
...
@@ -532,15 +532,8 @@ ir_node *be_get_initial_reg_value(ir_graph *irg, const arch_register_t *reg)
ir_node
*
start
=
get_irg_start
(
irg
);
ir_mode
*
mode
=
arch_register_class_mode
(
reg
->
reg_class
);
foreach_out_edge
(
start
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
if
(
!
is_Proj
(
proj
))
// maybe End/Anchor
continue
;
if
(
get_Proj_num
(
proj
)
==
i
)
{
return
proj
;
}
}
return
new_r_Proj
(
start
,
mode
,
i
);
ir_node
*
const
proj
=
get_Proj_for_pn
(
start
,
i
);
return
proj
?
proj
:
new_r_Proj
(
start
,
mode
,
i
);
}
static
ir_entity
*
dummy_get_frame_entity
(
const
ir_node
*
node
)
...
...
ir/be/ia32/ia32_finish.c
View file @
7fa38f2c
...
...
@@ -96,21 +96,15 @@ static void ia32_transform_sub_to_neg_add(ir_node *irn)
bool
needs_carry
=
false
;
/** See if someone is interested in a correctly set carry flag */
if
(
get_irn_mode
(
irn
)
==
mode_T
)
{
foreach_out_edge
(
irn
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
unsigned
pn
=
get_Proj_num
(
proj
);
if
(
pn
==
pn_ia32_flags
)
{
assert
(
flags_proj
==
NULL
);
flags_proj
=
proj
;
foreach_out_edge
(
flags_proj
,
edge
)
{
ir_node
*
user
=
get_edge_src_irn
(
edge
);
x86_condition_code_t
cc
=
get_ia32_condcode
(
user
);
if
(
reads_carry
(
cc
))
{
needs_carry
=
true
;
break
;
}
flags_proj
=
get_Proj_for_pn
(
irn
,
pn_ia32_flags
);
if
(
flags_proj
)
{
foreach_out_edge
(
flags_proj
,
edge
)
{
ir_node
*
user
=
get_edge_src_irn
(
edge
);
x86_condition_code_t
cc
=
get_ia32_condcode
(
user
);
if
(
reads_carry
(
cc
))
{
needs_carry
=
true
;
break
;
}
break
;
}
}
}
...
...
ir/be/ia32/ia32_optimize.c
View file @
7fa38f2c
...
...
@@ -441,19 +441,10 @@ static void peephole_IncSP_Store_to_push(ir_node *irn)
/* create memory Proj */
ir_node
*
mem_proj
=
new_r_Proj
(
push
,
mode_M
,
pn_ia32_Push_M
);
/* rewire Store Projs */
foreach_out_edge_safe
(
store
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
if
(
!
is_Proj
(
proj
))
continue
;
switch
(
get_Proj_num
(
proj
))
{
case
pn_ia32_Store_M
:
/* Rewire Store Proj. */
ir_node
*
const
proj
=
get_Proj_for_pn
(
store
,
pn_ia32_Store_M
);
if
(
proj
)
exchange
(
proj
,
mem_proj
);
break
;
default:
panic
(
"unexpected Proj on Store->IncSp"
);
}
}
/* use the memproj now */
be_peephole_exchange
(
store
,
push
);
...
...
ir/be/ia32/ia32_x87.c
View file @
7fa38f2c
...
...
@@ -1207,24 +1207,6 @@ static bool sim_Copy(x87_state *state, ir_node *n)
return
false
;
}
/**
* Returns the vf0 result Proj of a Call.
*
* @para call the Call node
*/
static
ir_node
*
get_call_result_proj
(
ir_node
*
call
)
{
/* search the result proj */
foreach_out_edge
(
call
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
unsigned
pn
=
get_Proj_num
(
proj
);
if
(
pn
==
pn_ia32_Call_first_result
)
return
proj
;
}
panic
(
"result Proj missing"
);
}
static
bool
sim_Asm
(
x87_state
*
const
state
,
ir_node
*
const
n
)
{
(
void
)
state
;
...
...
@@ -1261,7 +1243,7 @@ static bool sim_Call(x87_state *state, ir_node *n)
ir_type
*
const
res_type
=
get_method_res_type
(
call_tp
,
0
);
ir_mode
*
const
mode
=
get_type_mode
(
res_type
);
if
(
mode
&&
mode_is_float
(
mode
))
{
ir_node
*
const
resproj
=
get_
call_result_proj
(
n
);
ir_node
*
const
resproj
=
get_
Proj_for_pn
(
n
,
pn_ia32_Call_first_result
);
arch_register_t
const
*
const
reg
=
arch_get_irn_register
(
resproj
);
x87_push
(
state
,
reg
->
index
,
resproj
);
}
...
...
ir/be/sparc/sparc_finish.c
View file @
7fa38f2c
...
...
@@ -636,14 +636,7 @@ static void finish_sparc_Return(ir_node *node)
*/
static
bool
has_flags_user
(
ir_node
*
node
)
{
foreach_out_edge
(
node
,
edge
)
{
ir_node
*
src
=
get_edge_src_irn
(
edge
);
if
(
is_Proj
(
src
)
&&
get_Proj_num
(
src
)
==
pn_sparc_AddCC_flags
)
return
true
;
}
return
false
;
return
get_Proj_for_pn
(
node
,
pn_sparc_AddCC_flags
)
!=
NULL
;
}
/*
...
...
ir/lower/lower_calls.c
View file @
7fa38f2c
...
...
@@ -581,20 +581,6 @@ static void get_dest_addrs(const cl_entry *entry, ir_node **ins,
}
}
static
ir_node
*
find_proj
(
ir_node
*
node
,
long
search_pn
)
{
assert
(
get_irn_mode
(
node
)
==
mode_T
);
foreach_out_edge
(
node
,
edge
)
{
ir_node
*
src
=
get_edge_src_irn
(
edge
);
if
(
!
is_Proj
(
src
))
continue
;
long
pn
=
get_Proj_num
(
src
);
if
(
pn
==
search_pn
)
return
src
;
}
return
NULL
;
}
static
void
fix_int_return
(
const
cl_entry
*
entry
,
ir_node
*
base_addr
,
unsigned
n_int_rets
,
long
orig_pn
,
long
pn
)
{
...
...
@@ -617,7 +603,7 @@ static void fix_int_return(const cl_entry *entry, ir_node *base_addr,
if
(
proj_res
==
NULL
)
proj_res
=
new_r_Proj
(
call
,
mode_T
,
pn_Call_T_result
);
/* reroute old users */
ir_node
*
res_user
=
find_proj
(
proj_res
,
orig_pn
);
ir_node
*
const
res_user
=
get_Proj_for_pn
(
proj_res
,
orig_pn
);
if
(
res_user
!=
NULL
)
edges_reroute
(
res_user
,
base_addr
);
...
...
ir/lower/lower_dw.c
View file @
7fa38f2c
...
...
@@ -1822,16 +1822,7 @@ static void lower_Start(ir_node *node, ir_mode *high_mode)
}
/* find args Proj */
ir_node
*
args
=
NULL
;
foreach_out_edge
(
node
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
if
(
!
is_Proj
(
proj
))
continue
;
if
(
get_Proj_num
(
proj
)
==
pn_Start_T_args
)
{
args
=
proj
;
break
;
}
}
ir_node
*
const
args
=
get_Proj_for_pn
(
node
,
pn_Start_T_args
);
if
(
args
==
NULL
)
return
;
...
...
@@ -1940,16 +1931,7 @@ static void lower_Call(ir_node *node, ir_mode *mode)
set_irn_in
(
node
,
j
,
in
);
/* find results T */
ir_node
*
resproj
=
NULL
;
foreach_out_edge
(
node
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
if
(
!
is_Proj
(
proj
))
continue
;
if
(
get_Proj_num
(
proj
)
==
pn_Call_T_result
)
{
resproj
=
proj
;
break
;
}
}
ir_node
*
resproj
=
get_Proj_for_pn
(
node
,
pn_Call_T_result
);
if
(
resproj
==
NULL
)
return
;
...
...
@@ -2517,15 +2499,9 @@ static void lower_arithmetic_builtin(ir_node *builtin, ir_mode *mode)
}
/* search result Proj */
foreach_out_edge_safe
(
builtin
,
edge
)
{
ir_node
*
proj
=
get_edge_src_irn
(
edge
);
if
(
!
is_Proj
(
proj
))
continue
;
if
(
get_Proj_num
(
proj
)
==
pn_Builtin_max
+
1
)
{
ir_set_dw_lowered
(
proj
,
res_low
,
res_high
);
}
}
ir_node
*
const
proj
=
get_Proj_for_pn
(
builtin
,
pn_Builtin_max
+
1
);
if
(
proj
)
ir_set_dw_lowered
(
proj
,
res_low
,
res_high
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment