diff options
author | Sunil K Pandey <skpgkp2@gmail.com> | 2020-07-17 19:42:09 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-07-21 16:25:43 -0700 |
commit | 0a9d711df36b42b6494b73a90c7ebf050e904493 (patch) | |
tree | e6b4dc17bd474f0c42f2d8b9d85a8f6dbdb00dce /gcc/doc | |
parent | 699f9c0cc1bcc8acfd78c02315c963bf790c874d (diff) | |
download | gcc-0a9d711df36b42b6494b73a90c7ebf050e904493.zip gcc-0a9d711df36b42b6494b73a90c7ebf050e904493.tar.gz gcc-0a9d711df36b42b6494b73a90c7ebf050e904493.tar.bz2 |
Add TARGET_LOWER_LOCAL_DECL_ALIGNMENT [PR95237]
Default for this hook is NOP. For x86, in 32 bit mode, this hook
sets alignment of long long on stack to 32 bits if preferred stack
boundary is 32 bits.
- This patch prevents lowering of alignment from following macros.
LOCAL_ALIGNMENT
STACK_SLOT_ALIGNMENT
LOCAL_DECL_ALIGNMENT
- This patch fixes
gcc.target/i386/pr69454-2.c
gcc.target/i386/stackalign/longlong-1.c
- Regression test on x86-64, no new fail introduced.
Tested on x86-64.
gcc/c/ChangeLog:
PR target/95237
* c-decl.c (finish_decl): Call target hook
lower_local_decl_alignment to lower local decl alignment.
gcc/ChangeLog:
PR target/95237
* config/i386/i386-protos.h (ix86_local_alignment): Add
another function parameter may_lower alignment. Default is
false.
* config/i386/i386.c (ix86_lower_local_decl_alignment): New
function.
(ix86_local_alignment): Amend ix86_local_alignment to accept
another parameter may_lower. If may_lower is true, new align
may be lower than incoming alignment. If may_lower is false,
new align will be greater or equal to incoming alignment.
(TARGET_LOWER_LOCAL_DECL_ALIGNMENT): Define.
* doc/tm.texi: Regenerate.
* doc/tm.texi.in (TARGET_LOWER_LOCAL_DECL_ALIGNMENT): New
hook.
* target.def (lower_local_decl_alignment): New hook.
gcc/cp/ChangeLog:
PR target/95237
* decl.c (cp_finish_decl): Call target hook
lower_local_decl_alignment to lower local decl alignment.
gcc/testsuite/ChangeLog:
PR target/95237
* c-c++-common/pr95237-1.c: New test.
* c-c++-common/pr95237-2.c: New test.
* c-c++-common/pr95237-3.c: New test.
* c-c++-common/pr95237-4.c: New test.
* c-c++-common/pr95237-5.c: New test.
* c-c++-common/pr95237-6.c: New test.
* c-c++-common/pr95237-7.c: New test.
* c-c++-common/pr95237-8.c: New test.
* c-c++-common/pr95237-9.c: New test.
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/tm.texi | 5 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 41b9e10..4371876 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1086,6 +1086,11 @@ On 32-bit ELF the largest supported section alignment in bits is @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts. @end defmac +@deftypefn {Target Hook} void TARGET_LOWER_LOCAL_DECL_ALIGNMENT (tree @var{decl}) +Define this hook to lower alignment of local, parm or result +decl @samp{(@var{decl})}. +@end deftypefn + @deftypefn {Target Hook} HOST_WIDE_INT TARGET_STATIC_RTX_ALIGNMENT (machine_mode @var{mode}) This hook returns the preferred alignment in bits for a statically-allocated rtx, such as a constant pool entry. @var{mode} diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 3be984b..d76c85d 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -1036,6 +1036,8 @@ On 32-bit ELF the largest supported section alignment in bits is @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts. @end defmac +@hook TARGET_LOWER_LOCAL_DECL_ALIGNMENT + @hook TARGET_STATIC_RTX_ALIGNMENT @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align}) |