14#include "llvm/ADT/StringSwitch.h"
15#include "llvm/Option/ArgList.h"
16#include "llvm/TargetParser/Host.h"
24 return llvm::StringSwitch<const char *>(Name)
25 .Case(
"pwr7",
"-mpower7")
26 .Case(
"power7",
"-mpower7")
27 .Case(
"pwr8",
"-mpower8")
28 .Case(
"power8",
"-mpower8")
29 .Case(
"ppc64le",
"-mpower8")
30 .Case(
"pwr9",
"-mpower9")
31 .Case(
"power9",
"-mpower9")
32 .Case(
"pwr10",
"-mpower10")
33 .Case(
"power10",
"-mpower10")
34 .Case(
"pwr11",
"-mpower11")
35 .Case(
"power11",
"-mpower11")
41 std::vector<StringRef> &Features) {
42 if (Triple.getSubArch() == llvm::Triple::PPCSubArch_spe)
43 Features.push_back(
"+spe");
46 options::OPT_m_ppc_Features_Group);
49 if (FloatABI == ppc::FloatABI::Soft)
50 Features.push_back(
"-hard-float");
53 if (ReadGOT == ppc::ReadGOTPtrMode::SecurePlt)
54 Features.push_back(
"+secure-plt");
57 bool HasDefaultDataSections = Triple.isOSBinFormatXCOFF();
58 if (Args.hasArg(options::OPT_maix_small_local_exec_tls) ||
59 Args.hasArg(options::OPT_maix_small_local_dynamic_tls)) {
60 if (!Triple.isOSAIX() || !Triple.isArch64Bit())
61 D.Diag(diag::err_opt_not_valid_on_target)
62 <<
"-maix-small-local-[exec|dynamic]-tls";
69 if (!Args.hasFlag(options::OPT_fdata_sections,
70 options::OPT_fno_data_sections,
71 UseSeparateSections || HasDefaultDataSections))
72 D.Diag(diag::err_drv_argument_only_allowed_with)
73 <<
"-maix-small-local-[exec|dynamic]-tls" <<
"-fdata-sections";
78 const ArgList &Args) {
79 if (Args.getLastArg(options::OPT_msecure_plt))
80 return ppc::ReadGOTPtrMode::SecurePlt;
81 if (Triple.isPPC32SecurePlt())
82 return ppc::ReadGOTPtrMode::SecurePlt;
84 return ppc::ReadGOTPtrMode::Bss;
90 Args.getLastArg(options::OPT_msoft_float, options::OPT_mhard_float,
91 options::OPT_mfloat_abi_EQ)) {
92 if (A->getOption().matches(options::OPT_msoft_float))
93 ABI = ppc::FloatABI::Soft;
94 else if (A->getOption().matches(options::OPT_mhard_float))
95 ABI = ppc::FloatABI::Hard;
97 ABI = llvm::StringSwitch<ppc::FloatABI>(A->getValue())
98 .Case(
"soft", ppc::FloatABI::Soft)
99 .Case(
"hard", ppc::FloatABI::Hard)
100 .Default(ppc::FloatABI::Invalid);
101 if (ABI == ppc::FloatABI::Invalid && !StringRef(A->getValue()).empty()) {
102 D.Diag(clang::diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
103 ABI = ppc::FloatABI::Hard;
109 if (ABI == ppc::FloatABI::Invalid) {
110 ABI = ppc::FloatABI::Hard;
117 Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
118 return A && (A->getValue() == StringRef(
Value));
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
The JSON file list parser is used to communicate input to InstallAPI.