aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/SubtargetFeature.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-05-11 20:46:04 +0000
committerBill Wendling <isanbard@gmail.com>2010-05-11 20:46:04 +0000
commitf6d8481adad4b763a380186ea62637df2d480c99 (patch)
tree9f9999e901201dad59c32cf6c60bf12c529b602b /lib/Target/SubtargetFeature.cpp
parent82b07dc4995d48065bd95affff4d8513a5cad4f2 (diff)
Simplify this logic of creating a default Features object.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103507 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SubtargetFeature.cpp')
-rw-r--r--lib/Target/SubtargetFeature.cpp34
1 files changed, 8 insertions, 26 deletions
diff --git a/lib/Target/SubtargetFeature.cpp b/lib/Target/SubtargetFeature.cpp
index 113cd5b7b3..b35190a369 100644
--- a/lib/Target/SubtargetFeature.cpp
+++ b/lib/Target/SubtargetFeature.cpp
@@ -370,32 +370,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;
- }
-
- if (!Attrs) return;
-
- StringRef SR(Attrs);
-
- while (!SR.empty()) {
- std::pair<StringRef, StringRef> Res = SR.split(',');
- AddFeature(Res.first);
- SR = Res.second;
}
}