Skip to content

Commit

Permalink
fix JuliaLang#11726: updates for llvm-svn api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ihnorton committed Jun 18, 2015
1 parent dbe94d1 commit 93fd814
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,13 @@ static Value *emit_getfield_knownidx(Value *strct, unsigned idx, jl_datatype_t *
}
}
else if (strct->getType()->isPointerTy()) { // something stack allocated
# ifdef LLVM37
Value *addr = builder.CreateConstInBoundsGEP2_32(
cast<PointerType>(strct->getType()->getScalarType())->getElementType(),
strct, 0, idx);
# else
Value *addr = builder.CreateConstInBoundsGEP2_32(strct, 0, idx);
# endif
assert(!jt->mutabl);
return typed_load(addr, NULL, jfty, ctx, NULL);
}
Expand Down
15 changes: 12 additions & 3 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ static void jl_setup_module(Module *m, bool add)
#ifdef LLVM37
if (jl_ExecutionEngine) {
m->setDataLayout(jl_ExecutionEngine->getDataLayout()->getStringRepresentation());
m->setTargetTriple(jl_TargetMachine->getTargetTriple());
m->setTargetTriple(jl_TargetMachine->getTargetTriple().str());
}
#elif LLVM36
if (jl_ExecutionEngine)
Expand Down Expand Up @@ -1965,10 +1965,19 @@ static Value *emit_f_is(jl_value_t *rt1, jl_value_t *rt2,
if (at1->isPointerTy()) {
Type *elty = julia_type_to_llvm(rt1);
if (elty->isAggregateType()) {
#ifdef LLVM37
answer = builder.CreateCall(prepare_call(memcmp_func),
{
builder.CreatePointerCast(varg1, T_pint8),
builder.CreatePointerCast(varg2, T_pint8),
builder.CreateTrunc(ConstantExpr::getSizeOf(elty), T_size)
});
#else
answer = builder.CreateCall3(memcmp_func,
builder.CreatePointerCast(varg1, T_pint8),
builder.CreatePointerCast(varg2, T_pint8),
builder.CreateTrunc(ConstantExpr::getSizeOf(elty), T_size));
#endif
answer = builder.CreateICmpEQ(answer, ConstantInt::get(T_int32, 0));
goto done;
}
Expand Down Expand Up @@ -5821,8 +5830,8 @@ extern "C" void jl_init_codegen(void)
#ifdef LLVM37
m->setDataLayout(jl_ExecutionEngine->getDataLayout()->getStringRepresentation());
engine_module->setDataLayout(jl_ExecutionEngine->getDataLayout()->getStringRepresentation());
m->setTargetTriple(jl_TargetMachine->getTargetTriple());
engine_module->setTargetTriple(jl_TargetMachine->getTargetTriple());
m->setTargetTriple(jl_TargetMachine->getTargetTriple().str());
engine_module->setTargetTriple(jl_TargetMachine->getTargetTriple().str());
#elif LLVM36
m->setDataLayout(jl_ExecutionEngine->getDataLayout());
engine_module->setDataLayout(jl_ExecutionEngine->getDataLayout());
Expand Down

0 comments on commit 93fd814

Please sign in to comment.