@@ -192,11 +192,7 @@ mono_llvm_build_cmpxchg (LLVMBuilderRef builder, LLVMValueRef ptr, LLVMValueRef
192192{
193193 AtomicCmpXchgInst *ins;
194194
195- #if LLVM_API_VERSION >= 1300
196195 ins = unwrap (builder)->CreateAtomicCmpXchg (unwrap (ptr), unwrap (cmp), unwrap (val), MaybeAlign (), SequentiallyConsistent, SequentiallyConsistent);
197- #else
198- ins = unwrap (builder)->CreateAtomicCmpXchg (unwrap (ptr), unwrap (cmp), unwrap (val), SequentiallyConsistent, SequentiallyConsistent);
199- #endif
200196 return wrap (ins);
201197}
202198
@@ -224,11 +220,7 @@ mono_llvm_build_atomic_rmw (LLVMBuilderRef builder, AtomicRMWOp op, LLVMValueRef
224220 break ;
225221 }
226222
227- #if LLVM_API_VERSION >= 1300
228223 ins = unwrap (builder)->CreateAtomicRMW (aop, unwrap (ptr), unwrap (val), MaybeAlign (), SequentiallyConsistent);
229- #else
230- ins = unwrap (builder)->CreateAtomicRMW (aop, unwrap (ptr), unwrap (val), SequentiallyConsistent);
231- #endif
232224 return wrap (ins);
233225}
234226
@@ -338,11 +330,7 @@ add_ret_attr (LLVMValueRef wrapped_calli, Attribute::AttrKind Kind)
338330{
339331 Instruction *calli = unwrap<Instruction> (wrapped_calli);
340332
341- #if LLVM_API_VERSION >= 1400
342333 dyn_cast<CallBase>(calli)->addRetAttr (Kind);
343- #else
344- dyn_cast<CallBase>(calli)->addAttribute (AttributeList::ReturnIndex, Kind);
345- #endif
346334}
347335
348336void
@@ -455,11 +443,7 @@ mono_llvm_set_alignment_ret (LLVMValueRef call, int alignment)
455443 Instruction *ins = unwrap<Instruction> (call);
456444 auto &ctx = ins->getContext ();
457445
458- #if LLVM_API_VERSION >= 1400
459446 dyn_cast<CallBase>(ins)->addRetAttr (Attribute::getWithAlignment (ctx, to_align (alignment)));
460- #else
461- dyn_cast<CallBase>(ins)->addAttribute (AttributeList::ReturnIndex, Attribute::getWithAlignment (ctx, to_align (alignment)));
462- #endif
463447}
464448
465449static Attribute::AttrKind
@@ -518,11 +502,7 @@ mono_llvm_add_param_attr_with_type (LLVMValueRef param, AttrKind kind, LLVMTypeR
518502
519503 switch (kind) {
520504 case LLVM_ATTR_STRUCT_RET:
521- #if LLVM_API_VERSION >= 1400
522505 func->addParamAttr (n, Attribute::getWithStructRetType (*unwrap (LLVMGetGlobalContext ()), unwrap (type)));
523- #else
524- func->addParamAttr (n, convert_attr (kind));
525- #endif
526506 break ;
527507 default :
528508 g_assert_not_reached ();
@@ -540,17 +520,12 @@ mono_llvm_add_param_byval_attr (LLVMValueRef param, LLVMTypeRef type)
540520void
541521mono_llvm_add_instr_attr (LLVMValueRef val, int index, AttrKind kind)
542522{
543- #if LLVM_API_VERSION >= 1400
544523 unwrap<CallBase> (val)->addParamAttr (index - 1 , convert_attr (kind));
545- #else
546- unwrap<CallBase> (val)->addAttribute (index, convert_attr (kind));
547- #endif
548524}
549525
550526void
551527mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind, LLVMTypeRef type)
552528{
553- #if LLVM_API_VERSION >= 1400
554529 Attribute attr;
555530
556531 switch (kind) {
@@ -561,19 +536,12 @@ mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind,
561536 default :
562537 g_assert_not_reached ();
563538 }
564- #else
565- unwrap<CallBase> (val)->addAttribute (index, convert_attr (kind));
566- #endif
567539}
568540
569541void
570542mono_llvm_add_instr_byval_attr (LLVMValueRef val, int index, LLVMTypeRef type)
571543{
572- #if LLVM_API_VERSION >= 1400
573544 unwrap<CallBase> (val)->addParamAttr (index - 1 , Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type)));
574- #else
575- unwrap<CallBase> (val)->addAttribute (index, Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type)));
576- #endif
577545}
578546
579547void *
@@ -797,27 +765,17 @@ mono_llvm_inline_asm (LLVMBuilderRef builder, LLVMTypeRef type,
797765{
798766 const auto asmstr_len = strlen (asmstr);
799767 const auto constraints_len = strlen (constraints);
800- #if LLVM_API_VERSION >= 1300
801768 const auto asmval = LLVMGetInlineAsm (type,
802769 const_cast <char *>(asmstr), asmstr_len,
803770 const_cast <char *>(constraints), constraints_len,
804771 (flags & LLVM_ASM_SIDE_EFFECT) != 0 , (flags & LLVM_ASM_ALIGN_STACK) != 0 ,
805772 LLVMInlineAsmDialectATT, TRUE );
806- #else
807- const auto asmval = LLVMGetInlineAsm (type,
808- const_cast <char *>(asmstr), asmstr_len,
809- const_cast <char *>(constraints), constraints_len,
810- (flags & LLVM_ASM_SIDE_EFFECT) != 0 , (flags & LLVM_ASM_ALIGN_STACK) != 0 ,
811- LLVMInlineAsmDialectATT);
812- #endif
813773 return LLVMBuildCall2 (builder, type, asmval, args, num_args, name);
814774}
815775
816- #if LLVM_API_VERSION >= 1400
817776LLVMTypeRef
818777mono_llvm_get_ptr_type (void )
819778{
820779 PointerType *t = PointerType::get (*unwrap (LLVMGetGlobalContext ()), 0 );
821780 return wrap (t);
822781}
823- #endif
0 commit comments