Skip to content

Commit 18963da

Browse files
committed
Build LLVM wrap getDeclaration by version
1 parent 7ca184a commit 18963da

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rpcs3/Emu/CPU/CPUTranslator.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,11 @@ struct llvm_fshl
11491149
static llvm::Function* get_fshl(llvm::IRBuilder<>* ir)
11501150
{
11511151
const auto _module = ir->GetInsertBlock()->getParent()->getParent();
1152+
#if LLVM_VERSION_MAJOR >= 21 || (LLVM_VERSION_MAJOR == 20 && LLVM_VERSION_MINOR >= 1)
11521153
return llvm::Intrinsic::getOrInsertDeclaration(_module, llvm::Intrinsic::fshl, {llvm_value_t<T>::get_type(ir->getContext())});
1154+
#else
1155+
return llvm::Intrinsic::getDeclaration(_module, llvm::Intrinsic::fshl, {llvm_value_t<T>::get_type(ir->getContext())});
1156+
#endif
11531157
}
11541158

11551159
static llvm::Value* fold(llvm::IRBuilder<>* ir, llvm::Value* v1, llvm::Value* v2, llvm::Value* v3)
@@ -1221,7 +1225,11 @@ struct llvm_fshr
12211225
static llvm::Function* get_fshr(llvm::IRBuilder<>* ir)
12221226
{
12231227
const auto _module = ir->GetInsertBlock()->getParent()->getParent();
1228+
#if LLVM_VERSION_MAJOR >= 21 || (LLVM_VERSION_MAJOR == 20 && LLVM_VERSION_MINOR >= 1)
12241229
return llvm::Intrinsic::getOrInsertDeclaration(_module, llvm::Intrinsic::fshr, {llvm_value_t<T>::get_type(ir->getContext())});
1230+
#else
1231+
return llvm::Intrinsic::getDeclaration(_module, llvm::Intrinsic::fshr, {llvm_value_t<T>::get_type(ir->getContext())});
1232+
#endif
12251233
}
12261234

12271235
static llvm::Value* fold(llvm::IRBuilder<>* ir, llvm::Value* v1, llvm::Value* v2, llvm::Value* v3)
@@ -2220,7 +2228,11 @@ struct llvm_add_sat
22202228
static llvm::Function* get_add_sat(llvm::IRBuilder<>* ir)
22212229
{
22222230
const auto _module = ir->GetInsertBlock()->getParent()->getParent();
2231+
#if LLVM_VERSION_MAJOR >= 21 || (LLVM_VERSION_MAJOR == 20 && LLVM_VERSION_MINOR >= 1)
22232232
return llvm::Intrinsic::getOrInsertDeclaration(_module, intr, {llvm_value_t<T>::get_type(ir->getContext())});
2233+
#else
2234+
return llvm::Intrinsic::getDeclaration(_module, intr, {llvm_value_t<T>::get_type(ir->getContext())});
2235+
#endif
22242236
}
22252237

22262238
llvm::Value* eval(llvm::IRBuilder<>* ir) const
@@ -2303,7 +2315,11 @@ struct llvm_sub_sat
23032315
static llvm::Function* get_sub_sat(llvm::IRBuilder<>* ir)
23042316
{
23052317
const auto _module = ir->GetInsertBlock()->getParent()->getParent();
2318+
#if LLVM_VERSION_MAJOR >= 21 || (LLVM_VERSION_MAJOR == 20 && LLVM_VERSION_MINOR >= 1)
23062319
return llvm::Intrinsic::getOrInsertDeclaration(_module, intr, {llvm_value_t<T>::get_type(ir->getContext())});
2320+
#else
2321+
return llvm::Intrinsic::getDeclaration(_module, intr, {llvm_value_t<T>::get_type(ir->getContext())});
2322+
#endif
23072323
}
23082324

23092325
llvm::Value* eval(llvm::IRBuilder<>* ir) const
@@ -3592,7 +3608,11 @@ class cpu_translator
35923608
llvm::Function* get_intrinsic(llvm::Intrinsic::ID id)
35933609
{
35943610
const auto _module = m_ir->GetInsertBlock()->getParent()->getParent();
3611+
#if LLVM_VERSION_MAJOR >= 21 || (LLVM_VERSION_MAJOR == 20 && LLVM_VERSION_MINOR >= 1)
35953612
return llvm::Intrinsic::getOrInsertDeclaration(_module, id, {get_type<Types>()...});
3613+
#else
3614+
return llvm::Intrinsic::getDeclaration(_module, id, {get_type<Types>()...});
3615+
#endif
35963616
}
35973617

35983618
template <typename T1, typename T2>

0 commit comments

Comments
 (0)