|
9 | 9 | #include "AArch64.h" |
10 | 10 | #include "AArch64RegisterInfo.h" |
11 | 11 |
|
12 | | -#ifdef __linux__ |
13 | | -#include <linux/prctl.h> // For PR_PAC_* constants |
14 | | -#include <sys/prctl.h> |
15 | | -#endif |
16 | | - |
17 | 12 | #define GET_AVAILABLE_OPCODE_CHECKER |
18 | 13 | #include "AArch64GenInstrInfo.inc" |
19 | 14 |
|
20 | 15 | namespace llvm { |
21 | 16 | namespace exegesis { |
22 | 17 |
|
23 | | -bool isPointerAuth(unsigned Opcode) { |
24 | | - switch (Opcode) { |
25 | | - default: |
26 | | - return false; |
27 | | - |
28 | | - // FIXME: Pointer Authentication instructions. |
29 | | - // We would like to measure these instructions, but they can behave |
30 | | - // differently on different platforms, and maybe the snippets need to look |
31 | | - // different for these instructions, |
32 | | - // Platform-specific handling: On Linux, we disable authentication, may |
33 | | - // interfere with measurements. On non-Linux platforms, disable opcodes for |
34 | | - // now. |
35 | | - case AArch64::AUTDA: |
36 | | - case AArch64::AUTDB: |
37 | | - case AArch64::AUTDZA: |
38 | | - case AArch64::AUTDZB: |
39 | | - case AArch64::AUTIA: |
40 | | - case AArch64::AUTIA1716: |
41 | | - case AArch64::AUTIASP: |
42 | | - case AArch64::AUTIAZ: |
43 | | - case AArch64::AUTIB: |
44 | | - case AArch64::AUTIB1716: |
45 | | - case AArch64::AUTIBSP: |
46 | | - case AArch64::AUTIBZ: |
47 | | - case AArch64::AUTIZA: |
48 | | - case AArch64::AUTIZB: |
49 | | - return true; |
50 | | - } |
51 | | -} |
52 | | - |
53 | | -bool isLoadTagMultiple(unsigned Opcode) { |
54 | | - switch (Opcode) { |
55 | | - default: |
56 | | - return false; |
57 | | - |
58 | | - // Load tag multiple instruction |
59 | | - case AArch64::LDGM: |
60 | | - return true; |
61 | | - } |
62 | | -} |
63 | | - |
64 | 18 | static unsigned getLoadImmediateOpcode(unsigned RegBitWidth) { |
65 | 19 | switch (RegBitWidth) { |
66 | 20 | case 32: |
@@ -180,35 +134,6 @@ class ExegesisAArch64Target : public ExegesisTarget { |
180 | 134 | // Function return is a pseudo-instruction that needs to be expanded |
181 | 135 | PM.add(createAArch64ExpandPseudoPass()); |
182 | 136 | } |
183 | | - |
184 | | - const char *getIgnoredOpcodeReasonOrNull(const LLVMState &State, |
185 | | - unsigned Opcode) const override { |
186 | | - if (const char *Reason = |
187 | | - ExegesisTarget::getIgnoredOpcodeReasonOrNull(State, Opcode)) |
188 | | - return Reason; |
189 | | - |
190 | | - if (isPointerAuth(Opcode)) { |
191 | | -#ifdef __linux__ |
192 | | - // Disable all PAC keys. Note that while we expect the measurements to |
193 | | - // be the same with PAC keys disabled, they could potentially be lower |
194 | | - // since authentication checks are bypassed. |
195 | | - if (prctl(PR_PAC_SET_ENABLED_KEYS, |
196 | | - PR_PAC_APIAKEY | PR_PAC_APIBKEY | PR_PAC_APDAKEY | |
197 | | - PR_PAC_APDBKEY, // all keys |
198 | | - 0, // disable all |
199 | | - 0, 0) < 0) { |
200 | | - return "Failed to disable PAC keys"; |
201 | | - } |
202 | | -#else |
203 | | - return "Unsupported opcode: isPointerAuth"; |
204 | | -#endif |
205 | | - } |
206 | | - |
207 | | - if (isLoadTagMultiple(Opcode)) |
208 | | - return "Unsupported opcode: load tag multiple"; |
209 | | - |
210 | | - return nullptr; |
211 | | - } |
212 | 137 | }; |
213 | 138 |
|
214 | 139 | } // namespace |
|
0 commit comments