summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/SubtargetFeature.cpp
diff options
context:
space:
mode:
authorViktor Kutuzov <vkutuzov@accesssoftek.com>2009-11-18 20:20:05 +0000
committerViktor Kutuzov <vkutuzov@accesssoftek.com>2009-11-18 20:20:05 +0000
commitc3e2b6bcf5ebfe5ab40e7e0651d79a7ac7eb5eb7 (patch)
treed5663398a8ab043017fae81767ea323c7a0c09e8 /llvm/lib/Target/SubtargetFeature.cpp
parent9b33352856b68a4a3285c70c5c8791e7402493d0 (diff)
downloadbcm5719-llvm-c3e2b6bcf5ebfe5ab40e7e0651d79a7ac7eb5eb7.tar.gz
bcm5719-llvm-c3e2b6bcf5ebfe5ab40e7e0651d79a7ac7eb5eb7.zip
Added getDefaultSubtargetFeatures method to SubtargetFeatures class which returns a correct feature string for given triple.
llvm-svn: 89236
Diffstat (limited to 'llvm/lib/Target/SubtargetFeature.cpp')
-rw-r--r--llvm/lib/Target/SubtargetFeature.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/lib/Target/SubtargetFeature.cpp b/llvm/lib/Target/SubtargetFeature.cpp
index 664a43cbcca..590574ef398 100644
--- a/llvm/lib/Target/SubtargetFeature.cpp
+++ b/llvm/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("");
+}
OpenPOWER on IntegriCloud