If a global variable has a specified alignment that is less than the preferred
[oota-llvm.git] / lib / Target / SubtargetFeature.cpp
index 035e64a017b197456e40e4cc5bbd7306892093da..3cf95b57c5dcba2f14d8699f6db4304e0bd53c23 100644 (file)
@@ -18,6 +18,7 @@
 #include <algorithm>
 #include <cassert>
 #include <cctype>
+#include <cstdlib>
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
@@ -162,7 +163,7 @@ static void Help(const SubtargetFeatureKV *CPUTable, size_t CPUTableSize,
   
   errs() << "Use +feature to enable a feature, or -feature to disable it.\n"
        << "For example, llc -mcpu=mycpu -mattr=+feature1,-feature2\n";
-  exit(1);
+  std::exit(1);
 }
 
 //===----------------------------------------------------------------------===//
@@ -370,30 +371,14 @@ void SubtargetFeatures::getDefaultSubtargetFeatures(const std::string &CPU,
                                                     const Triple& Triple) {
   setCPU(CPU);
 
-  const char *Attrs = 0;
-
-  switch (Triple.getVendor()) {
-  case Triple::Apple:
-    switch (Triple.getArch()) {
-    case Triple::ppc:   // powerpc-apple-*
-      Attrs = "altivec";
-      break;
-    case Triple::ppc64: // powerpc64-apple-*
-      Attrs = "64bit,altivec";
-      break;
-    default:
-      break;
+  if (Triple.getVendor() == Triple::Apple) {
+    if (Triple.getArch() == Triple::ppc) {
+      // powerpc-apple-*
+      AddFeature("altivec");
+    } else if (Triple.getArch() == Triple::ppc64) {
+      // powerpc64-apple-*
+      AddFeature("64bit");
+      AddFeature("altivec");
     }
-    break;
-  default:
-    break;
-  }
-
-  StringRef SR(Attrs);
-
-  while (!SR.empty()) {
-    std::pair<StringRef, StringRef> Res = SR.split(',');
-    AddFeature(Res.first);
-    SR = Res.second;
   }
 }