diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-09-28 09:45:08 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-09-28 09:45:08 +0000 |
commit | 26a3914eeda65e0dd6b55899f6d76ef99fc021c6 (patch) | |
tree | 9b93b149656ebfe4c4651cc8b0e46d8681ebaf5d /lib/Basic/Targets.cpp | |
parent | f17ba331e844ad0b99a35b9e4947b42967e44238 (diff) |
Teach Clang to reject 32-bit only CPUs when compiling in 64-bit mode.
Add 64-bit preprocessor macro tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Targets.cpp')
-rw-r--r-- | lib/Basic/Targets.cpp | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index b8a242bd0d..acf54b7334 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1378,8 +1378,65 @@ public: .Case("geode", CK_Geode) .Default(CK_Generic); - // FIXME: When in 64-bit mode, reject 32-bit only CPUs. - return CPU != CK_Generic; + // Perform any per-CPU checks necessary to determine if this CPU is + // acceptable. + // FIXME: This results in terrible diagnostics. Clang just says the CPU is + // invalid without explaining *why*. + switch (CPU) { + case CK_Generic: + // No processor selected! + return false; + + case CK_i386: + case CK_i486: + case CK_WinChipC6: + case CK_WinChip2: + case CK_C3: + case CK_i586: + case CK_Pentium: + case CK_PentiumMMX: + case CK_i686: + case CK_PentiumPro: + case CK_Pentium2: + case CK_Pentium3: + case CK_Pentium3M: + case CK_PentiumM: + case CK_Yonah: + case CK_C3_2: + case CK_Pentium4: + case CK_Pentium4M: + case CK_Prescott: + case CK_K6: + case CK_K6_2: + case CK_K6_3: + case CK_Athlon: + case CK_AthlonThunderbird: + case CK_Athlon4: + case CK_AthlonXP: + case CK_AthlonMP: + case CK_Geode: + // Only accept certain architectures when compiling in 32-bit mode. + if (PointerWidth != 32) + return false; + + // Fallthrough + case CK_Nocona: + case CK_Core2: + case CK_Penryn: + case CK_Atom: + case CK_Corei7: + case CK_Corei7AVX: + case CK_CoreAVXi: + case CK_Athlon64: + case CK_Athlon64SSE3: + case CK_AthlonFX: + case CK_K8: + case CK_K8SSE3: + case CK_Opteron: + case CK_OpteronSSE3: + case CK_x86_64: + return true; + } } }; |