diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-07-03 13:36:55 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-07-03 13:36:55 +0000 |
commit | bb64297941f34721c7d4e94e754b454086511cf9 (patch) | |
tree | aa95ccdabebcc6989fd1aaff624bf8dbfafbd39b /gcc/tree-data-ref.h | |
parent | 832b4117d4068670cc9ed496a7ab06104a12dc00 (diff) | |
download | gcc-bb64297941f34721c7d4e94e754b454086511cf9.zip gcc-bb64297941f34721c7d4e94e754b454086511cf9.tar.gz gcc-bb64297941f34721c7d4e94e754b454086511cf9.tar.bz2 |
Add DR_BASE_ALIGNMENT and DR_BASE_MISALIGNMENT
This patch records the base alignment and misalignment in
innermost_loop_behavior, to avoid the second-guessing that was
previously done in vect_compute_data_ref_alignment. It also makes
vect_analyze_data_refs use dr_analyze_innermost, instead of having an
almost-copy of the same code.
I wasn't sure whether the alignments should be measured in bits
(for consistency with most other interfaces) or in bytes (for consistency
with DR_ALIGNED_TO, now DR_OFFSET_ALIGNMENT, and with *_ptr_info_alignment).
I went for bytes because:
- I think in practice most consumers are going to want bytes.
E.g. using bytes avoids having to mix TYPE_ALIGN and TYPE_ALIGN_UNIT
in vect_compute_data_ref_alignment.
- It means that any bit-level paranoia is dealt with when building
the innermost_loop_behavior and doesn't get pushed down to consumers.
2017-07-03 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* tree-data-ref.h (innermost_loop_behavior): Add base_alignment
and base_misalignment fields.
(DR_BASE_ALIGNMENT, DR_BASE_MISALIGNMENT): New macros.
* tree-data-ref.c: Include builtins.h.
(dr_analyze_innermost): Set up the new innmost_loop_behavior fields.
* tree-vectorizer.h (STMT_VINFO_DR_BASE_ALIGNMENT): New macro.
(STMT_VINFO_DR_BASE_MISALIGNMENT): Likewise.
* tree-vect-data-refs.c: Include tree-cfg.h.
(vect_compute_data_ref_alignment): Use the new innermost_loop_behavior
fields instead of calculating an alignment here.
(vect_analyze_data_refs): Use dr_analyze_innermost. Dump the new
innermost_loop_behavior fields.
From-SVN: r249916
Diffstat (limited to 'gcc/tree-data-ref.h')
-rw-r--r-- | gcc/tree-data-ref.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index 3a5068d..72c68d0 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -52,6 +52,42 @@ struct innermost_loop_behavior tree init; tree step; + /* BASE_ADDRESS is known to be misaligned by BASE_MISALIGNMENT bytes + from an alignment boundary of BASE_ALIGNMENT bytes. For example, + if we had: + + struct S __attribute__((aligned(16))) { ... }; + + char *ptr; + ... *(struct S *) (ptr - 4) ...; + + the information would be: + + base_address: ptr + base_aligment: 16 + base_misalignment: 4 + init: -4 + + where init cancels the base misalignment. If instead we had a + reference to a particular field: + + struct S __attribute__((aligned(16))) { ... int f; ... }; + + char *ptr; + ... ((struct S *) (ptr - 4))->f ...; + + the information would be: + + base_address: ptr + base_aligment: 16 + base_misalignment: 4 + init: -4 + offsetof (S, f) + + where base_address + init might also be misaligned, and by a different + amount from base_address. */ + unsigned int base_alignment; + unsigned int base_misalignment; + /* The largest power of two that divides OFFSET, capped to a suitably high value if the offset is zero. This is a byte rather than a bit quantity. */ @@ -147,6 +183,8 @@ struct data_reference #define DR_INIT(DR) (DR)->innermost.init #define DR_STEP(DR) (DR)->innermost.step #define DR_PTR_INFO(DR) (DR)->alias.ptr_info +#define DR_BASE_ALIGNMENT(DR) (DR)->innermost.base_alignment +#define DR_BASE_MISALIGNMENT(DR) (DR)->innermost.base_misalignment #define DR_OFFSET_ALIGNMENT(DR) (DR)->innermost.offset_alignment #define DR_STEP_ALIGNMENT(DR) (DR)->innermost.step_alignment #define DR_INNERMOST(DR) (DR)->innermost |