public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2283] Make gimple_could_trap_p const-safe.
@ 2021-07-13 13:04 Roger Sayle
0 siblings, 0 replies; only message in thread
From: Roger Sayle @ 2021-07-13 13:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9aa5001ef466e6162e4acc11c6999747299474f1
commit r12-2283-g9aa5001ef466e6162e4acc11c6999747299474f1
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Tue Jul 13 14:01:41 2021 +0100
Make gimple_could_trap_p const-safe.
Allow gimple_could_trap_p (which previously took a non-const gimple)
to be called from functions that take a const gimple (such as
gimple_has_side_effects), and update its prototypes. Pre-approved
as obvious.
2021-07-13 Roger Sayle <roger@nextmovesoftware.com>
Richard Biener <rguenther@suse.de>
gcc/ChangeLog
* gimple.c (gimple_could_trap_p_1): Make S argument a
"const gimple*". Preserve constness in call to
gimple_asm_volatile_p.
(gimple_could_trap_p): Make S argument a "const gimple*".
* gimple.h (gimple_could_trap_p_1, gimple_could_trap_p):
Update function prototypes.
Diff:
---
gcc/gimple.c | 6 +++---
gcc/gimple.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/gcc/gimple.c b/gcc/gimple.c
index cc464547e34..0690f94971f 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2129,7 +2129,7 @@ gimple_has_side_effects (const gimple *s)
S is a GIMPLE_ASSIGN, the LHS of the assignment is also checked. */
bool
-gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores)
+gimple_could_trap_p_1 (const gimple *s, bool include_mem, bool include_stores)
{
tree t, div = NULL_TREE;
enum tree_code op;
@@ -2146,7 +2146,7 @@ gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores)
switch (gimple_code (s))
{
case GIMPLE_ASM:
- return gimple_asm_volatile_p (as_a <gasm *> (s));
+ return gimple_asm_volatile_p (as_a <const gasm *> (s));
case GIMPLE_CALL:
if (gimple_call_internal_p (s))
@@ -2194,7 +2194,7 @@ gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores)
/* Return true if statement S can trap. */
bool
-gimple_could_trap_p (gimple *s)
+gimple_could_trap_p (const gimple *s)
{
return gimple_could_trap_p_1 (s, true, true);
}
diff --git a/gcc/gimple.h b/gcc/gimple.h
index be1155e262d..acf572b81be 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1601,8 +1601,8 @@ void gimple_set_lhs (gimple *, tree);
gimple *gimple_copy (gimple *);
void gimple_move_vops (gimple *, gimple *);
bool gimple_has_side_effects (const gimple *);
-bool gimple_could_trap_p_1 (gimple *, bool, bool);
-bool gimple_could_trap_p (gimple *);
+bool gimple_could_trap_p_1 (const gimple *, bool, bool);
+bool gimple_could_trap_p (const gimple *);
bool gimple_assign_rhs_could_trap_p (gimple *);
extern void dump_gimple_statistics (void);
unsigned get_gimple_rhs_num_ops (enum tree_code);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-13 13:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 13:04 [gcc r12-2283] Make gimple_could_trap_p const-safe Roger Sayle
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).