1 | //===---------------- ARMTargetParserCommon ---------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // Code that is common to ARMTargetParser and AArch64TargetParser. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_TARGETPARSER_ARMTARGETPARSERCOMMON_H |
14 | #define LLVM_TARGETPARSER_ARMTARGETPARSERCOMMON_H |
15 | |
16 | #include "llvm/ADT/StringRef.h" |
17 | #include "llvm/Support/Compiler.h" |
18 | |
19 | namespace llvm { |
20 | namespace ARM { |
21 | |
22 | enum class ISAKind { INVALID = 0, ARM, THUMB, AARCH64 }; |
23 | |
24 | enum class EndianKind { INVALID = 0, LITTLE, BIG }; |
25 | |
26 | /// Converts e.g. "armv8" -> "armv8-a" |
27 | LLVM_ABI StringRef getArchSynonym(StringRef Arch); |
28 | |
29 | /// MArch is expected to be of the form (arm|thumb)?(eb)?(v.+)?(eb)?, but |
30 | /// (iwmmxt|xscale)(eb)? is also permitted. If the former, return |
31 | /// "v.+", if the latter, return unmodified string, minus 'eb'. |
32 | /// If invalid, return empty string. |
33 | LLVM_ABI StringRef getCanonicalArchName(StringRef Arch); |
34 | |
35 | // ARM, Thumb, AArch64 |
36 | LLVM_ABI ISAKind parseArchISA(StringRef Arch); |
37 | |
38 | // Little/Big endian |
39 | LLVM_ABI EndianKind parseArchEndian(StringRef Arch); |
40 | |
41 | struct ParsedBranchProtection { |
42 | StringRef Scope; |
43 | StringRef Key; |
44 | bool BranchTargetEnforcement; |
45 | bool BranchProtectionPAuthLR; |
46 | bool GuardedControlStack; |
47 | }; |
48 | |
49 | LLVM_ABI bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, |
50 | StringRef &Err, bool EnablePAuthLR = false); |
51 | |
52 | } // namespace ARM |
53 | } // namespace llvm |
54 | #endif |
55 | |