summaryrefslogtreecommitdiff
path: root/tools/lto/LTOModule.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
commite823db8bae7fe42cd4f1fa861bec8c36a636702b (patch)
tree4db83bfe4da22d79b8b71a0d84b4401f9168a4ce /tools/lto/LTOModule.cpp
parent7cd5d3e05ca9573dbac1a01846813037f901480c (diff)
downloadllvm-e823db8bae7fe42cd4f1fa861bec8c36a636702b.tar.gz
llvm-e823db8bae7fe42cd4f1fa861bec8c36a636702b.tar.bz2
llvm-e823db8bae7fe42cd4f1fa861bec8c36a636702b.tar.xz
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 'tools/lto/LTOModule.cpp')
-rw-r--r--tools/lto/LTOModule.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index e1cf48d3c8..bce416207c 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -19,6 +19,7 @@
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/ADT/OwningPtr.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/Mangler.h"
@@ -120,27 +121,6 @@ LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length,
return makeLTOModule(buffer.get(), errMsg);
}
-/// getFeatureString - 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 getFeatureString(const char *TargetTriple) {
- InitializeAllTargets();
-
- SubtargetFeatures Features;
-
- if (strncmp(TargetTriple, "powerpc-apple-", 14) == 0) {
- Features.AddFeature("altivec", true);
- } else if (strncmp(TargetTriple, "powerpc64-apple-", 16) == 0) {
- Features.AddFeature("64bit", true);
- Features.AddFeature("altivec", true);
- }
-
- return Features.getString();
-}
-
LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
std::string& errMsg)
{
@@ -161,7 +141,8 @@ LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
return NULL;
// construct LTModule, hand over ownership of module and target
- std::string FeatureStr = getFeatureString(Triple.c_str());
+ const std::string FeatureStr =
+ SubtargetFeatures::getDefaultSubtargetFeatures(llvm::Triple(Triple));
TargetMachine* target = march->createTargetMachine(Triple, FeatureStr);
return new LTOModule(m.take(), target);
}