diff options
| author | Bill Wendling <isanbard@gmail.com> | 2010-05-11 20:46:04 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2010-05-11 20:46:04 +0000 |
| commit | 508f661fbef09e517265313c0ba3a1835ea08459 (patch) | |
| tree | cad517e05113d302d78af8ae804e06fdbc48da59 /llvm/lib | |
| parent | 6f12a7f252f3684702fb1b71d5bbb10705f0e091 (diff) | |
| download | bcm5719-llvm-508f661fbef09e517265313c0ba3a1835ea08459.tar.gz bcm5719-llvm-508f661fbef09e517265313c0ba3a1835ea08459.zip | |
Simplify this logic of creating a default Features object.
llvm-svn: 103507
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/SubtargetFeature.cpp | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/llvm/lib/Target/SubtargetFeature.cpp b/llvm/lib/Target/SubtargetFeature.cpp index 113cd5b7b3e..b35190a369e 100644 --- a/llvm/lib/Target/SubtargetFeature.cpp +++ b/llvm/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; } } |

