diff options
author | Zac Walker <zacwalker@microsoft.com> | 2024-04-11 13:30:27 +0200 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2024-05-07 16:02:33 +0000 |
commit | b9415046fa27d6b3faea89871dbb84b673afadaf (patch) | |
tree | 27c62f1044f393d59eac0ef4996083046cddf2f0 /gcc | |
parent | 13bad1ac7a6ea4dbbde67c69d31c218a2f2d7a5d (diff) | |
download | gcc-b9415046fa27d6b3faea89871dbb84b673afadaf.zip gcc-b9415046fa27d6b3faea89871dbb84b673afadaf.tar.gz gcc-b9415046fa27d6b3faea89871dbb84b673afadaf.tar.bz2 |
aarch64: Mark x18 register as a fixed register for MS ABI
Define the MS ABI for aarch64-w64-mingw32.
Adjust FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and
STATIC_CHAIN_REGNUM for AArch64 MS ABI.
The X18 register is reserved on Windows for the TEB.
gcc/ChangeLog:
* config.gcc: Define TARGET_AARCH64_MS_ABI when
AArch64 MS ABI is used.
* config/aarch64/aarch64.h (FIXED_X18): Adjust
FIXED_REGISTERS, CALL_REALLY_USED_REGISTERS and
STATIC_CHAIN_REGNUM for AArch64 MS ABI.
(CALL_USED_X18): Likewise.
(FIXED_REGISTERS): Likewise.
* config/aarch64/aarch64-abi-ms.h: New file.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config.gcc | 1 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64-abi-ms.h | 34 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.h | 7 |
3 files changed, 40 insertions, 2 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc index 0a737bf3..007a64d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1271,6 +1271,7 @@ aarch64*-*-gnu*) tm_defines="${tm_defines} TARGET_DEFAULT_ASYNC_UNWIND_TABLES=1" ;; aarch64-*-mingw*) + tm_file="${tm_file} aarch64/aarch64-abi-ms.h" tmake_file="${tmake_file} aarch64/t-aarch64" case ${enable_threads} in "" | yes | win32) diff --git a/gcc/config/aarch64/aarch64-abi-ms.h b/gcc/config/aarch64/aarch64-abi-ms.h new file mode 100644 index 0000000..15dc33d --- /dev/null +++ b/gcc/config/aarch64/aarch64-abi-ms.h @@ -0,0 +1,34 @@ +/* Machine description for AArch64 MS ABI. + Copyright (C) 2024 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#ifndef GCC_AARCH64_ABI_MS_H +#define GCC_AARCH64_ABI_MS_H + +/* X18 reserved for the TEB on Windows. */ + +#undef FIXED_X18 +#define FIXED_X18 1 + +#undef CALL_USED_X18 +#define CALL_USED_X18 0 + +#undef STATIC_CHAIN_REGNUM +#define STATIC_CHAIN_REGNUM R17_REGNUM + +#endif /* GCC_AARCH64_ABI_MS_H. */ diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 4fa1dfc..319fe03 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -537,11 +537,14 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF; register. GCC internally uses the poly_int variable aarch64_sve_vg instead. */ +#define FIXED_X18 0 +#define CALL_USED_X18 1 + #define FIXED_REGISTERS \ { \ 0, 0, 0, 0, 0, 0, 0, 0, /* R0 - R7 */ \ 0, 0, 0, 0, 0, 0, 0, 0, /* R8 - R15 */ \ - 0, 0, 0, 0, 0, 0, 0, 0, /* R16 - R23 */ \ + 0, 0, FIXED_X18, 0, 0, 0, 0, 0, /* R16 - R23. */ \ 0, 0, 0, 0, 0, 1, 0, 1, /* R24 - R30, SP */ \ 0, 0, 0, 0, 0, 0, 0, 0, /* V0 - V7 */ \ 0, 0, 0, 0, 0, 0, 0, 0, /* V8 - V15 */ \ @@ -565,7 +568,7 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF; { \ 1, 1, 1, 1, 1, 1, 1, 1, /* R0 - R7 */ \ 1, 1, 1, 1, 1, 1, 1, 1, /* R8 - R15 */ \ - 1, 1, 1, 0, 0, 0, 0, 0, /* R16 - R23 */ \ + 1, 1, CALL_USED_X18, 0, 0, 0, 0, 0, /* R16 - R23. */ \ 0, 0, 0, 0, 0, 1, 1, 1, /* R24 - R30, SP */ \ 1, 1, 1, 1, 1, 1, 1, 1, /* V0 - V7 */ \ 0, 0, 0, 0, 0, 0, 0, 0, /* V8 - V15 */ \ |