This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][AArch64] Define MALLOC_ABI_ALIGNMENT
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Wed, 1 Nov 2017 17:40:38 +0000
- Subject: Re: [PATCH][AArch64] Define MALLOC_ABI_ALIGNMENT
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=pass (sender IP is 217.140.96.140) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=none (message not signed) header.d=none;gcc.gnu.org; dmarc=bestguesspass action=none header.from=arm.com;
- Nodisclaimer: True
- References: <DB6PR0801MB2053457858AEF015746EC80B835E0@DB6PR0801MB2053.eurprd08.prod.outlook.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Tue, Oct 31, 2017 at 05:07:54PM +0000, Wilco Dijkstra wrote:
> The AArch64 backend currently doesn't set MALLOC_ABI_ALIGNMENT, so
> add this to enable alignment optimizations on malloc pointers.
>
> OK for commit?
As far as I understand it, because we have 128-bit types, a malloc of
anything greater than 16 bytes would require 16-byte alignment. So, assuming
this macro isn't required to desribe possibly unaligned smaller allocations
(for example 1 byte allocations), this is OK.
Reviewed-By: James Greenhalgh <james.greenhalgh@arm.com>
Thanks,
James
>
> 2017-10-31 Wilco Dijkstra <wdijkstr@arm.com>
>
> * config/aarch64/aarch64.h (MALLOC_ABI_ALIGNMENT): New define.
> --
> diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
> index 8e7093f0476fa7fed3ba6d6cb008743106d1ff58..159dde7c7134d4d0e5378951d1d8a1d6dab48ba2 100644
> --- a/gcc/config/aarch64/aarch64.h
> +++ b/gcc/config/aarch64/aarch64.h
> @@ -111,6 +111,9 @@
>
> #define STRUCTURE_SIZE_BOUNDARY 8
>
> +/* Heap alignment. */
> +#define MALLOC_ABI_ALIGNMENT BIGGEST_ALIGNMENT
> +
> /* Defined by the ABI */
> #define WCHAR_TYPE "unsigned int"
> #define WCHAR_TYPE_SIZE 32