Revert "Set optimization level from -O argument when creating TargetMachine."

This reverts commit 73b3a1dbf9ef8760b9e6f335b7bbafbc21247555.
We'll use clang's parsing of -O... instead.
This commit is contained in:
Axel Naumann 2015-12-11 15:18:01 +01:00 committed by sftnight
parent fb8bc80796
commit 3f650b08c5
3 changed files with 6 additions and 28 deletions

View File

@ -43,7 +43,7 @@ using namespace llvm;
namespace cling {
IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine& diags, const int& argc, const char* const *argv):
IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine& diags):
m_CurrentAtExitModule(0)
#if 0
: m_Diags(diags)
@ -57,14 +57,14 @@ IncrementalExecutor::IncrementalExecutor(clang::DiagnosticsEngine& diags, const
// can use this object yet.
m_AtExitFuncs.reserve(256);
m_JIT.reset(new IncrementalJIT(*this, std::move(CreateHostTargetMachine(argc, argv))));
m_JIT.reset(new IncrementalJIT(*this, std::move(CreateHostTargetMachine())));
}
// Keep in source: ~unique_ptr<ClingJIT> needs ClingJIT
IncrementalExecutor::~IncrementalExecutor() {}
std::unique_ptr<TargetMachine>
IncrementalExecutor::CreateHostTargetMachine(const int& argc, const char* const *argv) const {
IncrementalExecutor::CreateHostTargetMachine() const {
// TODO: make this configurable.
Triple TheTriple(sys::getProcessTriple());
#ifdef _WIN32
@ -91,28 +91,6 @@ std::unique_ptr<TargetMachine>
CodeModel::Model CMModel = CodeModel::JITDefault;
CodeGenOpt::Level OptLevel = CodeGenOpt::Less;
for (int i = 0; i < argc; ++i) {
const std::string arg(argv[i]);
if (arg.length() != 3 || arg.rfind("-O", 0) != 0) {
continue;
}
switch (argv[i][2]) {
case '0':
OptLevel = CodeGenOpt::None;
break;
case '1':
OptLevel = CodeGenOpt::Less;
break;
case '2':
OptLevel = CodeGenOpt::Default;
break;
case '3':
OptLevel = CodeGenOpt::Aggressive;
break;
}
}
std::unique_ptr<TargetMachine> TM;
TM.reset(TheTarget->createTargetMachine(TheTriple.getTriple(),
MCPU, FeaturesStr,

View File

@ -127,7 +127,7 @@ namespace cling {
clang::DiagnosticsEngine& m_Diags;
#endif
std::unique_ptr<llvm::TargetMachine> CreateHostTargetMachine(const int& argc, const char* const *argv) const;
std::unique_ptr<llvm::TargetMachine> CreateHostTargetMachine() const;
public:
enum ExecutionResult {
@ -137,7 +137,7 @@ namespace cling {
kNumExeResults
};
IncrementalExecutor(clang::DiagnosticsEngine& diags, const int& argc, const char* const *argv);
IncrementalExecutor(clang::DiagnosticsEngine& diags);
~IncrementalExecutor();

View File

@ -193,7 +193,7 @@ namespace cling {
/*isTemp*/true), this));
if (!isInSyntaxOnlyMode())
m_Executor.reset(new IncrementalExecutor(SemaRef.Diags, argc, argv));
m_Executor.reset(new IncrementalExecutor(SemaRef.Diags));
// Tell the diagnostic client that we are entering file parsing mode.
DiagnosticConsumer& DClient = getCI()->getDiagnosticClient();