@@ -535,7 +535,7 @@ static jl_datatype_t *staticeval_bitstype(const jl_cgval_t &targ)
535
535
return NULL ;
536
536
}
537
537
538
- static jl_cgval_t emit_runtime_call (jl_codectx_t &ctx, JL_I::intrinsic f, const jl_cgval_t * argv, size_t nargs)
538
+ static jl_cgval_t emit_runtime_call (jl_codectx_t &ctx, JL_I::intrinsic f, ArrayRef< jl_cgval_t > argv, size_t nargs)
539
539
{
540
540
Function *func = prepare_call (runtime_func ()[f]);
541
541
SmallVector<Value *, 0 > argvalues (nargs);
@@ -547,7 +547,7 @@ static jl_cgval_t emit_runtime_call(jl_codectx_t &ctx, JL_I::intrinsic f, const
547
547
}
548
548
549
549
// put a bits type tag on some value (despite the name, this doesn't necessarily actually change anything about the value however)
550
- static jl_cgval_t generic_bitcast (jl_codectx_t &ctx, const jl_cgval_t * argv)
550
+ static jl_cgval_t generic_bitcast (jl_codectx_t &ctx, ArrayRef< jl_cgval_t > argv)
551
551
{
552
552
// Give the arguments names //
553
553
const jl_cgval_t &bt_value = argv[0 ];
@@ -650,7 +650,7 @@ static jl_cgval_t generic_bitcast(jl_codectx_t &ctx, const jl_cgval_t *argv)
650
650
static jl_cgval_t generic_cast (
651
651
jl_codectx_t &ctx,
652
652
intrinsic f, Instruction::CastOps Op,
653
- const jl_cgval_t * argv, bool toint, bool fromint)
653
+ ArrayRef< jl_cgval_t > argv, bool toint, bool fromint)
654
654
{
655
655
auto &TT = ctx.emission_context .TargetTriple ;
656
656
auto &DL = ctx.emission_context .DL ;
@@ -707,12 +707,12 @@ static jl_cgval_t generic_cast(
707
707
}
708
708
}
709
709
710
- static jl_cgval_t emit_runtime_pointerref (jl_codectx_t &ctx, jl_cgval_t * argv)
710
+ static jl_cgval_t emit_runtime_pointerref (jl_codectx_t &ctx, ArrayRef< jl_cgval_t > argv)
711
711
{
712
712
return emit_runtime_call (ctx, pointerref, argv, 3 );
713
713
}
714
714
715
- static jl_cgval_t emit_pointerref (jl_codectx_t &ctx, jl_cgval_t * argv)
715
+ static jl_cgval_t emit_pointerref (jl_codectx_t &ctx, ArrayRef< jl_cgval_t > argv)
716
716
{
717
717
const jl_cgval_t &e = argv[0 ];
718
718
const jl_cgval_t &i = argv[1 ];
@@ -780,13 +780,13 @@ static jl_cgval_t emit_pointerref(jl_codectx_t &ctx, jl_cgval_t *argv)
780
780
}
781
781
}
782
782
783
- static jl_cgval_t emit_runtime_pointerset (jl_codectx_t &ctx, jl_cgval_t * argv)
783
+ static jl_cgval_t emit_runtime_pointerset (jl_codectx_t &ctx, ArrayRef< jl_cgval_t > argv)
784
784
{
785
785
return emit_runtime_call (ctx, pointerset, argv, 4 );
786
786
}
787
787
788
788
// e[i] = x
789
- static jl_cgval_t emit_pointerset (jl_codectx_t &ctx, jl_cgval_t * argv)
789
+ static jl_cgval_t emit_pointerset (jl_codectx_t &ctx, ArrayRef< jl_cgval_t > argv)
790
790
{
791
791
const jl_cgval_t &e = argv[0 ];
792
792
const jl_cgval_t &x = argv[1 ];
@@ -853,7 +853,7 @@ static jl_cgval_t emit_pointerset(jl_codectx_t &ctx, jl_cgval_t *argv)
853
853
return e;
854
854
}
855
855
856
- static jl_cgval_t emit_atomicfence (jl_codectx_t &ctx, jl_cgval_t * argv)
856
+ static jl_cgval_t emit_atomicfence (jl_codectx_t &ctx, ArrayRef< jl_cgval_t > argv)
857
857
{
858
858
const jl_cgval_t &ord = argv[0 ];
859
859
if (ord.constant && jl_is_symbol (ord.constant )) {
@@ -869,7 +869,7 @@ static jl_cgval_t emit_atomicfence(jl_codectx_t &ctx, jl_cgval_t *argv)
869
869
return emit_runtime_call (ctx, atomic_fence, argv, 1 );
870
870
}
871
871
872
- static jl_cgval_t emit_atomic_pointerref (jl_codectx_t &ctx, jl_cgval_t * argv)
872
+ static jl_cgval_t emit_atomic_pointerref (jl_codectx_t &ctx, ArrayRef< jl_cgval_t > argv)
873
873
{
874
874
const jl_cgval_t &e = argv[0 ];
875
875
const jl_cgval_t &ord = argv[1 ];
@@ -947,7 +947,7 @@ static jl_cgval_t emit_atomic_pointerref(jl_codectx_t &ctx, jl_cgval_t *argv)
947
947
// e[i] <= x (swap)
948
948
// e[i] y => x (replace)
949
949
// x(e[i], y) (modify)
950
- static jl_cgval_t emit_atomic_pointerop (jl_codectx_t &ctx, intrinsic f, const jl_cgval_t * argv, int nargs, const jl_cgval_t *modifyop)
950
+ static jl_cgval_t emit_atomic_pointerop (jl_codectx_t &ctx, intrinsic f, ArrayRef< jl_cgval_t > argv, int nargs, const jl_cgval_t *modifyop)
951
951
{
952
952
bool issetfield = f == atomic_pointerset;
953
953
bool isreplacefield = f == atomic_pointerreplace;
@@ -1084,7 +1084,7 @@ struct math_builder {
1084
1084
}
1085
1085
};
1086
1086
1087
- static Value *emit_untyped_intrinsic (jl_codectx_t &ctx, intrinsic f, Value ** argvalues, size_t nargs,
1087
+ static Value *emit_untyped_intrinsic (jl_codectx_t &ctx, intrinsic f, ArrayRef< Value*> argvalues, size_t nargs,
1088
1088
jl_datatype_t **newtyp, jl_value_t *xtyp);
1089
1089
1090
1090
@@ -1265,72 +1265,72 @@ static jl_cgval_t emit_intrinsic(jl_codectx_t &ctx, intrinsic f, jl_value_t **ar
1265
1265
case pointerref:
1266
1266
++Emitted_pointerref;
1267
1267
assert (nargs == 3 );
1268
- return emit_pointerref (ctx, argv. data () );
1268
+ return emit_pointerref (ctx, argv);
1269
1269
case pointerset:
1270
1270
++Emitted_pointerset;
1271
1271
assert (nargs == 4 );
1272
- return emit_pointerset (ctx, argv. data () );
1272
+ return emit_pointerset (ctx, argv);
1273
1273
case atomic_fence:
1274
1274
++Emitted_atomic_fence;
1275
1275
assert (nargs == 1 );
1276
- return emit_atomicfence (ctx, argv. data () );
1276
+ return emit_atomicfence (ctx, argv);
1277
1277
case atomic_pointerref:
1278
1278
++Emitted_atomic_pointerref;
1279
1279
assert (nargs == 2 );
1280
- return emit_atomic_pointerref (ctx, argv. data () );
1280
+ return emit_atomic_pointerref (ctx, argv);
1281
1281
case atomic_pointerset:
1282
1282
case atomic_pointerswap:
1283
1283
case atomic_pointermodify:
1284
1284
case atomic_pointerreplace:
1285
1285
++Emitted_atomic_pointerop;
1286
- return emit_atomic_pointerop (ctx, f, argv. data () , nargs, nullptr );
1286
+ return emit_atomic_pointerop (ctx, f, argv, nargs, nullptr );
1287
1287
case bitcast:
1288
1288
++Emitted_bitcast;
1289
1289
assert (nargs == 2 );
1290
- return generic_bitcast (ctx, argv. data () );
1290
+ return generic_bitcast (ctx, argv);
1291
1291
case trunc_int:
1292
1292
++Emitted_trunc_int;
1293
1293
assert (nargs == 2 );
1294
- return generic_cast (ctx, f, Instruction::Trunc, argv. data () , true , true );
1294
+ return generic_cast (ctx, f, Instruction::Trunc, argv, true , true );
1295
1295
case sext_int:
1296
1296
++Emitted_sext_int;
1297
1297
assert (nargs == 2 );
1298
- return generic_cast (ctx, f, Instruction::SExt, argv. data () , true , true );
1298
+ return generic_cast (ctx, f, Instruction::SExt, argv, true , true );
1299
1299
case zext_int:
1300
1300
++Emitted_zext_int;
1301
1301
assert (nargs == 2 );
1302
- return generic_cast (ctx, f, Instruction::ZExt, argv. data () , true , true );
1302
+ return generic_cast (ctx, f, Instruction::ZExt, argv, true , true );
1303
1303
case uitofp:
1304
1304
++Emitted_uitofp;
1305
1305
assert (nargs == 2 );
1306
- return generic_cast (ctx, f, Instruction::UIToFP, argv. data () , false , true );
1306
+ return generic_cast (ctx, f, Instruction::UIToFP, argv, false , true );
1307
1307
case sitofp:
1308
1308
++Emitted_sitofp;
1309
1309
assert (nargs == 2 );
1310
- return generic_cast (ctx, f, Instruction::SIToFP, argv. data () , false , true );
1310
+ return generic_cast (ctx, f, Instruction::SIToFP, argv, false , true );
1311
1311
case fptoui:
1312
1312
++Emitted_fptoui;
1313
1313
assert (nargs == 2 );
1314
- return generic_cast (ctx, f, Instruction::FPToUI, argv. data () , true , false );
1314
+ return generic_cast (ctx, f, Instruction::FPToUI, argv, true , false );
1315
1315
case fptosi:
1316
1316
++Emitted_fptosi;
1317
1317
assert (nargs == 2 );
1318
- return generic_cast (ctx, f, Instruction::FPToSI, argv. data () , true , false );
1318
+ return generic_cast (ctx, f, Instruction::FPToSI, argv, true , false );
1319
1319
case fptrunc:
1320
1320
++Emitted_fptrunc;
1321
1321
assert (nargs == 2 );
1322
- return generic_cast (ctx, f, Instruction::FPTrunc, argv. data () , false , false );
1322
+ return generic_cast (ctx, f, Instruction::FPTrunc, argv, false , false );
1323
1323
case fpext:
1324
1324
++Emitted_fpext;
1325
1325
assert (nargs == 2 );
1326
- return generic_cast (ctx, f, Instruction::FPExt, argv. data () , false , false );
1326
+ return generic_cast (ctx, f, Instruction::FPExt, argv, false , false );
1327
1327
1328
1328
case not_int: {
1329
1329
++Emitted_not_int;
1330
1330
assert (nargs == 1 );
1331
1331
const jl_cgval_t &x = argv[0 ];
1332
1332
if (!jl_is_primitivetype (x.typ ))
1333
- return emit_runtime_call (ctx, f, argv. data () , nargs);
1333
+ return emit_runtime_call (ctx, f, argv, nargs);
1334
1334
Type *xt = INTT (bitstype_to_llvm (x.typ , ctx.builder .getContext (), true ), DL);
1335
1335
Value *from = emit_unbox (ctx, xt, x, x.typ );
1336
1336
Value *ans = ctx.builder .CreateNot (from);
@@ -1342,7 +1342,7 @@ static jl_cgval_t emit_intrinsic(jl_codectx_t &ctx, intrinsic f, jl_value_t **ar
1342
1342
assert (nargs == 1 );
1343
1343
const jl_cgval_t &x = argv[0 ];
1344
1344
if (!x.constant || !jl_is_datatype (x.constant ))
1345
- return emit_runtime_call (ctx, f, argv. data () , nargs);
1345
+ return emit_runtime_call (ctx, f, argv, nargs);
1346
1346
jl_datatype_t *dt = (jl_datatype_t *) x.constant ;
1347
1347
1348
1348
// select the appropriated overloaded intrinsic
@@ -1352,7 +1352,7 @@ static jl_cgval_t emit_intrinsic(jl_codectx_t &ctx, intrinsic f, jl_value_t **ar
1352
1352
else if (dt == jl_float64_type)
1353
1353
intr_name += " f64" ;
1354
1354
else
1355
- return emit_runtime_call (ctx, f, argv. data () , nargs);
1355
+ return emit_runtime_call (ctx, f, argv, nargs);
1356
1356
1357
1357
FunctionCallee intr = jl_Module->getOrInsertFunction (intr_name, getInt1Ty (ctx.builder .getContext ()));
1358
1358
auto ret = ctx.builder .CreateCall (intr);
@@ -1365,14 +1365,14 @@ static jl_cgval_t emit_intrinsic(jl_codectx_t &ctx, intrinsic f, jl_value_t **ar
1365
1365
1366
1366
// verify argument types
1367
1367
if (!jl_is_primitivetype (xinfo.typ ))
1368
- return emit_runtime_call (ctx, f, argv. data () , nargs);
1368
+ return emit_runtime_call (ctx, f, argv, nargs);
1369
1369
Type *xtyp = bitstype_to_llvm (xinfo.typ , ctx.builder .getContext (), true );
1370
1370
if (float_func ()[f])
1371
1371
xtyp = FLOATT (xtyp);
1372
1372
else
1373
1373
xtyp = INTT (xtyp, DL);
1374
1374
if (!xtyp)
1375
- return emit_runtime_call (ctx, f, argv. data () , nargs);
1375
+ return emit_runtime_call (ctx, f, argv, nargs);
1376
1376
// //Bool are required to be in the range [0,1]
1377
1377
// //so while they are represented as i8,
1378
1378
// //the operations need to be done in mod 1
@@ -1388,13 +1388,13 @@ static jl_cgval_t emit_intrinsic(jl_codectx_t &ctx, intrinsic f, jl_value_t **ar
1388
1388
1389
1389
if (f == shl_int || f == lshr_int || f == ashr_int) {
1390
1390
if (!jl_is_primitivetype (argv[1 ].typ ))
1391
- return emit_runtime_call (ctx, f, argv. data () , nargs);
1391
+ return emit_runtime_call (ctx, f, argv, nargs);
1392
1392
argt[1 ] = INTT (bitstype_to_llvm (argv[1 ].typ , ctx.builder .getContext (), true ), DL);
1393
1393
}
1394
1394
else {
1395
1395
for (size_t i = 1 ; i < nargs; ++i) {
1396
1396
if (xinfo.typ != argv[i].typ )
1397
- return emit_runtime_call (ctx, f, argv. data () , nargs);
1397
+ return emit_runtime_call (ctx, f, argv, nargs);
1398
1398
argt[i] = xtyp;
1399
1399
}
1400
1400
}
@@ -1407,7 +1407,7 @@ static jl_cgval_t emit_intrinsic(jl_codectx_t &ctx, intrinsic f, jl_value_t **ar
1407
1407
1408
1408
// call the intrinsic
1409
1409
jl_value_t *newtyp = xinfo.typ ;
1410
- Value *r = emit_untyped_intrinsic (ctx, f, argvalues. data () , nargs, (jl_datatype_t **)&newtyp, xinfo.typ );
1410
+ Value *r = emit_untyped_intrinsic (ctx, f, argvalues, nargs, (jl_datatype_t **)&newtyp, xinfo.typ );
1411
1411
// Turn Bool operations into mod 1 now, if needed
1412
1412
if (newtyp == (jl_value_t *)jl_bool_type && !r->getType ()->isIntegerTy (1 ))
1413
1413
r = ctx.builder .CreateTrunc (r, getInt1Ty (ctx.builder .getContext ()));
@@ -1417,7 +1417,7 @@ static jl_cgval_t emit_intrinsic(jl_codectx_t &ctx, intrinsic f, jl_value_t **ar
1417
1417
assert (0 && " unreachable" );
1418
1418
}
1419
1419
1420
- static Value *emit_untyped_intrinsic (jl_codectx_t &ctx, intrinsic f, Value ** argvalues, size_t nargs,
1420
+ static Value *emit_untyped_intrinsic (jl_codectx_t &ctx, intrinsic f, ArrayRef< Value*> argvalues, size_t nargs,
1421
1421
jl_datatype_t **newtyp, jl_value_t *xtyp)
1422
1422
{
1423
1423
++EmittedUntypedIntrinsics;
0 commit comments