aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lto
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-08-11 00:15:13 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-08-11 00:15:13 +0000
commit2d643ef32891859ec73b6eea2959748f5ebc3af7 (patch)
tree690e4cd0d8b9bae6d4afca6b1f6c6c5056d9c8dc /tools/lto
parent4ee87398e808534577ed1be52f2b48a6130b2c0e (diff)
downloadexternal_llvm-2d643ef32891859ec73b6eea2959748f5ebc3af7.zip
external_llvm-2d643ef32891859ec73b6eea2959748f5ebc3af7.tar.gz
external_llvm-2d643ef32891859ec73b6eea2959748f5ebc3af7.tar.bz2
Make it possible to set the cpu used for codegen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r--tools/lto/LTOCodeGenerator.cpp7
-rw-r--r--tools/lto/LTOCodeGenerator.h2
-rw-r--r--tools/lto/lto.cpp8
3 files changed, 16 insertions, 1 deletions
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index 7850b5d..b69bcc3 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -119,6 +119,11 @@ bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model,
return true;
}
+void LTOCodeGenerator::setCpu(const char* mCpu)
+{
+ _mCpu = mCpu;
+}
+
void LTOCodeGenerator::setAssemblerPath(const char* path)
{
if ( _assemblerPath )
@@ -314,7 +319,7 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg)
// construct LTModule, hand over ownership of module and target
SubtargetFeatures Features;
- Features.getDefaultSubtargetFeatures("" /* cpu */, llvm::Triple(Triple));
+ Features.getDefaultSubtargetFeatures(_mCpu, llvm::Triple(Triple));
std::string FeatureStr = Features.getString();
_target = march->createTargetMachine(Triple, FeatureStr);
}
diff --git a/tools/lto/LTOCodeGenerator.h b/tools/lto/LTOCodeGenerator.h
index 9086bef..71593a5 100644
--- a/tools/lto/LTOCodeGenerator.h
+++ b/tools/lto/LTOCodeGenerator.h
@@ -36,6 +36,7 @@ struct LTOCodeGenerator {
bool addModule(struct LTOModule*, std::string& errMsg);
bool setDebugInfo(lto_debug_model, std::string& errMsg);
bool setCodePICModel(lto_codegen_model, std::string& errMsg);
+ void setCpu(const char *cpu);
void setAssemblerPath(const char* path);
void setAssemblerArgs(const char** args, int nargs);
void addMustPreserveSymbol(const char* sym);
@@ -63,6 +64,7 @@ private:
llvm::MemoryBuffer* _nativeObjectFile;
std::vector<const char*> _codegenOptions;
llvm::sys::Path* _assemblerPath;
+ std::string _mCpu;
std::vector<std::string> _assemblerArgs;
};
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index 703447b..a7ce2a0 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -211,6 +211,14 @@ bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model)
}
//
+// sets the cpu to generate code for
+//
+void lto_codegen_set_cpu(lto_code_gen_t cg, const char* cpu)
+{
+ return cg->setCpu(cpu);
+}
+
+//
// sets the path to the assembler tool
//
void lto_codegen_set_assembler_path(lto_code_gen_t cg, const char* path)