| 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 6551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6591 Names = nullptr; | 6592 Names = nullptr; |
| 6592 NumNames = 0; | 6593 NumNames = 0; |
| 6593 } | 6594 } |
| 6594 | 6595 |
| 6595 void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, | 6596 void PNaClTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases, |
| 6596 unsigned &NumAliases) const { | 6597 unsigned &NumAliases) const { |
| 6597 Aliases = nullptr; | 6598 Aliases = nullptr; |
| 6598 NumAliases = 0; | 6599 NumAliases = 0; |
| 6599 } | 6600 } |
| 6600 | 6601 |
| 6602 namespace { |
| 6603 llvm::Target PNaClTarget; |
| 6604 llvm::RegisterTarget<llvm::Triple::le32, /*HasJIT=*/false> P( |
| 6605 PNaClTarget, "le32", "PNaCl"); |
| 6606 } // end anonymous namespace. |
| 6607 |
| 6601 // We attempt to use PNaCl (le32) frontend and Mips32EL backend. | 6608 // We attempt to use PNaCl (le32) frontend and Mips32EL backend. |
| 6602 class NaClMips32ELTargetInfo : public Mips32ELTargetInfo { | 6609 class NaClMips32ELTargetInfo : public Mips32ELTargetInfo { |
| 6603 public: | 6610 public: |
| 6604 NaClMips32ELTargetInfo(const llvm::Triple &Triple) : | 6611 NaClMips32ELTargetInfo(const llvm::Triple &Triple) : |
| 6605 Mips32ELTargetInfo(Triple) { | 6612 Mips32ELTargetInfo(Triple) { |
| 6606 } | 6613 } |
| 6607 | 6614 |
| 6608 BuiltinVaListKind getBuiltinVaListKind() const override { | 6615 BuiltinVaListKind getBuiltinVaListKind() const override { |
| 6609 return TargetInfo::PNaClABIBuiltinVaList; | 6616 return TargetInfo::PNaClABIBuiltinVaList; |
| 6610 } | 6617 } |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7302 if (!Target->handleTargetFeatures(Opts->Features, Diags)) | 7309 if (!Target->handleTargetFeatures(Opts->Features, Diags)) |
| 7303 return nullptr; | 7310 return nullptr; |
| 7304 | 7311 |
| 7305 // @LOCALMOD-START | 7312 // @LOCALMOD-START |
| 7306 if (!Target->handleLLVMArgs(Opts->LLVMArgs)) | 7313 if (!Target->handleLLVMArgs(Opts->LLVMArgs)) |
| 7307 return nullptr; | 7314 return nullptr; |
| 7308 // @LOCALMOD-END | 7315 // @LOCALMOD-END |
| 7309 | 7316 |
| 7310 return Target.release(); | 7317 return Target.release(); |
| 7311 } | 7318 } |
| OLD | NEW |