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
72c631f3
Commit
72c631f3
authored
Sep 01, 2011
by
Manuel Mohr
Browse files
Do not regard functions with compound return types as pure/const.
parent
bb3144f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/opt/funccall.c
View file @
72c631f3
...
...
@@ -71,6 +71,23 @@ static unsigned *busy_set;
*/
#define mtp_temporary mtp_property_inherited
static
bool
has_compound_return_type
(
ir_node
*
node
)
{
ir_type
*
mtp
=
get_Call_type
(
node
);
size_t
n_res
=
get_method_n_ress
(
mtp
);
size_t
i
;
for
(
i
=
0
;
i
<
n_res
;
++
i
)
{
ir_type
*
rtp
=
get_method_res_type
(
mtp
,
i
);
if
(
is_compound_type
(
rtp
))
{
return
true
;
}
}
return
false
;
}
/**
* Walker: Collect all calls to const and pure functions
* to lists. Collect all Proj(Call) nodes into a Proj list.
...
...
@@ -88,6 +105,16 @@ 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
);
/* If the backend's calling convention handles compound return types
* via a hidden pointer argument, it is incorrect to regard this
* call as a call to a const/pure function.
* TODO: This might be overly conservative if the backend uses
* a different calling convention, e.g., for small structs. */
if
(
has_compound_return_type
(
node
))
{
return
;
}
ptr
=
get_Call_ptr
(
call
);
if
(
is_Global
(
ptr
))
{
ent
=
get_Global_entity
(
ptr
);
...
...
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