@@ -110,6 +110,7 @@ indirectbr!(builder::IRBuilder, Addr::Value, NumDests::Integer=10) =
110
110
function invoke! (builder:: IRBuilder , Fn:: Value , Args:: Vector{<:Value} , Then:: BasicBlock ,
111
111
Catch:: BasicBlock , Name:: String = " " )
112
112
supports_typed_pointers (context (builder)) || throw_typedpointererror ()
113
+ Base. depwarn (" invoke! without specifying the function type is deprecated" , :invoke )
113
114
Instruction (API. LLVMBuildInvoke (builder, Fn, Args, length (Args), Then, Catch, Name))
114
115
end
115
116
@@ -259,11 +260,16 @@ free!(builder::IRBuilder, PointerVal::Value) =
259
260
260
261
function load! (builder:: IRBuilder , PointerVal:: Value , Name:: String = " " )
261
262
supports_typed_pointers (context (builder)) || throw_typedpointererror ()
263
+ Base. depwarn (" load! without specifying the destination type is deprecated" , :load )
262
264
Instruction (API. LLVMBuildLoad (builder, PointerVal, Name))
263
265
end
264
266
265
267
function load! (builder:: IRBuilder , Ty:: LLVMType , PointerVal:: Value , Name:: String = " " )
266
- Instruction (API. LLVMBuildLoad2 (builder, Ty, PointerVal, Name))
268
+ @static if version () >= v " 11"
269
+ Instruction (API. LLVMBuildLoad2 (builder, Ty, PointerVal, Name))
270
+ else
271
+ Instruction (API. LLVMBuildLoad (builder, PointerVal, Name))
272
+ end
267
273
end
268
274
269
275
store! (builder:: IRBuilder , Val:: Value , Ptr:: Value ) =
@@ -286,32 +292,47 @@ atomic_cmpxchg!(builder::IRBuilder, Ptr::Value, Cmp::Value, New::Value,
286
292
287
293
function gep! (builder:: IRBuilder , Pointer:: Value , Indices:: Vector{<:Value} , Name:: String = " " )
288
294
supports_typed_pointers (context (builder)) || throw_typedpointererror ()
295
+ Base. depwarn (" gep! without specifying the destination type is deprecated" , :gep )
289
296
Value (API. LLVMBuildGEP (builder, Pointer, Indices, length (Indices), Name))
290
297
end
291
298
292
299
function gep! (builder:: IRBuilder , Ty:: LLVMType , Pointer:: Value , Indices:: Vector{<:Value} ,
293
300
Name:: String = " " )
294
- return Value (API. LLVMBuildGEP2 (builder, Ty, Pointer, Indices, length (Indices), Name))
301
+ @static if version () >= v " 11"
302
+ Value (API. LLVMBuildGEP2 (builder, Ty, Pointer, Indices, length (Indices), Name))
303
+ else
304
+ Value (API. LLVMBuildGEP (builder, Pointer, Indices, length (Indices), Name))
305
+ end
295
306
end
296
307
297
308
function inbounds_gep! (builder:: IRBuilder , Pointer:: Value , Indices:: Vector{<:Value} ,
298
309
Name:: String = " " )
299
310
supports_typed_pointers (context (builder)) || throw_typedpointererror ()
311
+ Base. depwarn (" inbounds_gep! without specifying the destination type is deprecated" , :inbounds_gep )
300
312
Value (API. LLVMBuildInBoundsGEP (builder, Pointer, Indices, length (Indices), Name))
301
313
end
302
314
303
315
function inbounds_gep! (builder:: IRBuilder , Ty:: LLVMType , Pointer:: Value ,
304
316
Indices:: Vector{<:Value} , Name:: String = " " )
305
- Value (API. LLVMBuildInBoundsGEP2 (builder, Ty, Pointer, Indices, length (Indices), Name))
317
+ @static if version () >= v " 11"
318
+ Value (API. LLVMBuildInBoundsGEP2 (builder, Ty, Pointer, Indices, length (Indices), Name))
319
+ else
320
+ Value (API. LLVMBuildInBoundsGEP (builder, Pointer, Indices, length (Indices), Name))
321
+ end
306
322
end
307
323
308
324
function struct_gep! (builder:: IRBuilder , Pointer:: Value , Idx, Name:: String = " " )
309
325
supports_typed_pointers (context (builder)) || throw_typedpointererror ()
326
+ Base. depwarn (" struct_gep! without specifying the destination type is deprecated" , :struct_gep )
310
327
Value (API. LLVMBuildStructGEP (builder, Pointer, Idx, Name))
311
328
end
312
329
313
330
function struct_gep! (builder:: IRBuilder , Ty:: LLVMType , Pointer:: Value , Idx, Name:: String = " " )
314
- Value (API. LLVMBuildStructGEP2 (builder, Ty, Pointer, Idx, Name))
331
+ @static if version () >= v " 11"
332
+ Value (API. LLVMBuildStructGEP2 (builder, Ty, Pointer, Idx, Name))
333
+ else
334
+ Value (API. LLVMBuildStructGEP (builder, Pointer, Idx, Name))
335
+ end
315
336
end
316
337
317
338
# conversion operations
@@ -394,25 +415,47 @@ select!(builder::IRBuilder, If::Value, Then::Value, Else::Value, Name::String=""
394
415
395
416
function call! (builder:: IRBuilder , Fn:: Value , Args:: Vector{<:Value} = Value[], Name:: String = " " )
396
417
supports_typed_pointers (context (builder)) || throw_typedpointererror ()
418
+ Base. depwarn (" call! without specifying the function type is deprecated" , :call )
397
419
Instruction (API. LLVMBuildCall (builder, Fn, Args, length (Args), Name))
398
420
end
399
421
400
422
function call! (builder:: IRBuilder , Ty:: LLVMType , Fn:: Value , Args:: Vector{<:Value} = Value[],
401
423
Name:: String = " " )
402
- Instruction (API. LLVMBuildCall2 (builder, Ty, Fn, Args, length (Args), Name))
424
+ @static if version () >= v " 11"
425
+ Instruction (API. LLVMBuildCall2 (builder, Ty, Fn, Args, length (Args), Name))
426
+ else
427
+ Instruction (API. LLVMBuildCall (builder, Fn, Args, length (Args), Name))
428
+ end
403
429
end
404
430
405
- call! (builder:: IRBuilder , Fn:: Value , Args:: Vector{<:Value} ,
406
- Bundles:: Vector{OperandBundleDef} , Name:: String = " " ) =
431
+ function call! (builder:: IRBuilder , Fn:: Value , Args:: Vector{<:Value} ,
432
+ Bundles:: Vector{OperandBundleDef} , Name:: String = " " )
433
+ supports_typed_pointers (context (builder)) || throw_typedpointererror ()
434
+ Base. depwarn (" call! without specifying the function type is deprecated" , :call )
407
435
Instruction (API. LLVMBuildCallWithOpBundle (builder, Fn, Args, length (Args), Bundles,
408
436
length (Bundles), Name))
437
+ end
438
+ function call! (builder:: IRBuilder , Ty:: LLVMType , Fn:: Value , Args:: Vector{<:Value} ,
439
+ Bundles:: Vector{OperandBundleDef} , Name:: String = " " )
440
+ Instruction (API. LLVMBuildCallWithOpBundle2 (builder, Ty, Fn, Args, length (Args), Bundles,
441
+ length (Bundles), Name))
442
+ end
409
443
410
444
# convenience function that performs the OperandBundle(Iterator|Use)->Def conversion
411
- call! (builder:: IRBuilder , Fn:: Value , Args:: Vector{<:Value} ,
412
- Bundles, Name:: String = " " ) =
445
+ function call! (builder:: IRBuilder , Fn:: Value , Args:: Vector{<:Value} ,
446
+ Bundles, Name:: String = " " )
447
+ supports_typed_pointers (context (builder)) || throw_typedpointererror ()
448
+ Base. depwarn (" call! without specifying the function type is deprecated" , :call )
413
449
Instruction (API. LLVMBuildCallWithOpBundle (builder, Fn, Args, length (Args),
414
450
OperandBundleDef .(Bundles),
415
451
length (Bundles), Name))
452
+ end
453
+ function call! (builder:: IRBuilder , Ty:: LLVMType , Fn:: Value , Args:: Vector{<:Value} ,
454
+ Bundles, Name:: String = " " )
455
+ Instruction (API. LLVMBuildCallWithOpBundle2 (builder, Ty, Fn, Args, length (Args),
456
+ OperandBundleDef .(Bundles),
457
+ length (Bundles), Name))
458
+ end
416
459
417
460
va_arg! (builder:: IRBuilder , List:: Value , Ty:: LLVMType , Name:: String = " " ) =
418
461
Instruction (API. LLVMBuildVAArg (builder, List, Ty, Name))
@@ -453,9 +496,15 @@ isnotnull!(builder::IRBuilder, Val::Value, Name::String="") =
453
496
454
497
function ptrdiff! (builder:: IRBuilder , LHS:: Value , RHS:: Value , Name:: String = " " )
455
498
supports_typed_pointers (context (builder)) || throw_typedpointererror ()
499
+ Base. depwarn (" ptrdiff! without specifying a pointer type is deprecated" , :ptrdiff )
456
500
Value (API. LLVMBuildPtrDiff (builder, LHS, RHS, Name))
457
501
end
458
502
459
503
function ptrdiff! (builder:: IRBuilder , Ty:: LLVMType , LHS:: Value , RHS:: Value , Name:: String = " " )
460
- Value (API. LLVMBuildPtrDiff2 (builder, Ty, LHS, RHS, Name))
504
+ @static if version () >= v " 15"
505
+ # XXX : backport this to LLVM 11, if we care
506
+ Value (API. LLVMBuildPtrDiff2 (builder, Ty, LHS, RHS, Name))
507
+ else
508
+ Value (API. LLVMBuildPtrDiff (builder, LHS, RHS, Name))
509
+ end
461
510
end
0 commit comments