Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5610411

Browse files
committed
Back-patch LLVM 14 API changes.
Since LLVM 14 has stopped changing and is about to be released,back-patch the following changes from the master branch:e6a7600807fee1a56e7b6Back-patch to 11, where LLVM JIT support came in.
1 parentef00502 commit5610411

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

‎src/backend/jit/llvm/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ endif
2222
PGFILEDESC = "llvmjit - JIT using LLVM"
2323
NAME = llvmjit
2424

25+
# LLVM 14 produces deprecation warnings. We'll need to make some changes
26+
# before the relevant functions are removed, but for now silence the warnings.
27+
ifeq ($(GCC), yes)
28+
LLVM_CFLAGS += -Wno-deprecated-declarations
29+
endif
30+
2531
# All files in this directory use LLVM.
2632
CFLAGS +=$(LLVM_CFLAGS)
2733
CXXFLAGS +=$(LLVM_CXXFLAGS)

‎src/backend/jit/llvm/llvmjit_error.cpp

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,22 @@ extern "C"
2323

2424
#include"jit/llvmjit.h"
2525

26+
#include<new>
2627

2728
staticint fatal_new_handler_depth =0;
2829
static std::new_handler old_new_handler =NULL;
2930

3031
staticvoidfatal_system_new_handler(void);
3132
#if LLVM_VERSION_MAJOR > 4
33+
staticvoidfatal_llvm_new_handler(void *user_data,constchar *reason,bool gen_crash_diag);
34+
#if LLVM_VERSION_MAJOR < 14
3235
staticvoidfatal_llvm_new_handler(void *user_data,const std::string& reason,bool gen_crash_diag);
3336
#endif
37+
#endif
38+
staticvoidfatal_llvm_error_handler(void *user_data,constchar *reason,bool gen_crash_diag);
39+
#if LLVM_VERSION_MAJOR < 14
3440
staticvoidfatal_llvm_error_handler(void *user_data,const std::string& reason,bool gen_crash_diag);
41+
#endif
3542

3643

3744
/*
@@ -129,23 +136,41 @@ fatal_system_new_handler(void)
129136
#if LLVM_VERSION_MAJOR > 4
130137
staticvoid
131138
fatal_llvm_new_handler(void *user_data,
132-
conststd::string&reason,
139+
constchar *reason,
133140
bool gen_crash_diag)
134141
{
135142
ereport(FATAL,
136143
(errcode(ERRCODE_OUT_OF_MEMORY),
137144
errmsg("out of memory"),
138-
errdetail("While in LLVM: %s", reason.c_str())));
145+
errdetail("While in LLVM: %s", reason)));
146+
}
147+
#if LLVM_VERSION_MAJOR < 14
148+
staticvoid
149+
fatal_llvm_new_handler(void *user_data,
150+
const std::string& reason,
151+
bool gen_crash_diag)
152+
{
153+
fatal_llvm_new_handler(user_data, reason.c_str(), gen_crash_diag);
139154
}
140155
#endif
156+
#endif
141157

142158
staticvoid
143159
fatal_llvm_error_handler(void *user_data,
144-
conststd::string&reason,
160+
constchar *reason,
145161
bool gen_crash_diag)
146162
{
147163
ereport(FATAL,
148164
(errcode(ERRCODE_OUT_OF_MEMORY),
149-
errmsg("fatal llvm error: %s",
150-
reason.c_str())));
165+
errmsg("fatal llvm error: %s", reason)));
151166
}
167+
168+
#if LLVM_VERSION_MAJOR < 14
169+
staticvoid
170+
fatal_llvm_error_handler(void *user_data,
171+
const std::string& reason,
172+
bool gen_crash_diag)
173+
{
174+
fatal_llvm_error_handler(user_data, reason.c_str(), gen_crash_diag);
175+
}
176+
#endif

‎src/backend/jit/llvm/llvmjit_inline.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,11 @@ function_inlinable(llvm::Function &F,
594594
if (F.materialize())
595595
elog(FATAL,"failed to materialize metadata");
596596

597-
if (F.getAttributes().hasFnAttribute(llvm::Attribute::NoInline))
597+
#if LLVM_VERSION_MAJOR < 14
598+
#definehasFnAttr hasFnAttribute
599+
#endif
600+
601+
if (F.getAttributes().hasFnAttr(llvm::Attribute::NoInline))
598602
{
599603
ilog(DEBUG1,"ineligibile to import %s due to noinline",
600604
F.getName().data());
@@ -871,7 +875,9 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
871875
llvm::Function *AF;
872876
llvm::BasicBlock *BB;
873877
llvm::CallInst *fwdcall;
878+
#if LLVM_VERSION_MAJOR < 14
874879
llvm::Attribute inlineAttribute;
880+
#endif
875881

876882
AF =llvm::Function::Create(F->getFunctionType(),
877883
LinkageTypes::AvailableExternallyLinkage,
@@ -880,9 +886,13 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
880886

881887
Builder.SetInsertPoint(BB);
882888
fwdcall = Builder.CreateCall(F, &*AF->arg_begin());
889+
#if LLVM_VERSION_MAJOR < 14
883890
inlineAttribute =llvm::Attribute::get(Context,
884891
llvm::Attribute::AlwaysInline);
885892
fwdcall->addAttribute(~0U, inlineAttribute);
893+
#else
894+
fwdcall->addFnAttr(llvm::Attribute::AlwaysInline);
895+
#endif
886896
Builder.CreateRet(fwdcall);
887897

888898
return AF;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp