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 May 4, 2024
1 parent cfaba7a commit 026dc74
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 @@ -607,6 +607,19 @@ jl_value_t *jl_dump_method_asm_impl(jl_method_instance_t *mi, size_t world,
return jl_dump_function_asm(&llvmf_dump, emit_mc, asm_variant, debuginfo, binary, false);
}

#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 @@ -618,6 +631,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 @@ -642,4 +643,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 026dc74

Please sign in to comment.