diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-04-06 14:26:30 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-04-06 14:26:30 +0000 |
commit | f1bd81a154c082df8aa184b536c5e3fd2368356d (patch) | |
tree | 70e0335685936ff6bc57767c880eff9afa06c0e8 /gnu | |
parent | 12c2b4ec5cf1ede574660f81565ad2764ed0c1cc (diff) |
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/llvm/tools/clang/lib/Basic/Targets/Sparc.cpp | 140 |
1 files changed, 43 insertions, 97 deletions
diff --git a/gnu/llvm/tools/clang/lib/Basic/Targets/Sparc.cpp b/gnu/llvm/tools/clang/lib/Basic/Targets/Sparc.cpp index ee4f309363a..429c1ee3a23 100644 --- a/gnu/llvm/tools/clang/lib/Basic/Targets/Sparc.cpp +++ b/gnu/llvm/tools/clang/lib/Basic/Targets/Sparc.cpp @@ -20,17 +20,9 @@ using namespace clang; using namespace clang::targets; const char *const SparcTargetInfo::GCCRegNames[] = { - // Integer registers "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", "r21", - "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", - - // Floating-point registers - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", - "f11", "f12", "f13", "f14", "f15", "f16", "f17", "f18", "f19", "f20", "f21", - "f22", "f23", "f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31", "f32", - "f34", "f36", "f38", "f40", "f42", "f44", "f46", "f48", "f50", "f52", "f54", - "f56", "f58", "f60", "f62", + "r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31" }; ArrayRef<const char *> SparcTargetInfo::getGCCRegNames() const { @@ -59,81 +51,49 @@ bool SparcTargetInfo::hasFeature(StringRef Feature) const { .Default(false); } -struct SparcCPUInfo { - llvm::StringLiteral Name; - SparcTargetInfo::CPUKind Kind; - SparcTargetInfo::CPUGeneration Generation; -}; - -static constexpr SparcCPUInfo CPUInfo[] = { - {{"v8"}, SparcTargetInfo::CK_V8, SparcTargetInfo::CG_V8}, - {{"supersparc"}, SparcTargetInfo::CK_SUPERSPARC, SparcTargetInfo::CG_V8}, - {{"sparclite"}, SparcTargetInfo::CK_SPARCLITE, SparcTargetInfo::CG_V8}, - {{"f934"}, SparcTargetInfo::CK_F934, SparcTargetInfo::CG_V8}, - {{"hypersparc"}, SparcTargetInfo::CK_HYPERSPARC, SparcTargetInfo::CG_V8}, - {{"sparclite86x"}, - SparcTargetInfo::CK_SPARCLITE86X, - SparcTargetInfo::CG_V8}, - {{"sparclet"}, SparcTargetInfo::CK_SPARCLET, SparcTargetInfo::CG_V8}, - {{"tsc701"}, SparcTargetInfo::CK_TSC701, SparcTargetInfo::CG_V8}, - {{"v9"}, SparcTargetInfo::CK_V9, SparcTargetInfo::CG_V9}, - {{"ultrasparc"}, SparcTargetInfo::CK_ULTRASPARC, SparcTargetInfo::CG_V9}, - {{"ultrasparc3"}, SparcTargetInfo::CK_ULTRASPARC3, SparcTargetInfo::CG_V9}, - {{"niagara"}, SparcTargetInfo::CK_NIAGARA, SparcTargetInfo::CG_V9}, - {{"niagara2"}, SparcTargetInfo::CK_NIAGARA2, SparcTargetInfo::CG_V9}, - {{"niagara3"}, SparcTargetInfo::CK_NIAGARA3, SparcTargetInfo::CG_V9}, - {{"niagara4"}, SparcTargetInfo::CK_NIAGARA4, SparcTargetInfo::CG_V9}, - {{"ma2100"}, SparcTargetInfo::CK_MYRIAD2100, SparcTargetInfo::CG_V8}, - {{"ma2150"}, SparcTargetInfo::CK_MYRIAD2150, SparcTargetInfo::CG_V8}, - {{"ma2155"}, SparcTargetInfo::CK_MYRIAD2155, SparcTargetInfo::CG_V8}, - {{"ma2450"}, SparcTargetInfo::CK_MYRIAD2450, SparcTargetInfo::CG_V8}, - {{"ma2455"}, SparcTargetInfo::CK_MYRIAD2455, SparcTargetInfo::CG_V8}, - {{"ma2x5x"}, SparcTargetInfo::CK_MYRIAD2x5x, SparcTargetInfo::CG_V8}, - {{"ma2080"}, SparcTargetInfo::CK_MYRIAD2080, SparcTargetInfo::CG_V8}, - {{"ma2085"}, SparcTargetInfo::CK_MYRIAD2085, SparcTargetInfo::CG_V8}, - {{"ma2480"}, SparcTargetInfo::CK_MYRIAD2480, SparcTargetInfo::CG_V8}, - {{"ma2485"}, SparcTargetInfo::CK_MYRIAD2485, SparcTargetInfo::CG_V8}, - {{"ma2x8x"}, SparcTargetInfo::CK_MYRIAD2x8x, SparcTargetInfo::CG_V8}, - // FIXME: the myriad2[.n] spellings are obsolete, - // but a grace period is needed to allow updating dependent builds. - {{"myriad2"}, SparcTargetInfo::CK_MYRIAD2x5x, SparcTargetInfo::CG_V8}, - {{"myriad2.1"}, SparcTargetInfo::CK_MYRIAD2100, SparcTargetInfo::CG_V8}, - {{"myriad2.2"}, SparcTargetInfo::CK_MYRIAD2x5x, SparcTargetInfo::CG_V8}, - {{"myriad2.3"}, SparcTargetInfo::CK_MYRIAD2x8x, SparcTargetInfo::CG_V8}, - {{"leon2"}, SparcTargetInfo::CK_LEON2, SparcTargetInfo::CG_V8}, - {{"at697e"}, SparcTargetInfo::CK_LEON2_AT697E, SparcTargetInfo::CG_V8}, - {{"at697f"}, SparcTargetInfo::CK_LEON2_AT697F, SparcTargetInfo::CG_V8}, - {{"leon3"}, SparcTargetInfo::CK_LEON3, SparcTargetInfo::CG_V8}, - {{"ut699"}, SparcTargetInfo::CK_LEON3_UT699, SparcTargetInfo::CG_V8}, - {{"gr712rc"}, SparcTargetInfo::CK_LEON3_GR712RC, SparcTargetInfo::CG_V8}, - {{"leon4"}, SparcTargetInfo::CK_LEON4, SparcTargetInfo::CG_V8}, - {{"gr740"}, SparcTargetInfo::CK_LEON4_GR740, SparcTargetInfo::CG_V8}, -}; - -SparcTargetInfo::CPUGeneration -SparcTargetInfo::getCPUGeneration(CPUKind Kind) const { - if (Kind == CK_GENERIC) - return CG_V8; - const SparcCPUInfo *Item = llvm::find_if( - CPUInfo, [Kind](const SparcCPUInfo &Info) { return Info.Kind == Kind; }); - if (Item == std::end(CPUInfo)) - llvm_unreachable("Unexpected CPU kind"); - return Item->Generation; -} - SparcTargetInfo::CPUKind SparcTargetInfo::getCPUKind(StringRef Name) const { - const SparcCPUInfo *Item = llvm::find_if( - CPUInfo, [Name](const SparcCPUInfo &Info) { return Info.Name == Name; }); - - if (Item == std::end(CPUInfo)) - return CK_GENERIC; - return Item->Kind; -} - -void SparcTargetInfo::fillValidCPUList( - SmallVectorImpl<StringRef> &Values) const { - for (const SparcCPUInfo &Info : CPUInfo) - Values.push_back(Info.Name); + return llvm::StringSwitch<CPUKind>(Name) + .Case("v8", CK_V8) + .Case("supersparc", CK_SUPERSPARC) + .Case("sparclite", CK_SPARCLITE) + .Case("f934", CK_F934) + .Case("hypersparc", CK_HYPERSPARC) + .Case("sparclite86x", CK_SPARCLITE86X) + .Case("sparclet", CK_SPARCLET) + .Case("tsc701", CK_TSC701) + .Case("v9", CK_V9) + .Case("ultrasparc", CK_ULTRASPARC) + .Case("ultrasparc3", CK_ULTRASPARC3) + .Case("niagara", CK_NIAGARA) + .Case("niagara2", CK_NIAGARA2) + .Case("niagara3", CK_NIAGARA3) + .Case("niagara4", CK_NIAGARA4) + .Case("ma2100", CK_MYRIAD2100) + .Case("ma2150", CK_MYRIAD2150) + .Case("ma2155", CK_MYRIAD2155) + .Case("ma2450", CK_MYRIAD2450) + .Case("ma2455", CK_MYRIAD2455) + .Case("ma2x5x", CK_MYRIAD2x5x) + .Case("ma2080", CK_MYRIAD2080) + .Case("ma2085", CK_MYRIAD2085) + .Case("ma2480", CK_MYRIAD2480) + .Case("ma2485", CK_MYRIAD2485) + .Case("ma2x8x", CK_MYRIAD2x8x) + // FIXME: the myriad2[.n] spellings are obsolete, + // but a grace period is needed to allow updating dependent builds. + .Case("myriad2", CK_MYRIAD2x5x) + .Case("myriad2.1", CK_MYRIAD2100) + .Case("myriad2.2", CK_MYRIAD2x5x) + .Case("myriad2.3", CK_MYRIAD2x8x) + .Case("leon2", CK_LEON2) + .Case("at697e", CK_LEON2_AT697E) + .Case("at697f", CK_LEON2_AT697F) + .Case("leon3", CK_LEON3) + .Case("ut699", CK_LEON3_UT699) + .Case("gr712rc", CK_LEON3_GR712RC) + .Case("leon4", CK_LEON4) + .Case("gr740", CK_LEON4_GR740) + .Default(CK_GENERIC); } void SparcTargetInfo::getTargetDefines(const LangOptions &Opts, @@ -218,13 +178,6 @@ void SparcV8TargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro(MyriadArchValue, "1"); Builder.defineMacro(MyriadArchValue + "__", "1"); } - if (Myriad2Value == "2") { - Builder.defineMacro("__ma2x5x", "1"); - Builder.defineMacro("__ma2x5x__", "1"); - } else if (Myriad2Value == "3") { - Builder.defineMacro("__ma2x8x", "1"); - Builder.defineMacro("__ma2x8x__", "1"); - } Builder.defineMacro("__myriad2__", Myriad2Value); Builder.defineMacro("__myriad2", Myriad2Value); } @@ -242,10 +195,3 @@ void SparcV9TargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__sparcv9__"); } } - -void SparcV9TargetInfo::fillValidCPUList( - SmallVectorImpl<StringRef> &Values) const { - for (const SparcCPUInfo &Info : CPUInfo) - if (Info.Generation == CG_V9) - Values.push_back(Info.Name); -} |