aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@arm.com>2016-11-25 10:03:46 +0000
committerThomas Preud'homme <thopre01@gcc.gnu.org>2016-11-25 10:03:46 +0000
commitd8cc3d06f8e365f8c175fbf2923ed15d78ca8510 (patch)
tree835f5f5213a2d99a1b6f137d223f61dba6fb05fb /gcc
parent83624b6040aaf0039e65b3160fcbc1111def7260 (diff)
downloadgcc-d8cc3d06f8e365f8c175fbf2923ed15d78ca8510.zip
gcc-d8cc3d06f8e365f8c175fbf2923ed15d78ca8510.tar.gz
gcc-d8cc3d06f8e365f8c175fbf2923ed15d78ca8510.tar.bz2
Improve comment for struct symbolic_number in bswap pass
2016-11-25 Thomas Preud'homme <thomas.preudhomme@arm.com> gcc/ * tree-ssa-math-opts.c (struct symbolic_number): Improve comment. From-SVN: r242870
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/tree-ssa-math-opts.c39
2 files changed, 27 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 69e1235..d739a66 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2016-11-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
+ * tree-ssa-math-opts.c (struct symbolic_number): Improve comment.
+
+2016-11-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
PR tree-optimization/77673
* tree-ssa-math-opts.c (struct symbolic_number): Add new src field.
(init_symbolic_number): Initialize src field from src parameter.
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index b0b0c24..4a47254 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1931,25 +1931,32 @@ make_pass_cse_sincos (gcc::context *ctxt)
return new pass_cse_sincos (ctxt);
}
-/* A symbolic number is used to detect byte permutation and selection
- patterns. Therefore the field N contains an artificial number
- consisting of octet sized markers:
+/* A symbolic number structure is used to detect byte permutation and selection
+ patterns of a source. To achieve that, its field N contains an artificial
+ number consisting of BITS_PER_MARKER sized markers tracking where does each
+ byte come from in the source:
- 0 - target byte has the value 0
- FF - target byte has an unknown value (eg. due to sign extension)
- 1..size - marker value is the target byte index minus one.
+ 0 - target byte has the value 0
+ FF - target byte has an unknown value (eg. due to sign extension)
+ 1..size - marker value is the byte index in the source (0 for lsb).
To detect permutations on memory sources (arrays and structures), a symbolic
- number is also associated a base address (the array or structure the load is
- made from), an offset from the base address and a range which gives the
- difference between the highest and lowest accessed memory location to make
- such a symbolic number. The range is thus different from size which reflects
- the size of the type of current expression. Note that for non memory source,
- range holds the same value as size.
-
- For instance, for an array char a[], (short) a[0] | (short) a[3] would have
- a size of 2 but a range of 4 while (short) a[0] | ((short) a[0] << 1) would
- still have a size of 2 but this time a range of 1. */
+ number is also associated:
+ - a base address BASE_ADDR and an OFFSET giving the address of the source;
+ - a range which gives the difference between the highest and lowest accessed
+ memory location to make such a symbolic number;
+ - the address SRC of the source element of lowest address as a convenience
+ to easily get BASE_ADDR + offset + lowest bytepos.
+
+ Note 1: the range is different from size as size reflects the size of the
+ type of the current expression. For instance, for an array char a[],
+ (short) a[0] | (short) a[3] would have a size of 2 but a range of 4 while
+ (short) a[0] | ((short) a[0] << 1) would still have a size of 2 but this
+ time a range of 1.
+
+ Note 2: for non-memory sources, range holds the same value as size.
+
+ Note 3: SRC points to the SSA_NAME in case of non-memory source. */
struct symbolic_number {
uint64_t n;