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 18 namespace llvm { 19 namespace ARM { 20 21 enum class ISAKind { INVALID = 0, ARM, THUMB, AARCH64 }; 22 23 enum class EndianKind { INVALID = 0, LITTLE, BIG }; 24 25 /// Converts e.g. "armv8" -> "armv8-a" 26 StringRef getArchSynonym(StringRef Arch); 27 28 /// MArch is expected to be of the form (arm|thumb)?(eb)?(v.+)?(eb)?, but 29 /// (iwmmxt|xscale)(eb)? is also permitted. If the former, return 30 /// "v.+", if the latter, return unmodified string, minus 'eb'. 31 /// If invalid, return empty string. 32 StringRef getCanonicalArchName(StringRef Arch); 33 34 // ARM, Thumb, AArch64 35 ISAKind parseArchISA(StringRef Arch); 36 37 // Little/Big endian 38 EndianKind parseArchEndian(StringRef Arch); 39 40 struct ParsedBranchProtection { 41 StringRef Scope; 42 StringRef Key; 43 bool BranchTargetEnforcement; 44 bool BranchProtectionPAuthLR; 45 }; 46 47 bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, 48 StringRef &Err); 49 50 } // namespace ARM 51 } // namespace llvm 52 #endif 53