Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 1 | //===--- AArch64.h - Declare AArch64 target feature support -----*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file declares AArch64 TargetInfo objects. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H |
| 14 | #define LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H |
| 15 | |
| 16 | #include "OSTargets.h" |
| 17 | #include "clang/Basic/TargetBuiltins.h" |
| 18 | #include "llvm/Support/TargetParser.h" |
| 19 | |
| 20 | namespace clang { |
| 21 | namespace targets { |
| 22 | |
| 23 | class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo { |
| 24 | virtual void setDataLayout() = 0; |
| 25 | static const TargetInfo::GCCRegAlias GCCRegAliases[]; |
| 26 | static const char *const GCCRegNames[]; |
| 27 | |
| 28 | enum FPUModeEnum { FPUMode, NeonMode = (1 << 0), SveMode = (1 << 1) }; |
| 29 | |
| 30 | unsigned FPU; |
| 31 | unsigned CRC; |
| 32 | unsigned Crypto; |
| 33 | unsigned Unaligned; |
| 34 | unsigned HasFullFP16; |
Junmo Park | 4b9b9fb | 2018-04-17 22:38:40 +0000 | [diff] [blame] | 35 | unsigned HasDotProd; |
Bryan Chan | 223307b | 2018-10-25 23:47:00 +0000 | [diff] [blame] | 36 | unsigned HasFP16FML; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 37 | llvm::AArch64::ArchKind ArchKind; |
| 38 | |
| 39 | static const Builtin::Info BuiltinInfo[]; |
| 40 | |
| 41 | std::string ABI; |
| 42 | |
| 43 | public: |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 44 | AArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts); |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 45 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 46 | StringRef getABI() const override; |
| 47 | bool setABI(const std::string &Name) override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 48 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 49 | bool isValidCPUName(StringRef Name) const override; |
Erich Keane | 3ec1743 | 2018-02-08 23:14:15 +0000 | [diff] [blame] | 50 | void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override; |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 51 | bool setCPU(const std::string &Name) override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 52 | |
Akira Hatanaka | 502775a | 2017-12-09 00:02:37 +0000 | [diff] [blame] | 53 | bool useFP16ConversionIntrinsics() const override { |
| 54 | return false; |
| 55 | } |
| 56 | |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 57 | void getTargetDefinesARMV81A(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 58 | MacroBuilder &Builder) const; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 59 | void getTargetDefinesARMV82A(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 60 | MacroBuilder &Builder) const; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 61 | void getTargetDefines(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 62 | MacroBuilder &Builder) const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 63 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 64 | ArrayRef<Builtin::Info> getTargetBuiltins() const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 65 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 66 | bool hasFeature(StringRef Feature) const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 67 | bool handleTargetFeatures(std::vector<std::string> &Features, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 68 | DiagnosticsEngine &Diags) override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 69 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 70 | CallingConvCheckResult checkCallingConvention(CallingConv CC) const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 71 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 72 | bool isCLZForZeroUndef() const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 73 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 74 | BuiltinVaListKind getBuiltinVaListKind() const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 75 | |
| 76 | ArrayRef<const char *> getGCCRegNames() const override; |
| 77 | ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 78 | bool validateAsmConstraint(const char *&Name, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 79 | TargetInfo::ConstraintInfo &Info) const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 80 | bool |
| 81 | validateConstraintModifier(StringRef Constraint, char Modifier, unsigned Size, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 82 | std::string &SuggestedModifier) const override; |
| 83 | const char *getClobbers() const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 84 | |
Mikhail Maltsev | 89f7b46 | 2018-04-30 09:11:08 +0000 | [diff] [blame] | 85 | StringRef getConstraintRegister(StringRef Constraint, |
| 86 | StringRef Expression) const override { |
| 87 | return Expression; |
| 88 | } |
| 89 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 90 | int getEHDataRegisterNumber(unsigned RegNo) const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | class LLVM_LIBRARY_VISIBILITY AArch64leTargetInfo : public AArch64TargetInfo { |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 94 | public: |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 95 | AArch64leTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts); |
| 96 | |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 97 | void getTargetDefines(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 98 | MacroBuilder &Builder) const override; |
| 99 | private: |
| 100 | void setDataLayout() override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 101 | }; |
| 102 | |
Martin Storsjo | 31cac7a | 2017-08-13 19:42:17 +0000 | [diff] [blame] | 103 | class LLVM_LIBRARY_VISIBILITY WindowsARM64TargetInfo |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 104 | : public WindowsTargetInfo<AArch64leTargetInfo> { |
| 105 | const llvm::Triple Triple; |
| 106 | |
| 107 | public: |
Martin Storsjo | 31cac7a | 2017-08-13 19:42:17 +0000 | [diff] [blame] | 108 | WindowsARM64TargetInfo(const llvm::Triple &Triple, |
| 109 | const TargetOptions &Opts); |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 110 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 111 | void setDataLayout() override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 112 | |
Martin Storsjo | 31cac7a | 2017-08-13 19:42:17 +0000 | [diff] [blame] | 113 | BuiltinVaListKind getBuiltinVaListKind() const override; |
| 114 | |
| 115 | CallingConvCheckResult checkCallingConvention(CallingConv CC) const override; |
| 116 | }; |
| 117 | |
| 118 | // Windows ARM, MS (C++) ABI |
| 119 | class LLVM_LIBRARY_VISIBILITY MicrosoftARM64TargetInfo |
| 120 | : public WindowsARM64TargetInfo { |
| 121 | public: |
| 122 | MicrosoftARM64TargetInfo(const llvm::Triple &Triple, |
| 123 | const TargetOptions &Opts); |
| 124 | |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 125 | void getVisualStudioDefines(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 126 | MacroBuilder &Builder) const; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 127 | void getTargetDefines(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 128 | MacroBuilder &Builder) const override; |
Sanjin Sijaric | 56391d6 | 2018-07-26 22:18:28 +0000 | [diff] [blame] | 129 | TargetInfo::CallingConvKind |
| 130 | getCallingConvKind(bool ClangABICompat4) const override; |
Martin Storsjo | 31cac7a | 2017-08-13 19:42:17 +0000 | [diff] [blame] | 131 | }; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 132 | |
Martin Storsjo | 31cac7a | 2017-08-13 19:42:17 +0000 | [diff] [blame] | 133 | // ARM64 MinGW target |
| 134 | class LLVM_LIBRARY_VISIBILITY MinGWARM64TargetInfo |
| 135 | : public WindowsARM64TargetInfo { |
| 136 | public: |
| 137 | MinGWARM64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts); |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | class LLVM_LIBRARY_VISIBILITY AArch64beTargetInfo : public AArch64TargetInfo { |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 141 | public: |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 142 | AArch64beTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts); |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 143 | void getTargetDefines(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 144 | MacroBuilder &Builder) const override; |
| 145 | |
| 146 | private: |
| 147 | void setDataLayout() override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 148 | }; |
| 149 | |
| 150 | class LLVM_LIBRARY_VISIBILITY DarwinAArch64TargetInfo |
| 151 | : public DarwinTargetInfo<AArch64leTargetInfo> { |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 152 | public: |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 153 | DarwinAArch64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts); |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 154 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 155 | BuiltinVaListKind getBuiltinVaListKind() const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 156 | |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 157 | protected: |
| 158 | void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, |
| 159 | MacroBuilder &Builder) const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 160 | }; |
| 161 | |
| 162 | // 64-bit RenderScript is aarch64 |
| 163 | class LLVM_LIBRARY_VISIBILITY RenderScript64TargetInfo |
| 164 | : public AArch64leTargetInfo { |
| 165 | public: |
| 166 | RenderScript64TargetInfo(const llvm::Triple &Triple, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 167 | const TargetOptions &Opts); |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 168 | |
| 169 | void getTargetDefines(const LangOptions &Opts, |
Tim Northover | ad4c5db | 2017-07-24 17:06:23 +0000 | [diff] [blame] | 170 | MacroBuilder &Builder) const override; |
Erich Keane | ebba592 | 2017-07-21 22:37:03 +0000 | [diff] [blame] | 171 | }; |
| 172 | |
| 173 | } // namespace targets |
| 174 | } // namespace clang |
| 175 | |
| 176 | #endif // LLVM_CLANG_LIB_BASIC_TARGETS_AARCH64_H |