summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPablo Barrio <pablo.barrio@arm.com>2020-01-10 17:51:21 +0000
committerPablo Barrio <pablo.barrio@arm.com>2020-01-13 14:14:48 +0000
commitda33762de8531914d4d0dae16bfce2192f02bc79 (patch)
treefa3f12ab4dffa0ecdb68d2204f26825081e2ed75 /llvm/lib
parent8e8ccf4712cf58562a91c197da3efd4f9963ce0d (diff)
downloadbcm5719-llvm-da33762de8531914d4d0dae16bfce2192f02bc79.tar.gz
bcm5719-llvm-da33762de8531914d4d0dae16bfce2192f02bc79.zip
[AArch64] Emit HINT instead of PAC insns in Armv8.2-A or below
Summary: The Pointer Authentication Extension (PAC) was added in Armv8.3-A. Some instructions are implemented in the HINT space to allow compiling code common to CPUs regardless of whether they feature PAC or not, and still benefit from PAC protection in the PAC-enabled CPUs. The 8.3-specific mnemonics were currently enabled in any architecture, and LLVM was emitting them in assembly files when PAC code generation was enabled. This was ok for compilations where both LLVM codegen and the integrated assembler were used. However, the LLVM codegen was not compatible with other assemblers (e.g. GAS). Given the fact that the approach from these assemblers (i.e. to disallow Armv8.3-A mnemonics if compiling for Armv8.2-A or lower) is entirely reasonable, this patch makes LLVM to emit HINT when building for Armv8.2-A and below, instead of PACIASP, AUTIASP and friends. Then, LLVM assembly should be compatible with other assemblers. Reviewers: samparker, chill, LukeCheeseman Subscribers: kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71658
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.td48
1 files changed, 33 insertions, 15 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index 1fff8d78af0..d590d4d913f 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -815,38 +815,56 @@ let Predicates = [HasComplxNum, HasNEON] in {
// v8.3a Pointer Authentication
// These instructions inhabit part of the hint space and so can be used for
-// armv8 targets
+// armv8 targets. Keeping the old HINT mnemonic when compiling without PA is
+// important for compatibility with other assemblers (e.g. GAS) when building
+// software compatible with both CPUs that do or don't implement PA.
let Uses = [LR], Defs = [LR] in {
- def PACIAZ : SystemNoOperands<0b000, "paciaz">;
- def PACIBZ : SystemNoOperands<0b010, "pacibz">;
+ def PACIAZ : SystemNoOperands<0b000, "hint #24">;
+ def PACIBZ : SystemNoOperands<0b010, "hint #26">;
let isAuthenticated = 1 in {
- def AUTIAZ : SystemNoOperands<0b100, "autiaz">;
- def AUTIBZ : SystemNoOperands<0b110, "autibz">;
+ def AUTIAZ : SystemNoOperands<0b100, "hint #28">;
+ def AUTIBZ : SystemNoOperands<0b110, "hint #30">;
}
}
let Uses = [LR, SP], Defs = [LR] in {
- def PACIASP : SystemNoOperands<0b001, "paciasp">;
- def PACIBSP : SystemNoOperands<0b011, "pacibsp">;
+ def PACIASP : SystemNoOperands<0b001, "hint #25">;
+ def PACIBSP : SystemNoOperands<0b011, "hint #27">;
let isAuthenticated = 1 in {
- def AUTIASP : SystemNoOperands<0b101, "autiasp">;
- def AUTIBSP : SystemNoOperands<0b111, "autibsp">;
+ def AUTIASP : SystemNoOperands<0b101, "hint #29">;
+ def AUTIBSP : SystemNoOperands<0b111, "hint #31">;
}
}
let Uses = [X16, X17], Defs = [X17], CRm = 0b0001 in {
- def PACIA1716 : SystemNoOperands<0b000, "pacia1716">;
- def PACIB1716 : SystemNoOperands<0b010, "pacib1716">;
+ def PACIA1716 : SystemNoOperands<0b000, "hint #8">;
+ def PACIB1716 : SystemNoOperands<0b010, "hint #10">;
let isAuthenticated = 1 in {
- def AUTIA1716 : SystemNoOperands<0b100, "autia1716">;
- def AUTIB1716 : SystemNoOperands<0b110, "autib1716">;
+ def AUTIA1716 : SystemNoOperands<0b100, "hint #12">;
+ def AUTIB1716 : SystemNoOperands<0b110, "hint #14">;
}
}
let Uses = [LR], Defs = [LR], CRm = 0b0000 in {
- def XPACLRI : SystemNoOperands<0b111, "xpaclri">;
+ def XPACLRI : SystemNoOperands<0b111, "hint #7">;
}
-// These pointer authentication isntructions require armv8.3a
+// These pointer authentication instructions require armv8.3a
let Predicates = [HasPA] in {
+
+ // When compiling with PA, there is a better mnemonic for these instructions.
+ def : InstAlias<"paciaz", (PACIAZ), 1>;
+ def : InstAlias<"pacibz", (PACIBZ), 1>;
+ def : InstAlias<"autiaz", (AUTIAZ), 1>;
+ def : InstAlias<"autibz", (AUTIBZ), 1>;
+ def : InstAlias<"paciasp", (PACIASP), 1>;
+ def : InstAlias<"pacibsp", (PACIBSP), 1>;
+ def : InstAlias<"autiasp", (AUTIASP), 1>;
+ def : InstAlias<"autibsp", (AUTIBSP), 1>;
+ def : InstAlias<"pacia1716", (PACIA1716), 1>;
+ def : InstAlias<"pacib1716", (PACIB1716), 1>;
+ def : InstAlias<"autia1716", (AUTIA1716), 1>;
+ def : InstAlias<"autib1716", (AUTIB1716), 1>;
+ def : InstAlias<"xpaclri", (XPACLRI), 1>;
+
multiclass SignAuth<bits<3> prefix, bits<3> prefix_z, string asm> {
def IA : SignAuthOneData<prefix, 0b00, !strconcat(asm, "ia")>;
def IB : SignAuthOneData<prefix, 0b01, !strconcat(asm, "ib")>;
OpenPOWER on IntegriCloud