13#include "llvm/ADT/StringSwitch.h"
14#include "llvm/Option/ArgList.h"
15#include "llvm/TargetParser/Host.h"
23 const llvm::Triple &Triple) {
24 if (Triple.getArch() == llvm::Triple::sparcv9) {
27 if (Triple.isOSLinux() || Triple.isOSFreeBSD() || Triple.isOSOpenBSD())
32 return llvm::StringSwitch<const char *>(Name)
33 .Case(
"niagara",
"-Av9b")
34 .Case(
"niagara2",
"-Av9b")
35 .Case(
"niagara3",
"-Av9d")
36 .Case(
"niagara4",
"-Av9d")
39 return llvm::StringSwitch<const char *>(Name)
41 .Case(
"supersparc",
"-Av8")
42 .Case(
"sparclite",
"-Asparclite")
43 .Case(
"f934",
"-Asparclite")
44 .Case(
"hypersparc",
"-Av8")
45 .Case(
"sparclite86x",
"-Asparclite")
46 .Case(
"sparclet",
"-Asparclet")
47 .Case(
"tsc701",
"-Asparclet")
48 .Case(
"v9",
"-Av8plus")
49 .Case(
"ultrasparc",
"-Av8plus")
50 .Case(
"ultrasparc3",
"-Av8plus")
51 .Case(
"niagara",
"-Av8plusb")
52 .Case(
"niagara2",
"-Av8plusb")
53 .Case(
"niagara3",
"-Av8plusd")
54 .Case(
"niagara4",
"-Av8plusd")
55 .Case(
"ma2100",
"-Aleon")
56 .Case(
"ma2150",
"-Aleon")
57 .Case(
"ma2155",
"-Aleon")
58 .Case(
"ma2450",
"-Aleon")
59 .Case(
"ma2455",
"-Aleon")
60 .Case(
"ma2x5x",
"-Aleon")
61 .Case(
"ma2080",
"-Aleon")
62 .Case(
"ma2085",
"-Aleon")
63 .Case(
"ma2480",
"-Aleon")
64 .Case(
"ma2485",
"-Aleon")
65 .Case(
"ma2x8x",
"-Aleon")
66 .Case(
"leon2",
"-Av8")
67 .Case(
"at697e",
"-Av8")
68 .Case(
"at697f",
"-Av8")
69 .Case(
"leon3",
"-Aleon")
70 .Case(
"ut699",
"-Av8")
71 .Case(
"gr712rc",
"-Aleon")
72 .Case(
"leon4",
"-Aleon")
73 .Case(
"gr740",
"-Aleon")
79 const ArgList &Args) {
81 if (Arg *A = Args.getLastArg(options::OPT_msoft_float, options::OPT_mno_fpu,
82 options::OPT_mhard_float, options::OPT_mfpu,
83 options::OPT_mfloat_abi_EQ)) {
84 if (A->getOption().matches(options::OPT_msoft_float) ||
85 A->getOption().matches(options::OPT_mno_fpu))
86 ABI = sparc::FloatABI::Soft;
87 else if (A->getOption().matches(options::OPT_mhard_float) ||
88 A->getOption().matches(options::OPT_mfpu))
89 ABI = sparc::FloatABI::Hard;
91 ABI = llvm::StringSwitch<sparc::FloatABI>(A->getValue())
92 .Case(
"soft", sparc::FloatABI::Soft)
93 .Case(
"hard", sparc::FloatABI::Hard)
94 .Default(sparc::FloatABI::Invalid);
95 if (ABI == sparc::FloatABI::Invalid &&
96 !StringRef(A->getValue()).empty()) {
97 D.Diag(clang::diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
98 ABI = sparc::FloatABI::Hard;
108 if (ABI == sparc::FloatABI::Invalid) {
109 ABI = sparc::FloatABI::Hard;
116 const llvm::Triple &Triple) {
117 if (
const Arg *A = Args.getLastArg(clang::driver::options::OPT_mcpu_EQ)) {
118 StringRef CPUName = A->getValue();
119 if (CPUName ==
"native") {
120 std::string CPU = std::string(llvm::sys::getHostCPUName());
121 if (!CPU.empty() && CPU !=
"generic")
125 return std::string(CPUName);
128 if (Triple.getArch() == llvm::Triple::sparc && Triple.isOSSolaris())
134 std::vector<StringRef> &Features) {
136 if (FloatABI == sparc::FloatABI::Soft)
137 Features.push_back(
"+soft-float");
139 if (Arg *A = Args.getLastArg(options::OPT_mfsmuld, options::OPT_mno_fsmuld)) {
140 if (A->getOption().matches(options::OPT_mfsmuld))
141 Features.push_back(
"+fsmuld");
143 Features.push_back(
"-fsmuld");
146 if (Arg *A = Args.getLastArg(options::OPT_mpopc, options::OPT_mno_popc)) {
147 if (A->getOption().matches(options::OPT_mpopc))
148 Features.push_back(
"+popc");
150 Features.push_back(
"-popc");
153 if (Arg *A = Args.getLastArg(options::OPT_mvis, options::OPT_mno_vis)) {
154 if (A->getOption().matches(options::OPT_mvis))
155 Features.push_back(
"+vis");
157 Features.push_back(
"-vis");
160 if (Arg *A = Args.getLastArg(options::OPT_mvis2, options::OPT_mno_vis2)) {
161 if (A->getOption().matches(options::OPT_mvis2))
162 Features.push_back(
"+vis2");
164 Features.push_back(
"-vis2");
167 if (Arg *A = Args.getLastArg(options::OPT_mvis3, options::OPT_mno_vis3)) {
168 if (A->getOption().matches(options::OPT_mvis3))
169 Features.push_back(
"+vis3");
171 Features.push_back(
"-vis3");
174 if (Arg *A = Args.getLastArg(options::OPT_mhard_quad_float,
175 options::OPT_msoft_quad_float)) {
176 if (A->getOption().matches(options::OPT_mhard_quad_float))
177 Features.push_back(
"+hard-quad-float");
179 Features.push_back(
"-hard-quad-float");
182 if (Arg *A = Args.getLastArg(options::OPT_mv8plus, options::OPT_mno_v8plus)) {
183 if (A->getOption().matches(options::OPT_mv8plus))
184 Features.push_back(
"+v8plus");
187 if (Args.hasArg(options::OPT_ffixed_g1))
188 Features.push_back(
"+reserve-g1");
190 if (Args.hasArg(options::OPT_ffixed_g2))
191 Features.push_back(
"+reserve-g2");
193 if (Args.hasArg(options::OPT_ffixed_g3))
194 Features.push_back(
"+reserve-g3");
196 if (Args.hasArg(options::OPT_ffixed_g4))
197 Features.push_back(
"+reserve-g4");
199 if (Args.hasArg(options::OPT_ffixed_g5))
200 Features.push_back(
"+reserve-g5");
202 if (Args.hasArg(options::OPT_ffixed_g6))
203 Features.push_back(
"+reserve-g6");
205 if (Args.hasArg(options::OPT_ffixed_g7))
206 Features.push_back(
"+reserve-g7");
208 if (Args.hasArg(options::OPT_ffixed_o0))
209 Features.push_back(
"+reserve-o0");
211 if (Args.hasArg(options::OPT_ffixed_o1))
212 Features.push_back(
"+reserve-o1");
214 if (Args.hasArg(options::OPT_ffixed_o2))
215 Features.push_back(
"+reserve-o2");
217 if (Args.hasArg(options::OPT_ffixed_o3))
218 Features.push_back(
"+reserve-o3");
220 if (Args.hasArg(options::OPT_ffixed_o4))
221 Features.push_back(
"+reserve-o4");
223 if (Args.hasArg(options::OPT_ffixed_o5))
224 Features.push_back(
"+reserve-o5");
226 if (Args.hasArg(options::OPT_ffixed_l0))
227 Features.push_back(
"+reserve-l0");
229 if (Args.hasArg(options::OPT_ffixed_l1))
230 Features.push_back(
"+reserve-l1");
232 if (Args.hasArg(options::OPT_ffixed_l2))
233 Features.push_back(
"+reserve-l2");
235 if (Args.hasArg(options::OPT_ffixed_l3))
236 Features.push_back(
"+reserve-l3");
238 if (Args.hasArg(options::OPT_ffixed_l4))
239 Features.push_back(
"+reserve-l4");
241 if (Args.hasArg(options::OPT_ffixed_l5))
242 Features.push_back(
"+reserve-l5");
244 if (Args.hasArg(options::OPT_ffixed_l6))
245 Features.push_back(
"+reserve-l6");
247 if (Args.hasArg(options::OPT_ffixed_l7))
248 Features.push_back(
"+reserve-l7");
250 if (Args.hasArg(options::OPT_ffixed_i0))
251 Features.push_back(
"+reserve-i0");
253 if (Args.hasArg(options::OPT_ffixed_i1))
254 Features.push_back(
"+reserve-i1");
256 if (Args.hasArg(options::OPT_ffixed_i2))
257 Features.push_back(
"+reserve-i2");
259 if (Args.hasArg(options::OPT_ffixed_i3))
260 Features.push_back(
"+reserve-i3");
262 if (Args.hasArg(options::OPT_ffixed_i4))
263 Features.push_back(
"+reserve-i4");
265 if (Args.hasArg(options::OPT_ffixed_i5))
266 Features.push_back(
"+reserve-i5");
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.