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 | 6e20c2bd357d1ed45962253d28d2e0233f7dac6a (patch) | |
| tree | 39a02f453cad351a18adf55f92751f787e7f8e0e /clang/lib/Basic | |
| parent | df5f48ac9993a8630ce4f62f2585af4d0a4fd9e3 (diff) | |
| download | bcm5719-llvm-6e20c2bd357d1ed45962253d28d2e0233f7dac6a.tar.gz bcm5719-llvm-6e20c2bd357d1ed45962253d28d2e0233f7dac6a.zip | |
Teach Clang to reject 32-bit only CPUs when compiling in 64-bit mode.
Add 64-bit preprocessor macro tests.
llvm-svn: 140688
Diffstat (limited to 'clang/lib/Basic')
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 61 | 
1 files changed, 59 insertions, 2 deletions
| diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index b8a242bd0db..acf54b7334e 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/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; +    }    }  }; | 

