@@ -371,7 +371,11 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
371
371
bool haspointers = false ;
372
372
bool isVa = false ;
373
373
size_t nargt = jl_tuple_len (tt);
374
+ #ifdef LLVM32
374
375
std::vector<AttributeWithIndex> attrs;
376
+ #else
377
+ AttributeSet as;
378
+ #endif
375
379
for (i=0 ; i < nargt; i++) {
376
380
jl_value_t *tti = jl_tupleref (tt,i);
377
381
if (jl_is_seq_type (tti)) {
@@ -386,13 +390,20 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
386
390
if (jl_signed_type == NULL ) {
387
391
jl_signed_type = jl_get_global (jl_core_module,jl_symbol (" Signed" ));
388
392
}
393
+ #ifdef LLVM32
389
394
Attributes::AttrVal av;
390
395
if (jl_signed_type && jl_subtype (tti, jl_signed_type, 0 ))
391
396
av = Attributes::SExt;
392
397
else
393
398
av = Attributes::ZExt;
394
399
attrs.push_back (AttributeWithIndex::get (getGlobalContext (), i+1 ,
395
400
ArrayRef<Attributes::AttrVal>(&av, 1 )));
401
+ #else
402
+ if (jl_signed_type && jl_subtype (tti, jl_signed_type, 0 ))
403
+ as = as.addAttr (getGlobalContext (), i+1 , Attribute::SExt);
404
+ else
405
+ as = as.addAttr (getGlobalContext (), i+1 , Attribute::ZExt);
406
+ #endif
396
407
}
397
408
}
398
409
Type *t = julia_type_to_llvm (tti);
@@ -545,7 +556,11 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
545
556
ArrayRef<Value*>(&argvals[0 ],(nargs-3 )/2 ));
546
557
if (cc != CallingConv::C)
547
558
((CallInst*)result)->setCallingConv (cc);
559
+ #ifdef LLVM32
548
560
((CallInst*)result)->setAttributes (AttrListPtr::get (getGlobalContext (), ArrayRef<AttributeWithIndex>(attrs)));
561
+ #else
562
+ ((CallInst*)result)->setAttributes (as);
563
+ #endif
549
564
550
565
// restore temp argument area stack pointer
551
566
if (haspointers) {
0 commit comments