Skip to content

Commit

Permalink
Update CodeGenOpt to CodeGenOptLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentrik committed Jul 21, 2024
1 parent 1b012a9 commit 3f21a13
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/aotcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,11 @@ void jl_dump_native_impl(void *native_code,
jl_ExecutionEngine->getTargetOptions(),
RelocModel,
CMModel,
#if JL_LLVM_VERSION >= 180000
CodeGenOptLevel::Aggressive // -O3 TODO: respect command -O0 flag?
#else
CodeGenOpt::Aggressive // -O3 TODO: respect command -O0 flag?
#endif
));
fixupTM(*SourceTM);
auto DL = jl_create_datalayout(*SourceTM);
Expand Down
14 changes: 14 additions & 0 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,19 @@ jl_value_t *jl_dump_method_asm_impl(jl_method_instance_t *mi, size_t world,
return jl_an_empty_string;
}

#if JL_LLVM_VERSION >= 180000
CodeGenOptLevel CodeGenOptLevelFor(int optlevel)
{
#ifdef DISABLE_OPT
return CodeGenOptLevel::None;
#else
return optlevel == 0 ? CodeGenOptLevel::None :
optlevel == 1 ? CodeGenOptLevel::Less :
optlevel == 2 ? CodeGenOptLevel::Default :
CodeGenOptLevel::Aggressive;
#endif
}
#else
CodeGenOpt::Level CodeGenOptLevelFor(int optlevel)
{
#ifdef DISABLE_OPT
Expand All @@ -579,6 +592,7 @@ CodeGenOpt::Level CodeGenOptLevelFor(int optlevel)
CodeGenOpt::Aggressive;
#endif
}
#endif

static auto countBasicBlocks(const Function &F) JL_NOTSAFEPOINT
{
Expand Down
5 changes: 5 additions & 0 deletions src/jitlayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "julia_internal.h"
#include "platform.h"
#include "llvm-codegen-shared.h"
#include "llvm-version.h"
#include <stack>
#include <queue>

Expand Down Expand Up @@ -644,4 +645,8 @@ void optimizeDLSyms(Module &M);
// NewPM
#include "passes.h"

#if JL_LLVM_VERSION >= 180000
CodeGenOptLevel CodeGenOptLevelFor(int optlevel) JL_NOTSAFEPOINT;
#else
CodeGenOpt::Level CodeGenOptLevelFor(int optlevel) JL_NOTSAFEPOINT;
#endif

0 comments on commit 3f21a13

Please sign in to comment.