David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 1 | //===--- AArch64.cpp - AArch64 (not ARM) Helpers for Tools ------*- 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 |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
David L. Jones | f561aba | 2017-03-08 01:02:16 +0000 | [diff] [blame] | 9 | #include "AArch64.h" |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 10 | #include "clang/Driver/Driver.h" |
| 11 | #include "clang/Driver/DriverDiagnostic.h" |
| 12 | #include "clang/Driver/Options.h" |
| 13 | #include "llvm/Option/ArgList.h" |
| 14 | #include "llvm/Support/TargetParser.h" |
Reid Kleckner | 90c64a3 | 2019-10-19 00:48:11 +0000 | [diff] [blame^] | 15 | #include "llvm/Support/Host.h" |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 16 | |
| 17 | using namespace clang::driver; |
| 18 | using namespace clang::driver::tools; |
| 19 | using namespace clang; |
| 20 | using namespace llvm::opt; |
| 21 | |
Alex Lorenz | 9b20a99 | 2018-12-17 19:30:46 +0000 | [diff] [blame] | 22 | /// \returns true if the given triple can determine the default CPU type even |
| 23 | /// if -arch is not specified. |
| 24 | static bool isCPUDeterminedByTriple(const llvm::Triple &Triple) { |
| 25 | return Triple.isOSDarwin(); |
| 26 | } |
| 27 | |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 28 | /// getAArch64TargetCPU - Get the (LLVM) name of the AArch64 cpu we are |
Peter Smith | 820e46f | 2017-10-24 09:51:55 +0000 | [diff] [blame] | 29 | /// targeting. Set \p A to the Arg corresponding to the -mcpu argument if it is |
| 30 | /// provided, or to nullptr otherwise. |
Alex Lorenz | 9b20a99 | 2018-12-17 19:30:46 +0000 | [diff] [blame] | 31 | std::string aarch64::getAArch64TargetCPU(const ArgList &Args, |
| 32 | const llvm::Triple &Triple, Arg *&A) { |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 33 | std::string CPU; |
Peter Smith | 820e46f | 2017-10-24 09:51:55 +0000 | [diff] [blame] | 34 | // If we have -mcpu, use that. |
| 35 | if ((A = Args.getLastArg(options::OPT_mcpu_EQ))) { |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 36 | StringRef Mcpu = A->getValue(); |
| 37 | CPU = Mcpu.split("+").first.lower(); |
| 38 | } |
| 39 | |
| 40 | // Handle CPU name is 'native'. |
| 41 | if (CPU == "native") |
| 42 | return llvm::sys::getHostCPUName(); |
| 43 | else if (CPU.size()) |
| 44 | return CPU; |
| 45 | |
Alex Lorenz | 9b20a99 | 2018-12-17 19:30:46 +0000 | [diff] [blame] | 46 | // Make sure we pick "cyclone" if -arch is used or when targetting a Darwin |
| 47 | // OS. |
| 48 | if (Args.getLastArg(options::OPT_arch) || Triple.isOSDarwin()) |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 49 | return "cyclone"; |
| 50 | |
| 51 | return "generic"; |
| 52 | } |
| 53 | |
| 54 | // Decode AArch64 features from string like +[no]featureA+[no]featureB+... |
| 55 | static bool DecodeAArch64Features(const Driver &D, StringRef text, |
| 56 | std::vector<StringRef> &Features) { |
| 57 | SmallVector<StringRef, 8> Split; |
| 58 | text.split(Split, StringRef("+"), -1, false); |
| 59 | |
| 60 | for (StringRef Feature : Split) { |
| 61 | StringRef FeatureName = llvm::AArch64::getArchExtFeature(Feature); |
| 62 | if (!FeatureName.empty()) |
| 63 | Features.push_back(FeatureName); |
| 64 | else if (Feature == "neon" || Feature == "noneon") |
| 65 | D.Diag(clang::diag::err_drv_no_neon_modifier); |
| 66 | else |
| 67 | return false; |
| 68 | } |
| 69 | return true; |
| 70 | } |
| 71 | |
| 72 | // Check if the CPU name and feature modifiers in -mcpu are legal. If yes, |
| 73 | // decode CPU and feature. |
| 74 | static bool DecodeAArch64Mcpu(const Driver &D, StringRef Mcpu, StringRef &CPU, |
| 75 | std::vector<StringRef> &Features) { |
| 76 | std::pair<StringRef, StringRef> Split = Mcpu.split("+"); |
| 77 | CPU = Split.first; |
| 78 | |
Florian Hahn | 4327b3e | 2018-07-06 10:49:59 +0000 | [diff] [blame] | 79 | if (CPU == "native") |
| 80 | CPU = llvm::sys::getHostCPUName(); |
| 81 | |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 82 | if (CPU == "generic") { |
| 83 | Features.push_back("+neon"); |
| 84 | } else { |
Florian Hahn | ef5bbd6 | 2017-07-27 16:28:39 +0000 | [diff] [blame] | 85 | llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseCPUArch(CPU); |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 86 | if (!llvm::AArch64::getArchFeatures(ArchKind, Features)) |
| 87 | return false; |
| 88 | |
| 89 | unsigned Extension = llvm::AArch64::getDefaultExtensions(CPU, ArchKind); |
| 90 | if (!llvm::AArch64::getExtensionFeatures(Extension, Features)) |
| 91 | return false; |
| 92 | } |
| 93 | |
| 94 | if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features)) |
| 95 | return false; |
| 96 | |
| 97 | return true; |
| 98 | } |
| 99 | |
| 100 | static bool |
| 101 | getAArch64ArchFeaturesFromMarch(const Driver &D, StringRef March, |
| 102 | const ArgList &Args, |
| 103 | std::vector<StringRef> &Features) { |
| 104 | std::string MarchLowerCase = March.lower(); |
| 105 | std::pair<StringRef, StringRef> Split = StringRef(MarchLowerCase).split("+"); |
| 106 | |
Florian Hahn | ef5bbd6 | 2017-07-27 16:28:39 +0000 | [diff] [blame] | 107 | llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first); |
| 108 | if (ArchKind == llvm::AArch64::ArchKind::INVALID || |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 109 | !llvm::AArch64::getArchFeatures(ArchKind, Features) || |
| 110 | (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features))) |
| 111 | return false; |
| 112 | |
| 113 | return true; |
| 114 | } |
| 115 | |
| 116 | static bool |
| 117 | getAArch64ArchFeaturesFromMcpu(const Driver &D, StringRef Mcpu, |
| 118 | const ArgList &Args, |
| 119 | std::vector<StringRef> &Features) { |
| 120 | StringRef CPU; |
| 121 | std::string McpuLowerCase = Mcpu.lower(); |
| 122 | if (!DecodeAArch64Mcpu(D, McpuLowerCase, CPU, Features)) |
| 123 | return false; |
| 124 | |
| 125 | return true; |
| 126 | } |
| 127 | |
| 128 | static bool |
| 129 | getAArch64MicroArchFeaturesFromMtune(const Driver &D, StringRef Mtune, |
| 130 | const ArgList &Args, |
| 131 | std::vector<StringRef> &Features) { |
| 132 | std::string MtuneLowerCase = Mtune.lower(); |
Peter Smith | 820e46f | 2017-10-24 09:51:55 +0000 | [diff] [blame] | 133 | // Check CPU name is valid |
| 134 | std::vector<StringRef> MtuneFeatures; |
| 135 | StringRef Tune; |
| 136 | if (!DecodeAArch64Mcpu(D, MtuneLowerCase, Tune, MtuneFeatures)) |
| 137 | return false; |
| 138 | |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 139 | // Handle CPU name is 'native'. |
| 140 | if (MtuneLowerCase == "native") |
| 141 | MtuneLowerCase = llvm::sys::getHostCPUName(); |
| 142 | if (MtuneLowerCase == "cyclone") { |
| 143 | Features.push_back("+zcm"); |
| 144 | Features.push_back("+zcz"); |
| 145 | } |
| 146 | return true; |
| 147 | } |
| 148 | |
| 149 | static bool |
| 150 | getAArch64MicroArchFeaturesFromMcpu(const Driver &D, StringRef Mcpu, |
| 151 | const ArgList &Args, |
| 152 | std::vector<StringRef> &Features) { |
| 153 | StringRef CPU; |
| 154 | std::vector<StringRef> DecodedFeature; |
| 155 | std::string McpuLowerCase = Mcpu.lower(); |
| 156 | if (!DecodeAArch64Mcpu(D, McpuLowerCase, CPU, DecodedFeature)) |
| 157 | return false; |
| 158 | |
| 159 | return getAArch64MicroArchFeaturesFromMtune(D, CPU, Args, Features); |
| 160 | } |
| 161 | |
Alex Lorenz | 9b20a99 | 2018-12-17 19:30:46 +0000 | [diff] [blame] | 162 | void aarch64::getAArch64TargetFeatures(const Driver &D, |
| 163 | const llvm::Triple &Triple, |
| 164 | const ArgList &Args, |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 165 | std::vector<StringRef> &Features) { |
| 166 | Arg *A; |
| 167 | bool success = true; |
| 168 | // Enable NEON by default. |
| 169 | Features.push_back("+neon"); |
| 170 | if ((A = Args.getLastArg(options::OPT_march_EQ))) |
| 171 | success = getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Features); |
| 172 | else if ((A = Args.getLastArg(options::OPT_mcpu_EQ))) |
| 173 | success = getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Features); |
Alex Lorenz | 9b20a99 | 2018-12-17 19:30:46 +0000 | [diff] [blame] | 174 | else if (Args.hasArg(options::OPT_arch) || isCPUDeterminedByTriple(Triple)) |
| 175 | success = getAArch64ArchFeaturesFromMcpu( |
| 176 | D, getAArch64TargetCPU(Args, Triple, A), Args, Features); |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 177 | |
| 178 | if (success && (A = Args.getLastArg(clang::driver::options::OPT_mtune_EQ))) |
| 179 | success = |
| 180 | getAArch64MicroArchFeaturesFromMtune(D, A->getValue(), Args, Features); |
| 181 | else if (success && (A = Args.getLastArg(options::OPT_mcpu_EQ))) |
| 182 | success = |
| 183 | getAArch64MicroArchFeaturesFromMcpu(D, A->getValue(), Args, Features); |
Alex Lorenz | 9b20a99 | 2018-12-17 19:30:46 +0000 | [diff] [blame] | 184 | else if (success && |
| 185 | (Args.hasArg(options::OPT_arch) || isCPUDeterminedByTriple(Triple))) |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 186 | success = getAArch64MicroArchFeaturesFromMcpu( |
Alex Lorenz | 9b20a99 | 2018-12-17 19:30:46 +0000 | [diff] [blame] | 187 | D, getAArch64TargetCPU(Args, Triple, A), Args, Features); |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 188 | |
| 189 | if (!success) |
| 190 | D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); |
| 191 | |
| 192 | if (Args.getLastArg(options::OPT_mgeneral_regs_only)) { |
| 193 | Features.push_back("-fp-armv8"); |
| 194 | Features.push_back("-crypto"); |
| 195 | Features.push_back("-neon"); |
| 196 | } |
| 197 | |
Oliver Stannard | d83a559 | 2019-03-29 13:32:41 +0000 | [diff] [blame] | 198 | if (Arg *A = Args.getLastArg(options::OPT_mtp_mode_EQ)) { |
| 199 | StringRef Mtp = A->getValue(); |
| 200 | if (Mtp == "el3") |
| 201 | Features.push_back("+tpidr-el3"); |
| 202 | else if (Mtp == "el2") |
| 203 | Features.push_back("+tpidr-el2"); |
| 204 | else if (Mtp == "el1") |
| 205 | Features.push_back("+tpidr-el1"); |
| 206 | else if (Mtp != "el0") |
| 207 | D.Diag(diag::err_drv_invalid_mtp) << A->getAsString(Args); |
| 208 | } |
| 209 | |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 210 | // En/disable crc |
| 211 | if (Arg *A = Args.getLastArg(options::OPT_mcrc, options::OPT_mnocrc)) { |
| 212 | if (A->getOption().matches(options::OPT_mcrc)) |
| 213 | Features.push_back("+crc"); |
| 214 | else |
| 215 | Features.push_back("-crc"); |
| 216 | } |
| 217 | |
Sjoerd Meijer | c017656 | 2018-09-24 07:55:20 +0000 | [diff] [blame] | 218 | // Handle (arch-dependent) fp16fml/fullfp16 relationship. |
| 219 | // FIXME: this fp16fml option handling will be reimplemented after the |
| 220 | // TargetParser rewrite. |
| 221 | const auto ItRNoFullFP16 = std::find(Features.rbegin(), Features.rend(), "-fullfp16"); |
| 222 | const auto ItRFP16FML = std::find(Features.rbegin(), Features.rend(), "+fp16fml"); |
Fangrui Song | 9ac13a1 | 2019-02-10 05:54:57 +0000 | [diff] [blame] | 223 | if (llvm::is_contained(Features, "+v8.4a")) { |
Sjoerd Meijer | c017656 | 2018-09-24 07:55:20 +0000 | [diff] [blame] | 224 | const auto ItRFullFP16 = std::find(Features.rbegin(), Features.rend(), "+fullfp16"); |
| 225 | if (ItRFullFP16 < ItRNoFullFP16 && ItRFullFP16 < ItRFP16FML) { |
| 226 | // Only entangled feature that can be to the right of this +fullfp16 is -fp16fml. |
| 227 | // Only append the +fp16fml if there is no -fp16fml after the +fullfp16. |
| 228 | if (std::find(Features.rbegin(), ItRFullFP16, "-fp16fml") == ItRFullFP16) |
| 229 | Features.push_back("+fp16fml"); |
| 230 | } |
| 231 | else |
| 232 | goto fp16_fml_fallthrough; |
Fangrui Song | 9ac13a1 | 2019-02-10 05:54:57 +0000 | [diff] [blame] | 233 | } else { |
Sjoerd Meijer | c017656 | 2018-09-24 07:55:20 +0000 | [diff] [blame] | 234 | fp16_fml_fallthrough: |
| 235 | // In both of these cases, putting the 'other' feature on the end of the vector will |
| 236 | // result in the same effect as placing it immediately after the current feature. |
| 237 | if (ItRNoFullFP16 < ItRFP16FML) |
| 238 | Features.push_back("-fp16fml"); |
| 239 | else if (ItRNoFullFP16 > ItRFP16FML) |
| 240 | Features.push_back("+fullfp16"); |
| 241 | } |
| 242 | |
Sjoerd Meijer | d60540a | 2018-10-04 07:38:53 +0000 | [diff] [blame] | 243 | // FIXME: this needs reimplementation too after the TargetParser rewrite |
| 244 | // |
| 245 | // Context sensitive meaning of Crypto: |
| 246 | // 1) For Arch >= ARMv8.4a: crypto = sm4 + sha3 + sha2 + aes |
| 247 | // 2) For Arch <= ARMv8.3a: crypto = sha2 + aes |
| 248 | const auto ItBegin = Features.begin(); |
| 249 | const auto ItEnd = Features.end(); |
| 250 | const auto ItRBegin = Features.rbegin(); |
| 251 | const auto ItREnd = Features.rend(); |
| 252 | const auto ItRCrypto = std::find(ItRBegin, ItREnd, "+crypto"); |
| 253 | const auto ItRNoCrypto = std::find(ItRBegin, ItREnd, "-crypto"); |
| 254 | const auto HasCrypto = ItRCrypto != ItREnd; |
| 255 | const auto HasNoCrypto = ItRNoCrypto != ItREnd; |
| 256 | const ptrdiff_t PosCrypto = ItRCrypto - ItRBegin; |
| 257 | const ptrdiff_t PosNoCrypto = ItRNoCrypto - ItRBegin; |
| 258 | |
| 259 | bool NoCrypto = false; |
| 260 | if (HasCrypto && HasNoCrypto) { |
| 261 | if (PosNoCrypto < PosCrypto) |
| 262 | NoCrypto = true; |
| 263 | } |
| 264 | |
| 265 | if (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd) { |
| 266 | if (HasCrypto && !NoCrypto) { |
| 267 | // Check if we have NOT disabled an algorithm with something like: |
| 268 | // +crypto, -algorithm |
| 269 | // And if "-algorithm" does not occur, we enable that crypto algorithm. |
| 270 | const bool HasSM4 = (std::find(ItBegin, ItEnd, "-sm4") == ItEnd); |
| 271 | const bool HasSHA3 = (std::find(ItBegin, ItEnd, "-sha3") == ItEnd); |
| 272 | const bool HasSHA2 = (std::find(ItBegin, ItEnd, "-sha2") == ItEnd); |
| 273 | const bool HasAES = (std::find(ItBegin, ItEnd, "-aes") == ItEnd); |
| 274 | if (HasSM4) |
| 275 | Features.push_back("+sm4"); |
| 276 | if (HasSHA3) |
| 277 | Features.push_back("+sha3"); |
| 278 | if (HasSHA2) |
| 279 | Features.push_back("+sha2"); |
| 280 | if (HasAES) |
| 281 | Features.push_back("+aes"); |
| 282 | } else if (HasNoCrypto) { |
| 283 | // Check if we have NOT enabled a crypto algorithm with something like: |
| 284 | // -crypto, +algorithm |
| 285 | // And if "+algorithm" does not occur, we disable that crypto algorithm. |
| 286 | const bool HasSM4 = (std::find(ItBegin, ItEnd, "+sm4") != ItEnd); |
| 287 | const bool HasSHA3 = (std::find(ItBegin, ItEnd, "+sha3") != ItEnd); |
| 288 | const bool HasSHA2 = (std::find(ItBegin, ItEnd, "+sha2") != ItEnd); |
| 289 | const bool HasAES = (std::find(ItBegin, ItEnd, "+aes") != ItEnd); |
| 290 | if (!HasSM4) |
| 291 | Features.push_back("-sm4"); |
| 292 | if (!HasSHA3) |
| 293 | Features.push_back("-sha3"); |
| 294 | if (!HasSHA2) |
| 295 | Features.push_back("-sha2"); |
| 296 | if (!HasAES) |
| 297 | Features.push_back("-aes"); |
| 298 | } |
| 299 | } else { |
| 300 | if (HasCrypto && !NoCrypto) { |
| 301 | const bool HasSHA2 = (std::find(ItBegin, ItEnd, "-sha2") == ItEnd); |
| 302 | const bool HasAES = (std::find(ItBegin, ItEnd, "-aes") == ItEnd); |
| 303 | if (HasSHA2) |
| 304 | Features.push_back("+sha2"); |
| 305 | if (HasAES) |
| 306 | Features.push_back("+aes"); |
| 307 | } else if (HasNoCrypto) { |
| 308 | const bool HasSHA2 = (std::find(ItBegin, ItEnd, "+sha2") != ItEnd); |
| 309 | const bool HasAES = (std::find(ItBegin, ItEnd, "+aes") != ItEnd); |
| 310 | const bool HasV82a = (std::find(ItBegin, ItEnd, "+v8.2a") != ItEnd); |
| 311 | const bool HasV83a = (std::find(ItBegin, ItEnd, "+v8.3a") != ItEnd); |
| 312 | const bool HasV84a = (std::find(ItBegin, ItEnd, "+v8.4a") != ItEnd); |
| 313 | if (!HasSHA2) |
| 314 | Features.push_back("-sha2"); |
| 315 | if (!HasAES) |
| 316 | Features.push_back("-aes"); |
| 317 | if (HasV82a || HasV83a || HasV84a) { |
| 318 | Features.push_back("-sm4"); |
| 319 | Features.push_back("-sha3"); |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 324 | if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access, |
| 325 | options::OPT_munaligned_access)) |
| 326 | if (A->getOption().matches(options::OPT_mno_unaligned_access)) |
| 327 | Features.push_back("+strict-align"); |
| 328 | |
Tri Vo | 6e8abbc | 2018-09-12 23:45:04 +0000 | [diff] [blame] | 329 | if (Args.hasArg(options::OPT_ffixed_x1)) |
| 330 | Features.push_back("+reserve-x1"); |
| 331 | |
| 332 | if (Args.hasArg(options::OPT_ffixed_x2)) |
| 333 | Features.push_back("+reserve-x2"); |
| 334 | |
| 335 | if (Args.hasArg(options::OPT_ffixed_x3)) |
| 336 | Features.push_back("+reserve-x3"); |
| 337 | |
| 338 | if (Args.hasArg(options::OPT_ffixed_x4)) |
| 339 | Features.push_back("+reserve-x4"); |
| 340 | |
| 341 | if (Args.hasArg(options::OPT_ffixed_x5)) |
| 342 | Features.push_back("+reserve-x5"); |
| 343 | |
| 344 | if (Args.hasArg(options::OPT_ffixed_x6)) |
| 345 | Features.push_back("+reserve-x6"); |
| 346 | |
| 347 | if (Args.hasArg(options::OPT_ffixed_x7)) |
| 348 | Features.push_back("+reserve-x7"); |
| 349 | |
Petr Hosek | fcbec02 | 2019-02-13 17:28:47 +0000 | [diff] [blame] | 350 | if (Args.hasArg(options::OPT_ffixed_x9)) |
| 351 | Features.push_back("+reserve-x9"); |
| 352 | |
| 353 | if (Args.hasArg(options::OPT_ffixed_x10)) |
| 354 | Features.push_back("+reserve-x10"); |
| 355 | |
| 356 | if (Args.hasArg(options::OPT_ffixed_x11)) |
| 357 | Features.push_back("+reserve-x11"); |
| 358 | |
| 359 | if (Args.hasArg(options::OPT_ffixed_x12)) |
| 360 | Features.push_back("+reserve-x12"); |
| 361 | |
| 362 | if (Args.hasArg(options::OPT_ffixed_x13)) |
| 363 | Features.push_back("+reserve-x13"); |
| 364 | |
| 365 | if (Args.hasArg(options::OPT_ffixed_x14)) |
| 366 | Features.push_back("+reserve-x14"); |
| 367 | |
| 368 | if (Args.hasArg(options::OPT_ffixed_x15)) |
| 369 | Features.push_back("+reserve-x15"); |
| 370 | |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 371 | if (Args.hasArg(options::OPT_ffixed_x18)) |
| 372 | Features.push_back("+reserve-x18"); |
Sanne Wouda | 784004e | 2017-03-27 15:34:52 +0000 | [diff] [blame] | 373 | |
Petr Hosek | 7250908 | 2018-06-12 20:00:50 +0000 | [diff] [blame] | 374 | if (Args.hasArg(options::OPT_ffixed_x20)) |
| 375 | Features.push_back("+reserve-x20"); |
| 376 | |
Petr Hosek | fcbec02 | 2019-02-13 17:28:47 +0000 | [diff] [blame] | 377 | if (Args.hasArg(options::OPT_ffixed_x21)) |
| 378 | Features.push_back("+reserve-x21"); |
| 379 | |
| 380 | if (Args.hasArg(options::OPT_ffixed_x22)) |
| 381 | Features.push_back("+reserve-x22"); |
| 382 | |
| 383 | if (Args.hasArg(options::OPT_ffixed_x23)) |
| 384 | Features.push_back("+reserve-x23"); |
| 385 | |
| 386 | if (Args.hasArg(options::OPT_ffixed_x24)) |
| 387 | Features.push_back("+reserve-x24"); |
| 388 | |
Petr Hosek | 7a290df | 2019-02-13 18:01:23 +0000 | [diff] [blame] | 389 | if (Args.hasArg(options::OPT_ffixed_x25)) |
| 390 | Features.push_back("+reserve-x25"); |
| 391 | |
Petr Hosek | fcbec02 | 2019-02-13 17:28:47 +0000 | [diff] [blame] | 392 | if (Args.hasArg(options::OPT_ffixed_x26)) |
| 393 | Features.push_back("+reserve-x26"); |
| 394 | |
| 395 | if (Args.hasArg(options::OPT_ffixed_x27)) |
| 396 | Features.push_back("+reserve-x27"); |
| 397 | |
| 398 | if (Args.hasArg(options::OPT_ffixed_x28)) |
| 399 | Features.push_back("+reserve-x28"); |
| 400 | |
Tri Vo | 28e7e60 | 2018-09-25 16:48:40 +0000 | [diff] [blame] | 401 | if (Args.hasArg(options::OPT_fcall_saved_x8)) |
| 402 | Features.push_back("+call-saved-x8"); |
| 403 | |
| 404 | if (Args.hasArg(options::OPT_fcall_saved_x9)) |
| 405 | Features.push_back("+call-saved-x9"); |
| 406 | |
| 407 | if (Args.hasArg(options::OPT_fcall_saved_x10)) |
| 408 | Features.push_back("+call-saved-x10"); |
| 409 | |
| 410 | if (Args.hasArg(options::OPT_fcall_saved_x11)) |
| 411 | Features.push_back("+call-saved-x11"); |
| 412 | |
| 413 | if (Args.hasArg(options::OPT_fcall_saved_x12)) |
| 414 | Features.push_back("+call-saved-x12"); |
| 415 | |
| 416 | if (Args.hasArg(options::OPT_fcall_saved_x13)) |
| 417 | Features.push_back("+call-saved-x13"); |
| 418 | |
| 419 | if (Args.hasArg(options::OPT_fcall_saved_x14)) |
| 420 | Features.push_back("+call-saved-x14"); |
| 421 | |
| 422 | if (Args.hasArg(options::OPT_fcall_saved_x15)) |
| 423 | Features.push_back("+call-saved-x15"); |
| 424 | |
| 425 | if (Args.hasArg(options::OPT_fcall_saved_x18)) |
| 426 | Features.push_back("+call-saved-x18"); |
| 427 | |
Sanne Wouda | 784004e | 2017-03-27 15:34:52 +0000 | [diff] [blame] | 428 | if (Args.hasArg(options::OPT_mno_neg_immediates)) |
| 429 | Features.push_back("+no-neg-immediates"); |
David L. Jones | ecc6de3 | 2017-02-24 00:28:01 +0000 | [diff] [blame] | 430 | } |