Skip to content

Commit 7b837d8

Browse files
committed
ARM64: initial backend import
This adds a second implementation of the AArch64 architecture to LLVM, accessible in parallel via the "arm64" triple. The plan over the coming weeks & months is to merge the two into a single backend, during which time thorough code review should naturally occur. Everything will be easier with the target in-tree though, hence this commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205090 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 69bd957 commit 7b837d8

File tree

394 files changed

+105888
-32
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

394 files changed

+105888
-32
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name
128128

129129
set(LLVM_ALL_TARGETS
130130
AArch64
131+
ARM64
131132
ARM
132133
CppBackend
133134
Hexagon
@@ -143,7 +144,7 @@ set(LLVM_ALL_TARGETS
143144
)
144145

145146
# List of targets with JIT support:
146-
set(LLVM_TARGETS_WITH_JIT X86 PowerPC AArch64 ARM Mips SystemZ)
147+
set(LLVM_TARGETS_WITH_JIT X86 PowerPC AArch64 ARM64 ARM Mips SystemZ)
147148

148149
set(LLVM_TARGETS_TO_BUILD "all"
149150
CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")

autoconf/configure.ac

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
419419
amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;;
420420
sparc*-*) llvm_cv_target_arch="Sparc" ;;
421421
powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
422+
arm64*-*) llvm_cv_target_arch="ARM64" ;;
422423
arm*-*) llvm_cv_target_arch="ARM" ;;
423424
aarch64*-*) llvm_cv_target_arch="AArch64" ;;
424425
mips-* | mips64-*) llvm_cv_target_arch="Mips" ;;
@@ -454,6 +455,7 @@ case $host in
454455
amd64-* | x86_64-*) host_arch="x86_64" ;;
455456
sparc*-*) host_arch="Sparc" ;;
456457
powerpc*-*) host_arch="PowerPC" ;;
458+
arm64*-*) host_arch="ARM64" ;;
457459
arm*-*) host_arch="ARM" ;;
458460
aarch64*-*) host_arch="AArch64" ;;
459461
mips-* | mips64-*) host_arch="Mips" ;;
@@ -795,7 +797,7 @@ else
795797
esac
796798
fi
797799

798-
TARGETS_WITH_JIT="AArch64 ARM Mips PowerPC SystemZ X86"
800+
TARGETS_WITH_JIT="AArch64 ARM ARM64 Mips PowerPC SystemZ X86"
799801
AC_SUBST(TARGETS_WITH_JIT,$TARGETS_WITH_JIT)
800802

801803
dnl Allow enablement of building and installing docs
@@ -948,14 +950,14 @@ if test "$llvm_cv_enable_crash_overrides" = "yes" ; then
948950
fi
949951

950952
dnl List all possible targets
951-
ALL_TARGETS="X86 Sparc PowerPC AArch64 ARM Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600"
953+
ALL_TARGETS="X86 Sparc PowerPC AArch64 ARM ARM64 Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600"
952954
AC_SUBST(ALL_TARGETS,$ALL_TARGETS)
953955

954956
dnl Allow specific targets to be specified for building (or not)
955957
TARGETS_TO_BUILD=""
956958
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
957959
[Build specific host targets: all or target1,target2,... Valid targets are:
958-
host, x86, x86_64, sparc, powerpc, arm, aarch64, mips, hexagon,
960+
host, x86, x86_64, sparc, powerpc, arm64, arm, aarch64, mips, hexagon,
959961
xcore, msp430, nvptx, systemz, r600, and cpp (default=all)]),,
960962
enableval=all)
961963
if test "$enableval" = host-only ; then
@@ -970,6 +972,7 @@ case "$enableval" in
970972
sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
971973
powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
972974
aarch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;;
975+
arm64) TARGETS_TO_BUILD="ARM64 $TARGETS_TO_BUILD" ;;
973976
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
974977
mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
975978
mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;

cmake/config-ix.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ elseif (LLVM_NATIVE_ARCH MATCHES "powerpc")
366366
set(LLVM_NATIVE_ARCH PowerPC)
367367
elseif (LLVM_NATIVE_ARCH MATCHES "aarch64")
368368
set(LLVM_NATIVE_ARCH AArch64)
369+
elseif (LLVM_NATIVE_ARCH MATCHES "arm64")
370+
set(LLVM_NATIVE_ARCH ARM64)
369371
elseif (LLVM_NATIVE_ARCH MATCHES "arm")
370372
set(LLVM_NATIVE_ARCH ARM)
371373
elseif (LLVM_NATIVE_ARCH MATCHES "mips")

configure

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,9 +1447,9 @@ Optional Features:
14471447
Enable crash handling overrides (default is YES)
14481448
--enable-targets Build specific host targets: all or
14491449
target1,target2,... Valid targets are: host, x86,
1450-
x86_64, sparc, powerpc, arm, aarch64, mips, hexagon,
1451-
xcore, msp430, nvptx, systemz, r600, and cpp
1452-
(default=all)
1450+
x86_64, sparc, powerpc, arm64, arm, aarch64, mips,
1451+
hexagon, xcore, msp430, nvptx, systemz, r600, and
1452+
cpp (default=all)
14531453
--enable-experimental-targets
14541454
Build experimental host targets: disable or
14551455
target1,target2,... (default=disable)
@@ -4151,6 +4151,7 @@ else
41514151
amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;;
41524152
sparc*-*) llvm_cv_target_arch="Sparc" ;;
41534153
powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
4154+
arm64*-*) llvm_cv_target_arch="ARM64" ;;
41544155
arm*-*) llvm_cv_target_arch="ARM" ;;
41554156
aarch64*-*) llvm_cv_target_arch="AArch64" ;;
41564157
mips-* | mips64-*) llvm_cv_target_arch="Mips" ;;
@@ -4187,6 +4188,7 @@ case $host in
41874188
amd64-* | x86_64-*) host_arch="x86_64" ;;
41884189
sparc*-*) host_arch="Sparc" ;;
41894190
powerpc*-*) host_arch="PowerPC" ;;
4191+
arm64*-*) host_arch="ARM64" ;;
41904192
arm*-*) host_arch="ARM" ;;
41914193
aarch64*-*) host_arch="AArch64" ;;
41924194
mips-* | mips64-*) host_arch="Mips" ;;
@@ -5120,7 +5122,7 @@ else
51205122
esac
51215123
fi
51225124

5123-
TARGETS_WITH_JIT="AArch64 ARM Mips PowerPC SystemZ X86"
5125+
TARGETS_WITH_JIT="AArch64 ARM ARM64 Mips PowerPC SystemZ X86"
51245126
TARGETS_WITH_JIT=$TARGETS_WITH_JIT
51255127

51265128

@@ -5357,7 +5359,7 @@ _ACEOF
53575359

53585360
fi
53595361

5360-
ALL_TARGETS="X86 Sparc PowerPC AArch64 ARM Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600"
5362+
ALL_TARGETS="X86 Sparc PowerPC AArch64 ARM ARM64 Mips XCore MSP430 CppBackend NVPTX Hexagon SystemZ R600"
53615363
ALL_TARGETS=$ALL_TARGETS
53625364

53635365

@@ -5381,6 +5383,7 @@ case "$enableval" in
53815383
sparc) TARGETS_TO_BUILD="Sparc $TARGETS_TO_BUILD" ;;
53825384
powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
53835385
aarch64) TARGETS_TO_BUILD="AArch64 $TARGETS_TO_BUILD" ;;
5386+
arm64) TARGETS_TO_BUILD="ARM64 $TARGETS_TO_BUILD" ;;
53845387
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
53855388
mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
53865389
mipsel) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;

include/llvm-c/Disassembler.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ struct LLVMOpInfo1 {
9595
#define LLVMDisassembler_VariantKind_ARM_HI16 1 /* :upper16: */
9696
#define LLVMDisassembler_VariantKind_ARM_LO16 2 /* :lower16: */
9797

98+
/**
99+
* The ARM64 target VariantKinds.
100+
*/
101+
#define LLVMDisassembler_VariantKind_ARM64_PAGE 1 /* @page */
102+
#define LLVMDisassembler_VariantKind_ARM64_PAGEOFF 2 /* @pageoff */
103+
#define LLVMDisassembler_VariantKind_ARM64_GOTPAGE 3 /* @gotpage */
104+
#define LLVMDisassembler_VariantKind_ARM64_GOTPAGEOFF 4 /* @gotpageoff */
105+
#define LLVMDisassembler_VariantKind_ARM64_TLVP 5 /* @tvlppage */
106+
#define LLVMDisassembler_VariantKind_ARM64_TLVOFF 6 /* @tvlppageoff */
107+
98108
/**
99109
* The type for the symbol lookup function. This may be called by the
100110
* disassembler for things like adding a comment for a PC plus a constant
@@ -123,6 +133,17 @@ typedef const char *(*LLVMSymbolLookupCallback)(void *DisInfo,
123133
/* The input reference is from a PC relative load instruction. */
124134
#define LLVMDisassembler_ReferenceType_In_PCrel_Load 2
125135

136+
/* The input reference is from an ARM64::ADRP instruction. */
137+
#define LLVMDisassembler_ReferenceType_In_ARM64_ADRP 0x100000001
138+
/* The input reference is from an ARM64::ADDXri instruction. */
139+
#define LLVMDisassembler_ReferenceType_In_ARM64_ADDXri 0x100000002
140+
/* The input reference is from an ARM64::LDRXui instruction. */
141+
#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXui 0x100000003
142+
/* The input reference is from an ARM64::LDRXl instruction. */
143+
#define LLVMDisassembler_ReferenceType_In_ARM64_LDRXl 0x100000004
144+
/* The input reference is from an ARM64::ADR instruction. */
145+
#define LLVMDisassembler_ReferenceType_In_ARM64_ADR 0x100000005
146+
126147
/* The output reference is to as symbol stub. */
127148
#define LLVMDisassembler_ReferenceType_Out_SymbolStub 1
128149
/* The output reference is to a symbol address in a literal pool. */

include/llvm/ADT/Triple.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Triple {
4848

4949
arm, // ARM (little endian): arm, armv.*, xscale
5050
armeb, // ARM (big endian): armeb
51+
arm64, // ARM: arm64
5152
aarch64, // AArch64 (little endian): aarch64
5253
aarch64_be, // AArch64 (big endian): aarch64_be
5354
hexagon, // Hexagon: hexagon

include/llvm/IR/Intrinsics.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ def int_clear_cache : Intrinsic<[], [llvm_ptr_ty, llvm_ptr_ty],
529529
include "llvm/IR/IntrinsicsPowerPC.td"
530530
include "llvm/IR/IntrinsicsX86.td"
531531
include "llvm/IR/IntrinsicsARM.td"
532+
include "llvm/IR/IntrinsicsARM64.td"
532533
include "llvm/IR/IntrinsicsAArch64.td"
533534
include "llvm/IR/IntrinsicsXCore.td"
534535
include "llvm/IR/IntrinsicsHexagon.td"

0 commit comments

Comments
 (0)