15
15
#include " clang/Basic/Builtins.h"
16
16
#include " clang/Basic/Diagnostic.h"
17
17
#include " clang/Basic/TargetBuiltins.h"
18
+ #include " llvm/ADT/StringExtras.h"
18
19
#include " llvm/ADT/StringRef.h"
19
20
#include " llvm/ADT/StringSwitch.h"
20
21
#include " llvm/Support/TargetParser.h"
@@ -1648,8 +1649,6 @@ std::string X86TargetInfo::convertConstraint(const char *&Constraint) const {
1648
1649
bool X86TargetInfo::checkCPUKind (CPUKind Kind) const {
1649
1650
// Perform any per-CPU checks necessary to determine if this CPU is
1650
1651
// acceptable.
1651
- // FIXME: This results in terrible diagnostics. Clang just says the CPU is
1652
- // invalid without explaining *why*.
1653
1652
switch (Kind) {
1654
1653
case CK_Generic:
1655
1654
// No processor selected!
@@ -1662,6 +1661,18 @@ bool X86TargetInfo::checkCPUKind(CPUKind Kind) const {
1662
1661
llvm_unreachable (" Unhandled CPU kind" );
1663
1662
}
1664
1663
1664
+ void X86TargetInfo::fillValidCPUList (SmallVectorImpl<StringRef> &Values) const {
1665
+ #define PROC (ENUM, STRING, IS64BIT ) \
1666
+ if (IS64BIT || getTriple ().getArch () == llvm::Triple::x86) \
1667
+ Values.emplace_back (STRING);
1668
+ // Go through CPUKind checking to ensure that the alias is de-aliased and
1669
+ // 64 bit-ness is checked.
1670
+ #define PROC_ALIAS (ENUM, ALIAS ) \
1671
+ if (checkCPUKind (getCPUKind (ALIAS))) \
1672
+ Values.emplace_back (ALIAS);
1673
+ #include " clang/Basic/X86Target.def"
1674
+ }
1675
+
1665
1676
X86TargetInfo::CPUKind X86TargetInfo::getCPUKind (StringRef CPU) const {
1666
1677
return llvm::StringSwitch<CPUKind>(CPU)
1667
1678
#define PROC (ENUM, STRING, IS64BIT ) .Case(STRING, CK_##ENUM)
0 commit comments