diff options
author | Richard Biener <rguenther@suse.de> | 2022-12-16 13:48:58 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-04-19 11:52:07 +0200 |
commit | 2c800ed8d59cffce678ef08a6d172465c17f015d (patch) | |
tree | 180b8b7e56b3e3dc2829b4a78a59ec7b52b6bee8 /gcc/gimple.cc | |
parent | 9bc407c787771baad6c69cee3e392f15a5b9163d (diff) | |
download | gcc-2c800ed8d59cffce678ef08a6d172465c17f015d.zip gcc-2c800ed8d59cffce678ef08a6d172465c17f015d.tar.gz gcc-2c800ed8d59cffce678ef08a6d172465c17f015d.tar.bz2 |
Simplify gimple_assign_load
The following simplifies and outlines gimple_assign_load. In
particular it is not necessary to get at the base of the possibly
loaded expression but just handle the case of a single handled
component wrapping a non-memory operand.
* gimple.h (gimple_assign_load): Outline...
* gimple.cc (gimple_assign_load): ... here. Avoid
get_base_address and instead just strip the outermost
handled component, treating a remaining handled component
as load.
Diffstat (limited to 'gcc/gimple.cc')
-rw-r--r-- | gcc/gimple.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/gimple.cc b/gcc/gimple.cc index 5e4eda4..e0ba42a 100644 --- a/gcc/gimple.cc +++ b/gcc/gimple.cc @@ -1788,6 +1788,26 @@ gimple_assign_unary_nop_p (gimple *gs) == TYPE_MODE (TREE_TYPE (gimple_assign_rhs1 (gs))))); } +/* Return true if GS is an assignment that loads from its rhs1. */ + +bool +gimple_assign_load_p (const gimple *gs) +{ + tree rhs; + if (!gimple_assign_single_p (gs)) + return false; + rhs = gimple_assign_rhs1 (gs); + if (TREE_CODE (rhs) == WITH_SIZE_EXPR) + return true; + if (handled_component_p (rhs)) + rhs = TREE_OPERAND (rhs, 0); + return (handled_component_p (rhs) + || DECL_P (rhs) + || TREE_CODE (rhs) == MEM_REF + || TREE_CODE (rhs) == TARGET_MEM_REF); +} + + /* Set BB to be the basic block holding G. */ void |