Skip to content

Commit 7983e18

Browse files
committed
llvm 3.1 support for attribute change, hopefully fixing travis build
1 parent f053626 commit 7983e18

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/ccall.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,11 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
371371
bool haspointers = false;
372372
bool isVa = false;
373373
size_t nargt = jl_tuple_len(tt);
374+
#ifdef LLVM32
374375
std::vector<AttributeWithIndex> attrs;
376+
#else
377+
AttributeSet as;
378+
#endif
375379
for(i=0; i < nargt; i++) {
376380
jl_value_t *tti = jl_tupleref(tt,i);
377381
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)
386390
if (jl_signed_type == NULL) {
387391
jl_signed_type = jl_get_global(jl_core_module,jl_symbol("Signed"));
388392
}
393+
#ifdef LLVM32
389394
Attributes::AttrVal av;
390395
if (jl_signed_type && jl_subtype(tti, jl_signed_type, 0))
391396
av = Attributes::SExt;
392397
else
393398
av = Attributes::ZExt;
394399
attrs.push_back(AttributeWithIndex::get(getGlobalContext(), i+1,
395400
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
396407
}
397408
}
398409
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)
545556
ArrayRef<Value*>(&argvals[0],(nargs-3)/2));
546557
if (cc != CallingConv::C)
547558
((CallInst*)result)->setCallingConv(cc);
559+
#ifdef LLVM32
548560
((CallInst*)result)->setAttributes(AttrListPtr::get(getGlobalContext(), ArrayRef<AttributeWithIndex>(attrs)));
561+
#else
562+
((CallInst*)result)->setAttributes(as);
563+
#endif
549564

550565
// restore temp argument area stack pointer
551566
if (haspointers) {

0 commit comments

Comments
 (0)