1 //===--- HostInfo.cpp - Host specific information -------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "clang/Driver/HostInfo.h"
11
12 #include "clang/Driver/Arg.h"
13 #include "clang/Driver/ArgList.h"
14 #include "clang/Driver/Driver.h"
15 #include "clang/Driver/DriverDiagnostic.h"
16 #include "clang/Driver/Option.h"
17 #include "clang/Driver/Options.h"
18
19 #include "llvm/ADT/StringMap.h"
20 #include "llvm/Support/Compiler.h"
21
22 #include "ToolChains.h"
23
24 #include <cassert>
25
26 using namespace clang::driver;
27
HostInfo(const Driver & D,const llvm::Triple & _Triple)28 HostInfo::HostInfo(const Driver &D, const llvm::Triple &_Triple)
29 : TheDriver(D), Triple(_Triple) {
30 }
31
~HostInfo()32 HostInfo::~HostInfo() {
33 }
34
35 namespace {
36
37 // Darwin Host Info
38
39 /// DarwinHostInfo - Darwin host information implementation.
40 class DarwinHostInfo : public HostInfo {
41 /// Cache of tool chains we have created.
42 mutable llvm::DenseMap<unsigned, ToolChain*> ToolChains;
43
44 public:
45 DarwinHostInfo(const Driver &D, const llvm::Triple &Triple);
46 ~DarwinHostInfo();
47
48 virtual bool useDriverDriver() const;
49
50 virtual ToolChain *CreateToolChain(const ArgList &Args,
51 const char *ArchName) const;
52 };
53
DarwinHostInfo(const Driver & D,const llvm::Triple & Triple)54 DarwinHostInfo::DarwinHostInfo(const Driver &D, const llvm::Triple& Triple)
55 : HostInfo(D, Triple) {
56 }
57
~DarwinHostInfo()58 DarwinHostInfo::~DarwinHostInfo() {
59 for (llvm::DenseMap<unsigned, ToolChain*>::iterator
60 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
61 delete it->second;
62 }
63
useDriverDriver() const64 bool DarwinHostInfo::useDriverDriver() const {
65 return true;
66 }
67
CreateToolChain(const ArgList & Args,const char * ArchName) const68 ToolChain *DarwinHostInfo::CreateToolChain(const ArgList &Args,
69 const char *ArchName) const {
70 llvm::Triple::ArchType Arch;
71
72 if (!ArchName) {
73 // If we aren't looking for a specific arch, infer the default architecture
74 // based on -arch and -m32/-m64 command line options.
75 if (Arg *A = Args.getLastArg(options::OPT_arch)) {
76 // The gcc driver behavior with multiple -arch flags wasn't consistent for
77 // things which rely on a default architecture. We just use the last -arch
78 // to find the default tool chain (assuming it is valid).
79 Arch = llvm::Triple::getArchTypeForDarwinArchName(A->getValue(Args));
80
81 // If it was invalid just use the host, we will reject this command line
82 // later.
83 if (Arch == llvm::Triple::UnknownArch)
84 Arch = getTriple().getArch();
85 } else {
86 // Otherwise default to the arch of the host.
87 Arch = getTriple().getArch();
88 }
89
90 // Honor -m32 and -m64 when finding the default tool chain.
91 //
92 // FIXME: Should this information be in llvm::Triple?
93 if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
94 if (A->getOption().matches(options::OPT_m32)) {
95 if (Arch == llvm::Triple::x86_64)
96 Arch = llvm::Triple::x86;
97 if (Arch == llvm::Triple::ppc64)
98 Arch = llvm::Triple::ppc;
99 } else {
100 if (Arch == llvm::Triple::x86)
101 Arch = llvm::Triple::x86_64;
102 if (Arch == llvm::Triple::ppc)
103 Arch = llvm::Triple::ppc64;
104 }
105 }
106 } else
107 Arch = llvm::Triple::getArchTypeForDarwinArchName(ArchName);
108
109 assert(Arch != llvm::Triple::UnknownArch && "Unexpected arch!");
110 ToolChain *&TC = ToolChains[Arch];
111 if (!TC) {
112 llvm::Triple TCTriple(getTriple());
113 TCTriple.setArch(Arch);
114
115 // If we recognized the arch, match it to the toolchains we support.
116 if (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64 ||
117 Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) {
118 TC = new toolchains::DarwinClang(*this, TCTriple);
119 } else
120 TC = new toolchains::Darwin_Generic_GCC(*this, TCTriple);
121 }
122
123 return TC;
124 }
125
126 // TCE Host Info
127
128 /// TCEHostInfo - TCE host information implementation (see http://tce.cs.tut.fi)
129 class TCEHostInfo : public HostInfo {
130
131 public:
132 TCEHostInfo(const Driver &D, const llvm::Triple &Triple);
~TCEHostInfo()133 ~TCEHostInfo() {}
134
135 virtual bool useDriverDriver() const;
136
137 virtual ToolChain *CreateToolChain(const ArgList &Args,
138 const char *ArchName) const;
139 };
140
TCEHostInfo(const Driver & D,const llvm::Triple & Triple)141 TCEHostInfo::TCEHostInfo(const Driver &D, const llvm::Triple& Triple)
142 : HostInfo(D, Triple) {
143 }
144
useDriverDriver() const145 bool TCEHostInfo::useDriverDriver() const {
146 return false;
147 }
148
CreateToolChain(const ArgList & Args,const char * ArchName) const149 ToolChain *TCEHostInfo::CreateToolChain(const ArgList &Args,
150 const char *ArchName) const {
151 llvm::Triple TCTriple(getTriple());
152 // TCTriple.setArchName(ArchName);
153 return new toolchains::TCEToolChain(*this, TCTriple);
154 }
155
156
157 // Unknown Host Info
158
159 /// UnknownHostInfo - Generic host information to use for unknown hosts.
160 class UnknownHostInfo : public HostInfo {
161 /// Cache of tool chains we have created.
162 mutable llvm::StringMap<ToolChain*> ToolChains;
163
164 public:
165 UnknownHostInfo(const Driver &D, const llvm::Triple& Triple);
166 ~UnknownHostInfo();
167
168 virtual bool useDriverDriver() const;
169
170 virtual ToolChain *CreateToolChain(const ArgList &Args,
171 const char *ArchName) const;
172 };
173
UnknownHostInfo(const Driver & D,const llvm::Triple & Triple)174 UnknownHostInfo::UnknownHostInfo(const Driver &D, const llvm::Triple& Triple)
175 : HostInfo(D, Triple) {
176 }
177
~UnknownHostInfo()178 UnknownHostInfo::~UnknownHostInfo() {
179 for (llvm::StringMap<ToolChain*>::iterator
180 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
181 delete it->second;
182 }
183
useDriverDriver() const184 bool UnknownHostInfo::useDriverDriver() const {
185 return false;
186 }
187
CreateToolChain(const ArgList & Args,const char * ArchName) const188 ToolChain *UnknownHostInfo::CreateToolChain(const ArgList &Args,
189 const char *ArchName) const {
190 assert(!ArchName &&
191 "Unexpected arch name on platform without driver driver support.");
192
193 // Automatically handle some instances of -m32/-m64 we know about.
194 std::string Arch = getArchName();
195 ArchName = Arch.c_str();
196 if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
197 if (Triple.getArch() == llvm::Triple::x86 ||
198 Triple.getArch() == llvm::Triple::x86_64) {
199 ArchName =
200 (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64";
201 } else if (Triple.getArch() == llvm::Triple::ppc ||
202 Triple.getArch() == llvm::Triple::ppc64) {
203 ArchName =
204 (A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64";
205 }
206 }
207
208 ToolChain *&TC = ToolChains[ArchName];
209 if (!TC) {
210 llvm::Triple TCTriple(getTriple());
211 TCTriple.setArchName(ArchName);
212
213 TC = new toolchains::Generic_GCC(*this, TCTriple);
214 }
215
216 return TC;
217 }
218
219 // OpenBSD Host Info
220
221 /// OpenBSDHostInfo - OpenBSD host information implementation.
222 class OpenBSDHostInfo : public HostInfo {
223 /// Cache of tool chains we have created.
224 mutable llvm::StringMap<ToolChain*> ToolChains;
225
226 public:
OpenBSDHostInfo(const Driver & D,const llvm::Triple & Triple)227 OpenBSDHostInfo(const Driver &D, const llvm::Triple& Triple)
228 : HostInfo(D, Triple) {}
229 ~OpenBSDHostInfo();
230
231 virtual bool useDriverDriver() const;
232
233 virtual ToolChain *CreateToolChain(const ArgList &Args,
234 const char *ArchName) const;
235 };
236
~OpenBSDHostInfo()237 OpenBSDHostInfo::~OpenBSDHostInfo() {
238 for (llvm::StringMap<ToolChain*>::iterator
239 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
240 delete it->second;
241 }
242
useDriverDriver() const243 bool OpenBSDHostInfo::useDriverDriver() const {
244 return false;
245 }
246
CreateToolChain(const ArgList & Args,const char * ArchName) const247 ToolChain *OpenBSDHostInfo::CreateToolChain(const ArgList &Args,
248 const char *ArchName) const {
249 assert(!ArchName &&
250 "Unexpected arch name on platform without driver driver support.");
251
252 std::string Arch = getArchName();
253 ArchName = Arch.c_str();
254
255 ToolChain *&TC = ToolChains[ArchName];
256 if (!TC) {
257 llvm::Triple TCTriple(getTriple());
258 TCTriple.setArchName(ArchName);
259
260 TC = new toolchains::OpenBSD(*this, TCTriple);
261 }
262
263 return TC;
264 }
265
266 // AuroraUX Host Info
267
268 /// AuroraUXHostInfo - AuroraUX host information implementation.
269 class AuroraUXHostInfo : public HostInfo {
270 /// Cache of tool chains we have created.
271 mutable llvm::StringMap<ToolChain*> ToolChains;
272
273 public:
AuroraUXHostInfo(const Driver & D,const llvm::Triple & Triple)274 AuroraUXHostInfo(const Driver &D, const llvm::Triple& Triple)
275 : HostInfo(D, Triple) {}
276 ~AuroraUXHostInfo();
277
278 virtual bool useDriverDriver() const;
279
280 virtual ToolChain *CreateToolChain(const ArgList &Args,
281 const char *ArchName) const;
282 };
283
~AuroraUXHostInfo()284 AuroraUXHostInfo::~AuroraUXHostInfo() {
285 for (llvm::StringMap<ToolChain*>::iterator
286 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
287 delete it->second;
288 }
289
useDriverDriver() const290 bool AuroraUXHostInfo::useDriverDriver() const {
291 return false;
292 }
293
CreateToolChain(const ArgList & Args,const char * ArchName) const294 ToolChain *AuroraUXHostInfo::CreateToolChain(const ArgList &Args,
295 const char *ArchName) const {
296 assert(!ArchName &&
297 "Unexpected arch name on platform without driver driver support.");
298
299 ToolChain *&TC = ToolChains[getArchName()];
300
301 if (!TC) {
302 llvm::Triple TCTriple(getTriple());
303 TCTriple.setArchName(getArchName());
304
305 TC = new toolchains::AuroraUX(*this, TCTriple);
306 }
307
308 return TC;
309 }
310
311 // FreeBSD Host Info
312
313 /// FreeBSDHostInfo - FreeBSD host information implementation.
314 class FreeBSDHostInfo : public HostInfo {
315 /// Cache of tool chains we have created.
316 mutable llvm::StringMap<ToolChain*> ToolChains;
317
318 public:
FreeBSDHostInfo(const Driver & D,const llvm::Triple & Triple)319 FreeBSDHostInfo(const Driver &D, const llvm::Triple& Triple)
320 : HostInfo(D, Triple) {}
321 ~FreeBSDHostInfo();
322
323 virtual bool useDriverDriver() const;
324
325 virtual ToolChain *CreateToolChain(const ArgList &Args,
326 const char *ArchName) const;
327 };
328
~FreeBSDHostInfo()329 FreeBSDHostInfo::~FreeBSDHostInfo() {
330 for (llvm::StringMap<ToolChain*>::iterator
331 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
332 delete it->second;
333 }
334
useDriverDriver() const335 bool FreeBSDHostInfo::useDriverDriver() const {
336 return false;
337 }
338
CreateToolChain(const ArgList & Args,const char * ArchName) const339 ToolChain *FreeBSDHostInfo::CreateToolChain(const ArgList &Args,
340 const char *ArchName) const {
341 assert(!ArchName &&
342 "Unexpected arch name on platform without driver driver support.");
343
344 // Automatically handle some instances of -m32/-m64 we know about.
345 std::string Arch = getArchName();
346 ArchName = Arch.c_str();
347 if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
348 if (Triple.getArch() == llvm::Triple::x86 ||
349 Triple.getArch() == llvm::Triple::x86_64) {
350 ArchName =
351 (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64";
352 } else if (Triple.getArch() == llvm::Triple::ppc ||
353 Triple.getArch() == llvm::Triple::ppc64) {
354 ArchName =
355 (A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64";
356 }
357 }
358
359 ToolChain *&TC = ToolChains[ArchName];
360 if (!TC) {
361 llvm::Triple TCTriple(getTriple());
362 TCTriple.setArchName(ArchName);
363
364 TC = new toolchains::FreeBSD(*this, TCTriple);
365 }
366
367 return TC;
368 }
369
370 // NetBSD Host Info
371
372 /// NetBSDHostInfo - NetBSD host information implementation.
373 class NetBSDHostInfo : public HostInfo {
374 /// Cache of tool chains we have created.
375 mutable llvm::StringMap<ToolChain*> ToolChains;
376
377 public:
NetBSDHostInfo(const Driver & D,const llvm::Triple & Triple)378 NetBSDHostInfo(const Driver &D, const llvm::Triple& Triple)
379 : HostInfo(D, Triple) {}
380 ~NetBSDHostInfo();
381
382 virtual bool useDriverDriver() const;
383
384 virtual ToolChain *CreateToolChain(const ArgList &Args,
385 const char *ArchName) const;
386 };
387
~NetBSDHostInfo()388 NetBSDHostInfo::~NetBSDHostInfo() {
389 for (llvm::StringMap<ToolChain*>::iterator
390 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
391 delete it->second;
392 }
393
useDriverDriver() const394 bool NetBSDHostInfo::useDriverDriver() const {
395 return false;
396 }
397
CreateToolChain(const ArgList & Args,const char * ArchName) const398 ToolChain *NetBSDHostInfo::CreateToolChain(const ArgList &Args,
399 const char *ArchName) const {
400 assert(!ArchName &&
401 "Unexpected arch name on platform without driver driver support.");
402
403 // Automatically handle some instances of -m32/-m64 we know about.
404 std::string Arch = getArchName();
405 ArchName = Arch.c_str();
406 if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
407 if (Triple.getArch() == llvm::Triple::x86 ||
408 Triple.getArch() == llvm::Triple::x86_64) {
409 ArchName =
410 (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64";
411 } else if (Triple.getArch() == llvm::Triple::ppc ||
412 Triple.getArch() == llvm::Triple::ppc64) {
413 ArchName =
414 (A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64";
415 }
416 }
417 llvm::Triple TargetTriple(getTriple());
418 TargetTriple.setArchName(ArchName);
419
420 ToolChain *TC;
421
422 // XXX Cache toolchain even if -m32 is used
423 if (Arch == ArchName) {
424 TC = ToolChains[ArchName];
425 if (TC)
426 return TC;
427 }
428
429 TC = new toolchains::NetBSD(*this, TargetTriple, getTriple());
430
431 return TC;
432 }
433
434 // Minix Host Info
435
436 /// MinixHostInfo - Minix host information implementation.
437 class MinixHostInfo : public HostInfo {
438 /// Cache of tool chains we have created.
439 mutable llvm::StringMap<ToolChain*> ToolChains;
440
441 public:
MinixHostInfo(const Driver & D,const llvm::Triple & Triple)442 MinixHostInfo(const Driver &D, const llvm::Triple& Triple)
443 : HostInfo(D, Triple) {}
444 ~MinixHostInfo();
445
446 virtual bool useDriverDriver() const;
447
448 virtual ToolChain *CreateToolChain(const ArgList &Args,
449 const char *ArchName) const;
450 };
451
~MinixHostInfo()452 MinixHostInfo::~MinixHostInfo() {
453 for (llvm::StringMap<ToolChain*>::iterator
454 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it){
455 delete it->second;
456 }
457 }
458
useDriverDriver() const459 bool MinixHostInfo::useDriverDriver() const {
460 return false;
461 }
462
CreateToolChain(const ArgList & Args,const char * ArchName) const463 ToolChain *MinixHostInfo::CreateToolChain(const ArgList &Args,
464 const char *ArchName) const {
465 assert(!ArchName &&
466 "Unexpected arch name on platform without driver driver support.");
467
468 std::string Arch = getArchName();
469 ArchName = Arch.c_str();
470
471 ToolChain *&TC = ToolChains[ArchName];
472 if (!TC) {
473 llvm::Triple TCTriple(getTriple());
474 TCTriple.setArchName(ArchName);
475
476 TC = new toolchains::Minix(*this, TCTriple);
477 }
478
479 return TC;
480 }
481
482 // DragonFly Host Info
483
484 /// DragonFlyHostInfo - DragonFly host information implementation.
485 class DragonFlyHostInfo : public HostInfo {
486 /// Cache of tool chains we have created.
487 mutable llvm::StringMap<ToolChain*> ToolChains;
488
489 public:
DragonFlyHostInfo(const Driver & D,const llvm::Triple & Triple)490 DragonFlyHostInfo(const Driver &D, const llvm::Triple& Triple)
491 : HostInfo(D, Triple) {}
492 ~DragonFlyHostInfo();
493
494 virtual bool useDriverDriver() const;
495
496 virtual ToolChain *CreateToolChain(const ArgList &Args,
497 const char *ArchName) const;
498 };
499
~DragonFlyHostInfo()500 DragonFlyHostInfo::~DragonFlyHostInfo() {
501 for (llvm::StringMap<ToolChain*>::iterator
502 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
503 delete it->second;
504 }
505
useDriverDriver() const506 bool DragonFlyHostInfo::useDriverDriver() const {
507 return false;
508 }
509
CreateToolChain(const ArgList & Args,const char * ArchName) const510 ToolChain *DragonFlyHostInfo::CreateToolChain(const ArgList &Args,
511 const char *ArchName) const {
512 assert(!ArchName &&
513 "Unexpected arch name on platform without driver driver support.");
514
515 ToolChain *&TC = ToolChains[getArchName()];
516
517 if (!TC) {
518 llvm::Triple TCTriple(getTriple());
519 TCTriple.setArchName(getArchName());
520
521 TC = new toolchains::DragonFly(*this, TCTriple);
522 }
523
524 return TC;
525 }
526
527 // Linux Host Info
528
529 /// LinuxHostInfo - Linux host information implementation.
530 class LinuxHostInfo : public HostInfo {
531 /// Cache of tool chains we have created.
532 mutable llvm::StringMap<ToolChain*> ToolChains;
533
534 public:
LinuxHostInfo(const Driver & D,const llvm::Triple & Triple)535 LinuxHostInfo(const Driver &D, const llvm::Triple& Triple)
536 : HostInfo(D, Triple) {}
537 ~LinuxHostInfo();
538
539 virtual bool useDriverDriver() const;
540
541 virtual ToolChain *CreateToolChain(const ArgList &Args,
542 const char *ArchName) const;
543 };
544
~LinuxHostInfo()545 LinuxHostInfo::~LinuxHostInfo() {
546 for (llvm::StringMap<ToolChain*>::iterator
547 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
548 delete it->second;
549 }
550
useDriverDriver() const551 bool LinuxHostInfo::useDriverDriver() const {
552 return false;
553 }
554
CreateToolChain(const ArgList & Args,const char * ArchName) const555 ToolChain *LinuxHostInfo::CreateToolChain(const ArgList &Args,
556 const char *ArchName) const {
557
558 assert(!ArchName &&
559 "Unexpected arch name on platform without driver driver support.");
560
561 // Automatically handle some instances of -m32/-m64 we know about.
562 std::string Arch = getArchName();
563 ArchName = Arch.c_str();
564 if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
565 if (Triple.getArch() == llvm::Triple::x86 ||
566 Triple.getArch() == llvm::Triple::x86_64) {
567 ArchName =
568 (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64";
569 } else if (Triple.getArch() == llvm::Triple::ppc ||
570 Triple.getArch() == llvm::Triple::ppc64) {
571 ArchName =
572 (A->getOption().matches(options::OPT_m32)) ? "powerpc" : "powerpc64";
573 }
574 }
575
576 ToolChain *&TC = ToolChains[ArchName];
577
578 if (!TC) {
579 llvm::Triple TCTriple(getTriple());
580 TCTriple.setArchName(ArchName);
581
582 TC = new toolchains::Linux(*this, TCTriple);
583 }
584
585 return TC;
586 }
587
588 // Windows Host Info
589
590 /// WindowsHostInfo - Host information to use on Microsoft Windows.
591 class WindowsHostInfo : public HostInfo {
592 /// Cache of tool chains we have created.
593 mutable llvm::StringMap<ToolChain*> ToolChains;
594
595 public:
596 WindowsHostInfo(const Driver &D, const llvm::Triple& Triple);
597 ~WindowsHostInfo();
598
599 virtual bool useDriverDriver() const;
600
lookupTypeForExtension(const char * Ext) const601 virtual types::ID lookupTypeForExtension(const char *Ext) const {
602 return types::lookupTypeForExtension(Ext);
603 }
604
605 virtual ToolChain *CreateToolChain(const ArgList &Args,
606 const char *ArchName) const;
607 };
608
WindowsHostInfo(const Driver & D,const llvm::Triple & Triple)609 WindowsHostInfo::WindowsHostInfo(const Driver &D, const llvm::Triple& Triple)
610 : HostInfo(D, Triple) {
611 }
612
~WindowsHostInfo()613 WindowsHostInfo::~WindowsHostInfo() {
614 for (llvm::StringMap<ToolChain*>::iterator
615 it = ToolChains.begin(), ie = ToolChains.end(); it != ie; ++it)
616 delete it->second;
617 }
618
useDriverDriver() const619 bool WindowsHostInfo::useDriverDriver() const {
620 return false;
621 }
622
CreateToolChain(const ArgList & Args,const char * ArchName) const623 ToolChain *WindowsHostInfo::CreateToolChain(const ArgList &Args,
624 const char *ArchName) const {
625 assert(!ArchName &&
626 "Unexpected arch name on platform without driver driver support.");
627
628 // Automatically handle some instances of -m32/-m64 we know about.
629 std::string Arch = getArchName();
630 ArchName = Arch.c_str();
631 if (Arg *A = Args.getLastArg(options::OPT_m32, options::OPT_m64)) {
632 if (Triple.getArch() == llvm::Triple::x86 ||
633 Triple.getArch() == llvm::Triple::x86_64) {
634 ArchName =
635 (A->getOption().matches(options::OPT_m32)) ? "i386" : "x86_64";
636 }
637 }
638
639 ToolChain *&TC = ToolChains[ArchName];
640 if (!TC) {
641 llvm::Triple TCTriple(getTriple());
642 TCTriple.setArchName(ArchName);
643
644 TC = new toolchains::Windows(*this, TCTriple);
645 }
646
647 return TC;
648 }
649
650 // FIXME: This is a placeholder.
651 class MinGWHostInfo : public UnknownHostInfo {
652 public:
653 MinGWHostInfo(const Driver &D, const llvm::Triple& Triple);
654 };
655
MinGWHostInfo(const Driver & D,const llvm::Triple & Triple)656 MinGWHostInfo::MinGWHostInfo(const Driver &D, const llvm::Triple& Triple)
657 : UnknownHostInfo(D, Triple) {}
658
659 } // end anon namespace
660
661 const HostInfo *
createAuroraUXHostInfo(const Driver & D,const llvm::Triple & Triple)662 clang::driver::createAuroraUXHostInfo(const Driver &D,
663 const llvm::Triple& Triple){
664 return new AuroraUXHostInfo(D, Triple);
665 }
666
667 const HostInfo *
createDarwinHostInfo(const Driver & D,const llvm::Triple & Triple)668 clang::driver::createDarwinHostInfo(const Driver &D,
669 const llvm::Triple& Triple){
670 return new DarwinHostInfo(D, Triple);
671 }
672
673 const HostInfo *
createOpenBSDHostInfo(const Driver & D,const llvm::Triple & Triple)674 clang::driver::createOpenBSDHostInfo(const Driver &D,
675 const llvm::Triple& Triple) {
676 return new OpenBSDHostInfo(D, Triple);
677 }
678
679 const HostInfo *
createFreeBSDHostInfo(const Driver & D,const llvm::Triple & Triple)680 clang::driver::createFreeBSDHostInfo(const Driver &D,
681 const llvm::Triple& Triple) {
682 return new FreeBSDHostInfo(D, Triple);
683 }
684
685 const HostInfo *
createNetBSDHostInfo(const Driver & D,const llvm::Triple & Triple)686 clang::driver::createNetBSDHostInfo(const Driver &D,
687 const llvm::Triple& Triple) {
688 return new NetBSDHostInfo(D, Triple);
689 }
690
691 const HostInfo *
createMinixHostInfo(const Driver & D,const llvm::Triple & Triple)692 clang::driver::createMinixHostInfo(const Driver &D,
693 const llvm::Triple& Triple) {
694 return new MinixHostInfo(D, Triple);
695 }
696
697 const HostInfo *
createDragonFlyHostInfo(const Driver & D,const llvm::Triple & Triple)698 clang::driver::createDragonFlyHostInfo(const Driver &D,
699 const llvm::Triple& Triple) {
700 return new DragonFlyHostInfo(D, Triple);
701 }
702
703 const HostInfo *
createLinuxHostInfo(const Driver & D,const llvm::Triple & Triple)704 clang::driver::createLinuxHostInfo(const Driver &D,
705 const llvm::Triple& Triple) {
706 return new LinuxHostInfo(D, Triple);
707 }
708
709 const HostInfo *
createTCEHostInfo(const Driver & D,const llvm::Triple & Triple)710 clang::driver::createTCEHostInfo(const Driver &D,
711 const llvm::Triple& Triple) {
712 return new TCEHostInfo(D, Triple);
713 }
714
715 const HostInfo *
createWindowsHostInfo(const Driver & D,const llvm::Triple & Triple)716 clang::driver::createWindowsHostInfo(const Driver &D,
717 const llvm::Triple& Triple) {
718 return new WindowsHostInfo(D, Triple);
719 }
720
721 const HostInfo *
createMinGWHostInfo(const Driver & D,const llvm::Triple & Triple)722 clang::driver::createMinGWHostInfo(const Driver &D,
723 const llvm::Triple& Triple) {
724 return new MinGWHostInfo(D, Triple);
725 }
726
727 const HostInfo *
createUnknownHostInfo(const Driver & D,const llvm::Triple & Triple)728 clang::driver::createUnknownHostInfo(const Driver &D,
729 const llvm::Triple& Triple) {
730 return new UnknownHostInfo(D, Triple);
731 }
732