]> git.ipfire.org Git - thirdparty/gcc.git/commit
Add TARGET_LOWER_LOCAL_DECL_ALIGNMENT [PR95237]
authorSunil K Pandey <skpgkp2@gmail.com>
Sat, 18 Jul 2020 02:42:09 +0000 (19:42 -0700)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 16:18:52 +0000 (13:18 -0300)
commit73aadacc05b65504c0cb16212b8e176147e1e8d8
treeae8c6a744e7e9c480fb87bd2d4c366170931ffe5
parenteec3e491b17843581edaa69f15e1f4888484637d
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.
16 files changed:
gcc/c/c-decl.c
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/cp/decl.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/target.def
gcc/testsuite/c-c++-common/pr95237-1.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-4.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-5.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-6.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-7.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-8.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/pr95237-9.c [new file with mode: 0644]