diff options
author | dim <dim@FreeBSD.org> | 2015-06-21 14:00:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-06-21 14:00:56 +0000 |
commit | 9dd834653b811ad20382e98a87dff824980c9916 (patch) | |
tree | a764184c2fc9486979b074250b013a0937ee64e5 /lib/Basic | |
parent | bb9760db9b86e93a638ed430d0a14785f7ff9064 (diff) | |
download | FreeBSD-src-9dd834653b811ad20382e98a87dff824980c9916.zip FreeBSD-src-9dd834653b811ad20382e98a87dff824980c9916.tar.gz |
Vendor import of clang trunk r240225:
https://llvm.org/svn/llvm-project/cfe/trunk@240225
Diffstat (limited to 'lib/Basic')
-rw-r--r-- | lib/Basic/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 12 | ||||
-rw-r--r-- | lib/Basic/DiagnosticOptions.cpp | 24 | ||||
-rw-r--r-- | lib/Basic/FileSystemStatCache.cpp | 11 | ||||
-rw-r--r-- | lib/Basic/IdentifierTable.cpp | 15 | ||||
-rw-r--r-- | lib/Basic/OpenMPKinds.cpp | 1 | ||||
-rw-r--r-- | lib/Basic/Sanitizers.cpp | 4 | ||||
-rw-r--r-- | lib/Basic/Targets.cpp | 103 |
8 files changed, 136 insertions, 35 deletions
diff --git a/lib/Basic/CMakeLists.txt b/lib/Basic/CMakeLists.txt index 50a06d9..cfad8c3 100644 --- a/lib/Basic/CMakeLists.txt +++ b/lib/Basic/CMakeLists.txt @@ -61,6 +61,7 @@ add_clang_library(clangBasic CharInfo.cpp Diagnostic.cpp DiagnosticIDs.cpp + DiagnosticOptions.cpp FileManager.cpp FileSystemStatCache.cpp IdentifierTable.cpp diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 1992804..7f5a15d 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -321,18 +321,10 @@ void DiagnosticsEngine::Report(const StoredDiagnostic &storedDiag) { NumDiagArgs = 0; DiagRanges.clear(); - DiagRanges.reserve(storedDiag.range_size()); - for (StoredDiagnostic::range_iterator - RI = storedDiag.range_begin(), - RE = storedDiag.range_end(); RI != RE; ++RI) - DiagRanges.push_back(*RI); + DiagRanges.append(storedDiag.range_begin(), storedDiag.range_end()); DiagFixItHints.clear(); - DiagFixItHints.reserve(storedDiag.fixit_size()); - for (StoredDiagnostic::fixit_iterator - FI = storedDiag.fixit_begin(), - FE = storedDiag.fixit_end(); FI != FE; ++FI) - DiagFixItHints.push_back(*FI); + DiagFixItHints.append(storedDiag.fixit_begin(), storedDiag.fixit_end()); assert(Client && "DiagnosticConsumer not set!"); Level DiagLevel = storedDiag.getLevel(); diff --git a/lib/Basic/DiagnosticOptions.cpp b/lib/Basic/DiagnosticOptions.cpp new file mode 100644 index 0000000..f54a0ef --- /dev/null +++ b/lib/Basic/DiagnosticOptions.cpp @@ -0,0 +1,24 @@ +//===--- DiagnosticOptions.cpp - C Language Family Diagnostic Handling ----===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the DiagnosticOptions related interfaces. +// +//===----------------------------------------------------------------------===// + +#include "clang/Basic/DiagnosticOptions.h" +#include "llvm/Support/raw_ostream.h" + +namespace clang { + +raw_ostream& operator<<(raw_ostream& Out, DiagnosticLevelMask M) { + using UT = std::underlying_type<DiagnosticLevelMask>::type; + return Out << static_cast<UT>(M); +} + +} // end namespace clang diff --git a/lib/Basic/FileSystemStatCache.cpp b/lib/Basic/FileSystemStatCache.cpp index 83e42bd..187ea37 100644 --- a/lib/Basic/FileSystemStatCache.cpp +++ b/lib/Basic/FileSystemStatCache.cpp @@ -15,19 +15,8 @@ #include "clang/Basic/VirtualFileSystem.h" #include "llvm/Support/Path.h" -// FIXME: This is terrible, we need this for ::close. -#if !defined(_MSC_VER) && !defined(__MINGW32__) -#include <unistd.h> -#include <sys/uio.h> -#else -#include <io.h> -#endif using namespace clang; -#if defined(_MSC_VER) -#define S_ISDIR(s) ((_S_IFDIR & s) !=0) -#endif - void FileSystemStatCache::anchor() { } static void copyStatusToFileData(const vfs::Status &Status, diff --git a/lib/Basic/IdentifierTable.cpp b/lib/Basic/IdentifierTable.cpp index 4e06352..b295008 100644 --- a/lib/Basic/IdentifierTable.cpp +++ b/lib/Basic/IdentifierTable.cpp @@ -16,6 +16,7 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Basic/LangOptions.h" #include "clang/Basic/OperatorKinds.h" +#include "clang/Basic/Specifiers.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/SmallString.h" @@ -645,3 +646,17 @@ const char *clang::getOperatorSpelling(OverloadedOperatorKind Operator) { llvm_unreachable("Invalid OverloadedOperatorKind!"); } + +StringRef clang::getNullabilitySpelling(NullabilityKind kind) { + switch (kind) { + case NullabilityKind::NonNull: + return "__nonnull"; + + case NullabilityKind::Nullable: + return "__nullable"; + + case NullabilityKind::Unspecified: + return "__null_unspecified"; + } + llvm_unreachable("Unknown nullability kind."); +} diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index b83a069..b2798b7 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -332,6 +332,7 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, case OMPD_taskyield: case OMPD_barrier: case OMPD_taskwait: + case OMPD_taskgroup: case OMPD_ordered: break; } diff --git a/lib/Basic/Sanitizers.cpp b/lib/Basic/Sanitizers.cpp index 8c4884b..d3676b6 100644 --- a/lib/Basic/Sanitizers.cpp +++ b/lib/Basic/Sanitizers.cpp @@ -25,6 +25,10 @@ bool SanitizerSet::has(SanitizerMask K) const { return Mask & K; } +bool SanitizerSet::hasOneOf(SanitizerMask K) const { + return Mask & K; +} + void SanitizerSet::set(SanitizerMask K, bool Value) { assert(llvm::countPopulation(K) == 1); Mask = Value ? (Mask | K) : (Mask & ~K); diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index c0c6924..076b04b 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -992,6 +992,12 @@ public: bool hasSjLjLowering() const override { return true; } + + bool useFloat128ManglingForLongDouble() const override { + return LongDoubleWidth == 128 && + LongDoubleFormat == &llvm::APFloat::PPCDoubleDouble && + getTriple().isOSBinFormatELF(); + } }; const Builtin::Info PPCTargetInfo::BuiltinInfo[] = { @@ -1661,7 +1667,7 @@ public: } }; -static const unsigned R600AddrSpaceMap[] = { +static const unsigned AMDGPUAddrSpaceMap[] = { 1, // opencl_global 3, // opencl_local 2, // opencl_constant @@ -1687,11 +1693,11 @@ static const char *DescriptionStringSI = "-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128" "-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"; -class R600TargetInfo : public TargetInfo { +class AMDGPUTargetInfo : public TargetInfo { static const Builtin::Info BuiltinInfo[]; static const char * const GCCRegNames[]; - /// \brief The GPU profiles supported by the R600 target. + /// \brief The GPU profiles supported by the AMDGPU target. enum GPUKind { GK_NONE, GK_R600, @@ -1703,7 +1709,8 @@ class R600TargetInfo : public TargetInfo { GK_NORTHERN_ISLANDS, GK_CAYMAN, GK_SOUTHERN_ISLANDS, - GK_SEA_ISLANDS + GK_SEA_ISLANDS, + GK_VOLCANIC_ISLANDS } GPU; bool hasFP64:1; @@ -1711,8 +1718,8 @@ class R600TargetInfo : public TargetInfo { bool hasLDEXPF:1; public: - R600TargetInfo(const llvm::Triple &Triple) - : TargetInfo(Triple) { + AMDGPUTargetInfo(const llvm::Triple &Triple) + : TargetInfo(Triple) { if (Triple.getArch() == llvm::Triple::amdgcn) { DescriptionString = DescriptionStringSI; @@ -1727,7 +1734,7 @@ public: hasFMAF = false; hasLDEXPF = false; } - AddrSpaceMap = &R600AddrSpaceMap; + AddrSpaceMap = &AMDGPUAddrSpaceMap; UseAddrSpaceMapMangling = true; } @@ -1766,7 +1773,7 @@ public: void getTargetBuiltins(const Builtin::Info *&Records, unsigned &NumRecords) const override { Records = BuiltinInfo; - NumRecords = clang::R600::LastTSBuiltin - Builtin::FirstTSBuiltin; + NumRecords = clang::AMDGPU::LastTSBuiltin - Builtin::FirstTSBuiltin; } void getTargetDefines(const LangOptions &Opts, @@ -1822,6 +1829,9 @@ public: .Case("kaveri", GK_SEA_ISLANDS) .Case("hawaii", GK_SEA_ISLANDS) .Case("mullins", GK_SEA_ISLANDS) + .Case("tonga", GK_VOLCANIC_ISLANDS) + .Case("iceland", GK_VOLCANIC_ISLANDS) + .Case("carrizo", GK_VOLCANIC_ISLANDS) .Default(GK_NONE); if (GPU == GK_NONE) { @@ -1851,6 +1861,7 @@ public: break; case GK_SOUTHERN_ISLANDS: case GK_SEA_ISLANDS: + case GK_VOLCANIC_ISLANDS: DescriptionString = DescriptionStringSI; hasFP64 = true; hasFMAF = true; @@ -1862,12 +1873,12 @@ public: } }; -const Builtin::Info R600TargetInfo::BuiltinInfo[] = { +const Builtin::Info AMDGPUTargetInfo::BuiltinInfo[] = { #define BUILTIN(ID, TYPE, ATTRS) \ { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES }, -#include "clang/Basic/BuiltinsR600.def" +#include "clang/Basic/BuiltinsAMDGPU.def" }; -const char * const R600TargetInfo::GCCRegNames[] = { +const char * const AMDGPUTargetInfo::GCCRegNames[] = { "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", @@ -1920,8 +1931,8 @@ const char * const R600TargetInfo::GCCRegNames[] = { "vcc_lo", "vcc_hi", "flat_scr_lo", "flat_scr_hi" }; -void R600TargetInfo::getGCCRegNames(const char * const *&Names, - unsigned &NumNames) const { +void AMDGPUTargetInfo::getGCCRegNames(const char * const *&Names, + unsigned &NumNames) const { Names = GCCRegNames; NumNames = llvm::array_lengthof(GCCRegNames); } @@ -5688,6 +5699,10 @@ public: return "vector"; return ""; } + + bool useFloat128ManglingForLongDouble() const override { + return true; + } }; const Builtin::Info SystemZTargetInfo::BuiltinInfo[] = { @@ -5890,6 +5905,60 @@ validateAsmConstraint(const char *&Name, unsigned &NumAliases) const override {} }; +class BPFTargetInfo : public TargetInfo { +public: + BPFTargetInfo(const llvm::Triple &Triple) : TargetInfo(Triple) { + LongWidth = LongAlign = PointerWidth = PointerAlign = 64; + SizeType = UnsignedLong; + PtrDiffType = SignedLong; + IntPtrType = SignedLong; + IntMaxType = SignedLong; + Int64Type = SignedLong; + RegParmMax = 5; + if (Triple.getArch() == llvm::Triple::bpfeb) { + BigEndian = true; + DescriptionString = "E-m:e-p:64:64-i64:64-n32:64-S128"; + } else { + BigEndian = false; + DescriptionString = "e-m:e-p:64:64-i64:64-n32:64-S128"; + } + MaxAtomicPromoteWidth = 64; + MaxAtomicInlineWidth = 64; + TLSSupported = false; + } + void getTargetDefines(const LangOptions &Opts, + MacroBuilder &Builder) const override { + DefineStd(Builder, "bpf", Opts); + Builder.defineMacro("__BPF__"); + } + bool hasFeature(StringRef Feature) const override { + return Feature == "bpf"; + } + + void getTargetBuiltins(const Builtin::Info *&Records, + unsigned &NumRecords) const override {} + const char *getClobbers() const override { + return ""; + } + BuiltinVaListKind getBuiltinVaListKind() const override { + return TargetInfo::VoidPtrBuiltinVaList; + } + void getGCCRegNames(const char * const *&Names, + unsigned &NumNames) const override { + Names = nullptr; + NumNames = 0; + } + bool validateAsmConstraint(const char *&Name, + TargetInfo::ConstraintInfo &info) const override { + return true; + } + void getGCCRegAliases(const GCCRegAlias *&Aliases, + unsigned &NumAliases) const override { + Aliases = nullptr; + NumAliases = 0; + } +}; + class MipsTargetInfoBase : public TargetInfo { virtual void setDescriptionString() = 0; @@ -6888,6 +6957,10 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) { return new ARMbeTargetInfo(Triple); } + case llvm::Triple::bpfeb: + case llvm::Triple::bpfel: + return new BPFTargetInfo(Triple); + case llvm::Triple::msp430: return new MSP430TargetInfo(Triple); @@ -7015,7 +7088,7 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) { case llvm::Triple::amdgcn: case llvm::Triple::r600: - return new R600TargetInfo(Triple); + return new AMDGPUTargetInfo(Triple); case llvm::Triple::sparc: switch (os) { @@ -7080,6 +7153,8 @@ static TargetInfo *AllocateTarget(const llvm::Triple &Triple) { return new DarwinI386TargetInfo(Triple); switch (os) { + case llvm::Triple::CloudABI: + return new CloudABITargetInfo<X86_32TargetInfo>(Triple); case llvm::Triple::Linux: { switch (Triple.getEnvironment()) { default: |