From: Thomas Schwinge <thomas@codesourcery.com>
To: <gcc@gcc.gnu.org>
Subject: 'walk_stmt_load_store_addr_ops' for non-'gimple_assign_single_p (stmt)'
Date: Mon, 15 Mar 2021 19:31:46 +0100 [thread overview]
Message-ID: <87pn00z2st.fsf@euler.schwinge.homeip.net> (raw)
Hi!
First time I'm using this API -- so the error certainly may be on my
side. ;-)
What I'm doing, is a 'walk_gimple_seq', and in that one's
'callback_stmt', call 'walk_stmt_load_store_addr_ops', to collect
variable load/store/address-taken instances. This did seem quite
straight-forward, given the description; 'gcc/gimple-walk.c':
/* For the statement STMT call the callbacks VISIT_LOAD, VISIT_STORE and
VISIT_ADDR if non-NULL on loads, store and address-taken operands
passing the STMT, the base of the operand, the operand itself containing
the base and DATA to it. The base will be either a decl, an indirect
reference (including TARGET_MEM_REF) or the argument of an address
expression.
Returns the results of these callbacks or'ed. */
bool
walk_stmt_load_store_addr_ops (gimple *stmt, void *data,
walk_stmt_load_store_addr_fn visit_load,
walk_stmt_load_store_addr_fn visit_store,
walk_stmt_load_store_addr_fn visit_addr)
{ [...] }
Indeed, given (Fortran) 'zzz = 1', we produce GIMPLE:
gimple_assign <real_cst, zzz, 1.0e+0, NULL, NULL>
..., and calling 'walk_stmt_load_store_addr_ops' on that, I see, as
expected, the 'visit_store' callback invoked, with 'rhs' and 'arg':
'<var_decl zzz>'.
However, given (Fortran) 'zzz = r + r2', we produce GIMPLE:
gimple_assign <plus_expr, zzz, r, r2, NULL>
..., and calling 'walk_stmt_load_store_addr_ops' on that, I see,
unexpectedly, no callback at all invoked: neither 'visit_load', nor
'visit_store' (nor 'visit_address', obviously).
From a quick look at 'gcc/gimple-walk.c:walk_stmt_load_store_addr_ops',
this seems to intentionally be implemented in this way -- but I don't
understand the rationale?
Instead of 'walk_gimple_seq' -> 'callback_stmt' ->
'walk_stmt_load_store_addr_ops', do I need to use 'walk_gimple_seq' ->
'callback_op' -> "something"?
Grüße
Thomas
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
next reply other threads:[~2021-03-15 18:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-15 18:31 Thomas Schwinge [this message]
2021-03-15 19:17 ` Richard Biener
2021-03-16 15:02 ` Thomas Schwinge
2021-03-16 15:16 ` Richard Biener
2021-03-16 15:25 ` Michael Matz
2021-03-16 23:24 ` Thomas Schwinge
2021-03-17 7:46 ` Richard Biener
2021-03-18 12:32 ` Thomas Schwinge
2021-03-17 7:42 ` Richard Biener
2021-03-17 13:27 ` Michael Matz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pn00z2st.fsf@euler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=gcc@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).