diff options
author | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2009-11-18 20:20:05 +0000 |
---|---|---|
committer | Viktor Kutuzov <vkutuzov@accesssoftek.com> | 2009-11-18 20:20:05 +0000 |
commit | e823db8bae7fe42cd4f1fa861bec8c36a636702b (patch) | |
tree | 4db83bfe4da22d79b8b71a0d84b4401f9168a4ce /lib/Target/SubtargetFeature.cpp | |
parent | 7cd5d3e05ca9573dbac1a01846813037f901480c (diff) |
Added getDefaultSubtargetFeatures method to SubtargetFeatures class which returns a correct feature string for given triple.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89236 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SubtargetFeature.cpp')
-rw-r--r-- | lib/Target/SubtargetFeature.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Target/SubtargetFeature.cpp b/lib/Target/SubtargetFeature.cpp index 664a43cbcc..590574ef39 100644 --- a/lib/Target/SubtargetFeature.cpp +++ b/lib/Target/SubtargetFeature.cpp @@ -357,3 +357,30 @@ void SubtargetFeatures::print(raw_ostream &OS) const { void SubtargetFeatures::dump() const { print(errs()); } + +/// getDefaultSubtargetFeatures - Return a string listing +/// the features associated with the target triple. +/// +/// FIXME: This is an inelegant way of specifying the features of a +/// subtarget. It would be better if we could encode this information +/// into the IR. See <rdar://5972456>. +/// +std::string SubtargetFeatures::getDefaultSubtargetFeatures( + const Triple& Triple) { + switch (Triple.getVendor()) { + case Triple::Apple: + switch (Triple.getArch()) { + case Triple::ppc: // powerpc-apple-* + return std::string("altivec"); + case Triple::ppc64: // powerpc64-apple-* + return std::string("64bit,altivec"); + default: + break; + } + break; + default: + break; + } + + return std::string(""); +} |