Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
ee5e273a
Commit
ee5e273a
authored
Jan 24, 2014
by
Matthias Braun
Browse files
do the fix the other way round to avoid verify errors
parent
eff9312c
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/lower/lower_calls.c
View file @
ee5e273a
...
...
@@ -207,7 +207,7 @@ typedef struct wlk_env {
ir_heights_t
*
heights
;
/**< Heights for reachability check. */
bool
only_local_mem
:
1
;
/**< Set if only local memory access was found. */
bool
changed
:
1
;
/**< Set if the current graph was changed. */
ir_node
**
ar
g_proj
s
;
ir_node
**
p
ar
am_sel
s
;
}
wlk_env
;
/**
...
...
@@ -320,8 +320,11 @@ static void fix_args_and_collect_calls(ir_node *n, void *ctx)
case
iro_Proj
:
{
ir_node
*
pred
=
get_Proj_pred
(
n
);
ir_graph
*
irg
=
get_irn_irg
(
n
);
if
(
pred
==
get_irg_args
(
irg
))
ARR_APP1
(
ir_node
*
,
env
->
arg_projs
,
n
);
if
(
pred
==
get_irg_args
(
irg
))
{
long
pn
=
get_Proj_proj
(
n
);
set_Proj_proj
(
n
,
pn
+
env
->
arg_shift
);
env
->
changed
=
true
;
}
break
;
}
case
iro_Call
:
{
...
...
@@ -383,21 +386,12 @@ static void fix_args_and_collect_calls(ir_node *n, void *ctx)
}
case
iro_Sel
:
{
ir_entity
*
entity
=
get_Sel_entity
(
n
);
ir_type
*
type
=
get_entity_type
(
entity
);
if
(
is_parameter_entity
(
entity
)
&&
is_aggregate_type
(
type
))
{
if
(
!
(
env
->
flags
&
LF_DONT_LOWER_ARGUMENTS
))
{
/* note that the walker will hit the Proj later on and apply arg
* shift although the entity parameter number is already
* shifted, so we subtract arg_shift here to adjust for that. */
size_t
num
=
get_entity_parameter_number
(
entity
)
-
env
->
arg_shift
;
ir_graph
*
irg
=
get_irn_irg
(
n
);
ir_node
*
args
=
get_irg_args
(
irg
);
ir_node
*
ptr
=
new_r_Proj
(
args
,
mode_P
,
num
);
exchange
(
n
,
ptr
);
}
if
(
!
is_parameter_entity
(
entity
))
break
;
ir_type
*
type
=
get_entity_type
(
entity
);
if
(
is_aggregate_type
(
type
))
{
if
(
!
(
env
->
flags
&
LF_DONT_LOWER_ARGUMENTS
))
ARR_APP1
(
ir_node
*
,
env
->
param_sels
,
n
);
/* we need to copy compound parameters */
env
->
only_local_mem
=
false
;
}
...
...
@@ -690,23 +684,23 @@ static void transform_irg(compound_call_lowering_flags flags, ir_graph *irg)
env
.
arg_shift
=
arg_shift
;
env
.
flags
=
flags
;
env
.
lowered_mtp
=
lowered_mtp
;
env
.
ar
g_projs
=
NEW_ARR_F
(
ir_node
*
,
0
);
env
.
p
ar
am_sels
=
NEW_ARR_F
(
ir_node
*
,
0
);
env
.
only_local_mem
=
true
;
/* scan the code, fix argument numbers and collect calls. */
irg_walk_graph
(
irg
,
firm_clear_link
,
NULL
,
&
env
);
irg_walk_graph
(
irg
,
fix_args_and_collect_calls
,
NULL
,
&
env
);
/* fix ar
gument proj number
s */
i
f
(
arg_shift
>
0
)
{
for
(
size_t
i
=
0
,
n
=
ARR_LEN
(
env
.
ar
g_proj
s
);
i
<
n
;
++
i
)
{
ir_node
*
proj
=
env
.
ar
g_proj
s
[
i
];
long
pn
=
get_Proj_proj
(
proj
);
set_Proj_proj
(
proj
,
pn
+
arg_shift
);
env
.
changed
=
true
;
}
/* fix
p
ar
ameter sel
s */
i
r_node
*
args
=
get_irg_args
(
irg
);
for
(
size_t
i
=
0
,
n
=
ARR_LEN
(
env
.
p
ar
am_sel
s
);
i
<
n
;
++
i
)
{
ir_node
*
sel
=
env
.
p
ar
am_sel
s
[
i
];
ir_entity
*
entity
=
get_Sel_entity
(
sel
);
size_t
num
=
get_entity_parameter_number
(
entity
);
ir_node
*
ptr
=
new_r_Proj
(
args
,
mode_P
,
num
)
;
exchange
(
sel
,
ptr
);
}
DEL_ARR_F
(
env
.
ar
g_proj
s
);
DEL_ARR_F
(
env
.
p
ar
am_sel
s
);
if
(
n_param_com
>
0
&&
!
(
flags
&
LF_DONT_LOWER_ARGUMENTS
))
remove_compound_param_entities
(
irg
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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