aot compiler: Some updates for LLVM 18 (#2981)

Note: This commit includes copy-and-paste from LLVM and thus adds
the LLVM copyright notice.

cf. 0a1aa6cda2
cf. a1e9777b76
cf. 56c72c7f33
This commit is contained in:
YAMAMOTO Takashi
2024-01-08 11:15:31 +09:00
committed by GitHub
parent c39214e8a5
commit 722381fcf2
3 changed files with 50 additions and 1 deletions

View File

@ -58,6 +58,7 @@ convert(LLVMRelocMode reloc_mode)
#endif
}
#if LLVM_VERSION_MAJOR < 18
static llvm::CodeGenOpt::Level
convert(LLVMCodeGenOptLevel opt_level)
{
@ -74,6 +75,24 @@ convert(LLVMCodeGenOptLevel opt_level)
bh_assert(0);
return llvm::CodeGenOpt::None;
}
#else
static llvm::CodeGenOptLevel
convert(LLVMCodeGenOptLevel opt_level)
{
switch (opt_level) {
case LLVMCodeGenLevelNone:
return llvm::CodeGenOptLevel::None;
case LLVMCodeGenLevelLess:
return llvm::CodeGenOptLevel::Less;
case LLVMCodeGenLevelDefault:
return llvm::CodeGenOptLevel::Default;
case LLVMCodeGenLevelAggressive:
return llvm::CodeGenOptLevel::Aggressive;
}
bh_assert(0);
return llvm::CodeGenOptLevel::None;
}
#endif
static llvm::Optional<llvm::CodeModel::Model>
convert(LLVMCodeModel code_model, bool *jit)