OLD | NEW |
1 //===--- Targets.cpp - Implement -arch option and targets -----------------===// | 1 //===--- Targets.cpp - Implement -arch option and targets -----------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements construction of a TargetInfo object from a | 10 // This file implements construction of a TargetInfo object from a |
11 // target triple. | 11 // target triple. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
15 #include "clang/Basic/TargetInfo.h" | 15 #include "clang/Basic/TargetInfo.h" |
16 #include "clang/Basic/Builtins.h" | 16 #include "clang/Basic/Builtins.h" |
17 #include "clang/Basic/Diagnostic.h" | 17 #include "clang/Basic/Diagnostic.h" |
18 #include "clang/Basic/LangOptions.h" | 18 #include "clang/Basic/LangOptions.h" |
19 #include "clang/Basic/MacroBuilder.h" | 19 #include "clang/Basic/MacroBuilder.h" |
20 #include "clang/Basic/TargetBuiltins.h" | 20 #include "clang/Basic/TargetBuiltins.h" |
21 #include "clang/Basic/TargetOptions.h" | 21 #include "clang/Basic/TargetOptions.h" |
22 #include "llvm/ADT/APFloat.h" | 22 #include "llvm/ADT/APFloat.h" |
23 #include "llvm/ADT/STLExtras.h" | 23 #include "llvm/ADT/STLExtras.h" |
24 #include "llvm/ADT/StringExtras.h" | 24 #include "llvm/ADT/StringExtras.h" |
25 #include "llvm/ADT/StringRef.h" | 25 #include "llvm/ADT/StringRef.h" |
26 #include "llvm/ADT/StringSwitch.h" | 26 #include "llvm/ADT/StringSwitch.h" |
27 #include "llvm/ADT/Triple.h" | 27 #include "llvm/ADT/Triple.h" |
28 #include "llvm/MC/MCSectionMachO.h" | 28 #include "llvm/MC/MCSectionMachO.h" |
29 #include "llvm/Support/ErrorHandling.h" | 29 #include "llvm/Support/ErrorHandling.h" |
| 30 #include "llvm/Support/TargetRegistry.h" // @LOCALMOD |
30 #include <algorithm> | 31 #include <algorithm> |
31 #include <memory> | 32 #include <memory> |
32 using namespace clang; | 33 using namespace clang; |
33 | 34 |
34 //===----------------------------------------------------------------------===// | 35 //===----------------------------------------------------------------------===// |
35 // Common code shared among targets. | 36 // Common code shared among targets. |
36 //===----------------------------------------------------------------------===// | 37 //===----------------------------------------------------------------------===// |
37 | 38 |
38 /// DefineStd - Define a macro name and standard variants. For example if | 39 /// DefineStd - Define a macro name and standard variants. For example if |
39 /// MacroName is "unix", then this will define "__unix", "__unix__", and "unix" | 40 /// MacroName is "unix", then this will define "__unix", "__unix__", and "unix" |
(...skipping 6443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6483 Names = nullptr; | 6484 Names = nullptr; |
6484 NumNames = 0; | 6485 NumNames = 0; |
6485 } | 6486 } |
6486 | 6487 |
6487 void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, | 6488 void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, |
6488 unsigned &NumAliases) const { | 6489 unsigned &NumAliases) const { |
6489 Aliases = nullptr; | 6490 Aliases = nullptr; |
6490 NumAliases = 0; | 6491 NumAliases = 0; |
6491 } | 6492 } |
6492 | 6493 |
| 6494 namespace { |
| 6495 llvm::Target PNaClTarget; |
| 6496 llvm::RegisterTarget<llvm::Triple::le32, /*HasJIT=*/false> P( |
| 6497 PNaClTarget, "le32", "PNaCl"); |
| 6498 } // end anonymous namespace. |
| 6499 |
6493 // We attempt to use PNaCl (le32) frontend and Mips32EL backend. | 6500 // We attempt to use PNaCl (le32) frontend and Mips32EL backend. |
6494 class NaClMips32ELTargetInfo : public Mips32ELTargetInfo { | 6501 class NaClMips32ELTargetInfo : public Mips32ELTargetInfo { |
6495 public: | 6502 public: |
6496 NaClMips32ELTargetInfo(const llvm::Triple &Triple) : | 6503 NaClMips32ELTargetInfo(const llvm::Triple &Triple) : |
6497 Mips32ELTargetInfo(Triple) { | 6504 Mips32ELTargetInfo(Triple) { |
6498 } | 6505 } |
6499 | 6506 |
6500 BuiltinVaListKind getBuiltinVaListKind() const override { | 6507 BuiltinVaListKind getBuiltinVaListKind() const override { |
6501 return TargetInfo::PNaClABIBuiltinVaList; | 6508 return TargetInfo::PNaClABIBuiltinVaList; |
6502 } | 6509 } |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7184 if (!Target->handleTargetFeatures(Opts->Features, Diags)) | 7191 if (!Target->handleTargetFeatures(Opts->Features, Diags)) |
7185 return nullptr; | 7192 return nullptr; |
7186 | 7193 |
7187 // @LOCALMOD-START | 7194 // @LOCALMOD-START |
7188 if (!Target->handleLLVMArgs(Opts->LLVMArgs)) | 7195 if (!Target->handleLLVMArgs(Opts->LLVMArgs)) |
7189 return nullptr; | 7196 return nullptr; |
7190 // @LOCALMOD-END | 7197 // @LOCALMOD-END |
7191 | 7198 |
7192 return Target.release(); | 7199 return Target.release(); |
7193 } | 7200 } |
OLD | NEW |