@@ -166,17 +166,9 @@ static Value *runtime_sym_lookup(PointerType *funcptype, const char *f_lib,
166
166
else {
167
167
libname = literal_static_pointer_val (f_lib, T_pint8);
168
168
}
169
- #if JL_LLVM_VERSION >= 30700
170
169
Value *llvmf = builder.CreateCall (prepare_call (builder, jldlsym_func), { libname, stringConstPtr (builder, f_name), libptrgv });
171
- #else
172
- Value *llvmf = builder.CreateCall3 (prepare_call (builder, jldlsym_func), libname, stringConstPtr (builder, f_name), libptrgv);
173
- #endif
174
170
auto store = builder.CreateAlignedStore (llvmf, llvmgv, sizeof (void *));
175
- # if JL_LLVM_VERSION >= 30900
176
171
store->setAtomic (AtomicOrdering::Release);
177
- # else
178
- store->setAtomic (Release);
179
- # endif
180
172
builder.CreateBr (ccall_bb);
181
173
182
174
f->getBasicBlockList ().push_back (ccall_bb);
@@ -254,11 +246,7 @@ static GlobalVariable *emit_plt_thunk(Module *M, FunctionType *functype,
254
246
Value *ptr = runtime_sym_lookup (funcptype, f_lib, f_name, plt, libptrgv,
255
247
llvmgv, runtime_lib);
256
248
auto store = builder.CreateAlignedStore (builder.CreateBitCast (ptr, T_pvoidfunc), got, sizeof (void *));
257
- #if JL_LLVM_VERSION >= 30900
258
249
store->setAtomic (AtomicOrdering::Release);
259
- #else
260
- store->setAtomic (Release);
261
- #endif
262
250
SmallVector<Value*, 16 > args;
263
251
for (Function::arg_iterator arg = plt->arg_begin (), arg_e = plt->arg_end (); arg != arg_e; ++arg)
264
252
args.push_back (&*arg);
@@ -280,7 +268,7 @@ static GlobalVariable *emit_plt_thunk(Module *M, FunctionType *functype,
280
268
else {
281
269
// musttail support is very bad on ARM, PPC, PPC64 (as of LLVM 3.9)
282
270
// Known failures includes vararg (not needed here) and sret.
283
- #if JL_LLVM_VERSION >= 30700 && (defined(_CPU_X86_) || defined(_CPU_X86_64_) || \
271
+ #if (defined(_CPU_X86_) || defined(_CPU_X86_64_) || \
284
272
defined (_CPU_AARCH64_))
285
273
ret->setTailCallKind (CallInst::TCK_MustTail);
286
274
#endif
@@ -461,10 +449,8 @@ static Value *llvm_type_rewrite(
461
449
Value *to;
462
450
#if JL_LLVM_VERSION >= 40000
463
451
const DataLayout &DL = jl_data_layout;
464
- #elif JL_LLVM_VERSION >= 30600
465
- const DataLayout &DL = jl_ExecutionEngine->getDataLayout ();
466
452
#else
467
- const DataLayout &DL = * jl_ExecutionEngine->getDataLayout ();
453
+ const DataLayout &DL = jl_ExecutionEngine->getDataLayout ();
468
454
#endif
469
455
if (DL.getTypeAllocSize (target_type) >= DL.getTypeAllocSize (from_type)) {
470
456
to = emit_static_alloca (target_type, ctx);
@@ -487,7 +473,7 @@ static Value *runtime_apply_type(jl_value_t *ty, jl_unionall_t *unionall, jl_cod
487
473
args[0 ] = literal_pointer_val (ty);
488
474
args[1 ] = literal_pointer_val ((jl_value_t *)ctx->linfo ->def .method ->sig );
489
475
args[2 ] = builder.CreateInBoundsGEP (
490
- LLVM37_param ( T_prjlvalue)
476
+ T_prjlvalue,
491
477
emit_bitcast (decay_derived (ctx->spvals_ptr ), T_pprjlvalue),
492
478
ConstantInt::get (T_size, sizeof (jl_svec_t ) / sizeof (jl_value_t *)));
493
479
return builder.CreateCall (prepare_call (jlapplytype_func), makeArrayRef (args));
@@ -519,11 +505,7 @@ static void typeassert_input(const jl_cgval_t &jvinfo, jl_value_t *jlto, jl_unio
519
505
Value *vx = boxed (jvinfo, ctx);
520
506
Value *istype = builder.
521
507
CreateICmpNE (
522
- #if JL_LLVM_VERSION >= 30700
523
508
builder.CreateCall (prepare_call (jlisa_func), { vx, boxed (jlto_runtime, ctx) }),
524
- #else
525
- builder.CreateCall2 (prepare_call (jlisa_func), vx, boxed (jlto_runtime, ctx)),
526
- #endif
527
509
ConstantInt::get (T_int32, 0 ));
528
510
BasicBlock *failBB = BasicBlock::Create (jl_LLVMContext, " fail" , ctx->f );
529
511
BasicBlock *passBB = BasicBlock::Create (jl_LLVMContext, " pass" , ctx->f );
@@ -834,7 +816,6 @@ static jl_cgval_t emit_cglobal(jl_value_t **args, size_t nargs, jl_codectx_t *ct
834
816
return mark_julia_type (res, false , rt, ctx);
835
817
}
836
818
837
- #ifdef USE_MCJIT
838
819
class FunctionMover final : public ValueMaterializer
839
820
{
840
821
public:
@@ -871,11 +852,6 @@ class FunctionMover final : public ValueMaterializer
871
852
VMap[&*I] = &*(DestI++); // Add mapping to VMap
872
853
}
873
854
874
- #if JL_LLVM_VERSION >= 30600
875
- // Clone debug info - Not yet public API
876
- // llvm::CloneDebugInfoMetadata(NewF,F,VMap);
877
- #endif
878
-
879
855
SmallVector<ReturnInst*, 8 > Returns;
880
856
llvm::CloneFunctionInto (NewF,F,VMap,true ,Returns," " ,NULL ,NULL ,this );
881
857
NewF->setComdat (nullptr );
@@ -910,13 +886,7 @@ class FunctionMover final : public ValueMaterializer
910
886
return NewF;
911
887
}
912
888
913
- #if JL_LLVM_VERSION >= 30900
914
889
Value *materialize (Value *V) override
915
- #elif JL_LLVM_VERSION >= 30800
916
- Value *materializeDeclFor (Value *V) override
917
- #else
918
- Value *materializeValueFor (Value *V) override
919
- #endif
920
890
{
921
891
Function *F = dyn_cast<Function>(V);
922
892
if (F) {
@@ -984,7 +954,6 @@ class FunctionMover final : public ValueMaterializer
984
954
return NULL ;
985
955
};
986
956
};
987
- #endif
988
957
989
958
// llvmcall(ir, (rettypes...), (argtypes...), args...)
990
959
static jl_cgval_t emit_llvmcall (jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
@@ -1109,14 +1078,10 @@ static jl_cgval_t emit_llvmcall(jl_value_t **args, size_t nargs, jl_codectx_t *c
1109
1078
<< jl_string_data (ir) << " \n }" ;
1110
1079
SMDiagnostic Err = SMDiagnostic ();
1111
1080
std::string ir_string = ir_stream.str ();
1112
- #if JL_LLVM_VERSION >= 30600
1113
1081
Module *m = NULL ;
1114
1082
bool failed = parseAssemblyInto (llvm::MemoryBufferRef (ir_string," llvmcall" ),*jl_Module,Err);
1115
1083
if (!failed)
1116
1084
m = jl_Module;
1117
- #else
1118
- Module *m = ParseAssemblyString (ir_string.c_str (),jl_Module,Err,jl_LLVMContext);
1119
- #endif
1120
1085
if (m == NULL ) {
1121
1086
std::string message = " Failed to parse LLVM Assembly: \n " ;
1122
1087
llvm::raw_string_ostream stream (message);
@@ -1136,20 +1101,14 @@ static jl_cgval_t emit_llvmcall(jl_value_t **args, size_t nargs, jl_codectx_t *c
1136
1101
it != argtypes.end (); ++it, ++i)
1137
1102
assert (*it == f->getFunctionType ()->getParamType (i));
1138
1103
1139
- #ifdef USE_MCJIT
1140
1104
if (f->getParent () != jl_Module) {
1141
1105
FunctionMover mover (jl_Module, f->getParent ());
1142
1106
f = mover.CloneFunction (f);
1143
1107
}
1144
- #endif
1145
1108
1146
1109
// f->dump();
1147
- #if JL_LLVM_VERSION < 30500
1148
- if (verifyFunction (*f,PrintMessageAction)) {
1149
- #else
1150
1110
llvm::raw_fd_ostream out (1 ,false );
1151
1111
if (verifyFunction (*f,&out)) {
1152
- #endif
1153
1112
#if JL_LLVM_VERSION >= 50000
1154
1113
f->print (llvm::dbgs (), nullptr , false , true );
1155
1114
#else
@@ -1212,10 +1171,8 @@ static jl_cgval_t mark_or_box_ccall_result(Value *result, bool isboxed, jl_value
1212
1171
emit_leafcheck (runtime_dt, " ccall: return type must be a leaf DataType" , ctx);
1213
1172
#if JL_LLVM_VERSION >= 40000
1214
1173
const DataLayout &DL = jl_data_layout;
1215
- #elif JL_LLVM_VERSION >= 30600
1216
- const DataLayout &DL = jl_ExecutionEngine->getDataLayout ();
1217
1174
#else
1218
- const DataLayout &DL = * jl_ExecutionEngine->getDataLayout ();
1175
+ const DataLayout &DL = jl_ExecutionEngine->getDataLayout ();
1219
1176
#endif
1220
1177
unsigned nb = DL.getTypeStoreSize (result->getType ());
1221
1178
MDNode *tbaa = jl_is_mutable (rt) ? tbaa_mutab : tbaa_immut;
@@ -1301,7 +1258,7 @@ std::string generate_func_sig()
1301
1258
}
1302
1259
else if (abi->use_sret ((jl_datatype_t *)rt)) {
1303
1260
AttrBuilder retattrs = AttrBuilder ();
1304
- #if !defined(_OS_WINDOWS_) || JL_LLVM_VERSION >= 30500 // llvm used to use the old mingw ABI, skipping this marking works around that difference
1261
+ #if !defined(_OS_WINDOWS_) // llvm used to use the old mingw ABI, skipping this marking works around that difference
1305
1262
retattrs.addAttribute (Attribute::StructRet);
1306
1263
#endif
1307
1264
retattrs.addAttribute (Attribute::NoAlias);
@@ -1679,13 +1636,11 @@ static jl_cgval_t emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
1679
1636
#ifdef __MIC__
1680
1637
// TODO
1681
1638
#elif defined(_CPU_X86_64_) || defined(_CPU_X86_) /* !__MIC__ */
1682
- #if JL_LLVM_VERSION >= 30700
1683
1639
static auto pauseinst = InlineAsm::get (FunctionType::get (T_void, false ), " pause" ,
1684
1640
" ~{memory}" , true );
1685
1641
builder.CreateCall (pauseinst);
1686
1642
JL_GC_POP ();
1687
1643
return ghostValue (jl_void_type);
1688
- #endif
1689
1644
#elif defined(_CPU_AARCH64_) || (defined(_CPU_ARM_) && __ARM_ARCH >= 7)
1690
1645
static auto wfeinst = InlineAsm::get (FunctionType::get (T_void, false ), " wfe" ,
1691
1646
" ~{memory}" , true );
@@ -2051,11 +2006,7 @@ jl_cgval_t function_sig_t::emit_a_ccall(
2051
2006
stacksave = CallInst::Create (Intrinsic::getDeclaration (jl_Module,
2052
2007
Intrinsic::stacksave));
2053
2008
if (savespot) {
2054
- #if JL_LLVM_VERSION >= 30800
2055
2009
instList.insertAfter (savespot->getIterator (), stacksave);
2056
- #else
2057
- instList.insertAfter (savespot, stacksave);
2058
- #endif
2059
2010
}
2060
2011
else {
2061
2012
instList.push_front (stacksave);
@@ -2197,10 +2148,8 @@ jl_cgval_t function_sig_t::emit_a_ccall(
2197
2148
#ifndef JL_NDEBUG
2198
2149
#if JL_LLVM_VERSION >= 40000
2199
2150
const DataLayout &DL = jl_data_layout;
2200
- #elif JL_LLVM_VERSION >= 30600
2201
- const DataLayout &DL = jl_ExecutionEngine->getDataLayout ();
2202
2151
#else
2203
- const DataLayout &DL = * jl_ExecutionEngine->getDataLayout ();
2152
+ const DataLayout &DL = jl_ExecutionEngine->getDataLayout ();
2204
2153
#endif
2205
2154
// ARM and AArch64 can use a LLVM type larger than the julia
2206
2155
// type. However, the LLVM type size should be no larger than
0 commit comments