Update to work with LLVM 2.7.

Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).

Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.

Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
This commit is contained in:
Tomas Lindquist Olsen 2010-05-19 12:42:32 +02:00
parent 5707961243
commit 1fac40d2bd
27 changed files with 992 additions and 242 deletions

View file

@ -599,10 +599,11 @@ void DtoDefineFunction(FuncDeclaration* fd)
return;
}
#ifndef DISABLE_DEBUG_INFO
// debug info
if (global.params.symdebug) {
if (global.params.symdebug)
fd->ir.irFunc->diSubprogram = DtoDwarfSubProgram(fd);
}
#endif
Type* t = fd->type->toBasetype();
TypeFunction* f = (TypeFunction*)t;
@ -642,8 +643,10 @@ void DtoDefineFunction(FuncDeclaration* fd)
llvm::Instruction* allocaPoint = new llvm::AllocaInst(LLType::getInt32Ty(gIR->context()), "alloca point", beginbb);
irfunction->allocapoint = allocaPoint;
#ifndef DISABLE_DEBUG_INFO
// debug info - after all allocas, but before any llvm.dbg.declare etc
if (global.params.symdebug) DtoDwarfFuncStart(fd);
#endif
// this hack makes sure the frame pointer elimination optimization is disabled.
// this this eliminates a bunch of inline asm related issues.
@ -668,8 +671,10 @@ void DtoDefineFunction(FuncDeclaration* fd)
fd->vthis->ir.irLocal = new IrLocal(fd->vthis);
fd->vthis->ir.irLocal->value = thismem;
#ifndef DISABLE_DEBUG_INFO
if (global.params.symdebug)
DtoDwarfLocalVariable(thismem, fd->vthis);
#endif
#if DMDV1
if (fd->vthis->nestedref)
@ -722,8 +727,10 @@ void DtoDefineFunction(FuncDeclaration* fd)
irloc->value = mem;
}
#ifndef DISABLE_DEBUG_INFO
if (global.params.symdebug && !(isaArgument(irloc->value) && !isaArgument(irloc->value)->hasByValAttr()) && !refout)
DtoDwarfLocalVariable(irloc->value, vd);
#endif
}
}
@ -758,7 +765,7 @@ void DtoDefineFunction(FuncDeclaration* fd)
fd->vresult->ir.irLocal = new IrLocal(fd->vresult);
fd->vresult->ir.irLocal->value = DtoAlloca(fd->vresult->type, fd->vresult->toChars());
}
// copy _argptr and _arguments to a memory location
if (f->linkage == LINKd && f->varargs == 1)
{
@ -794,9 +801,11 @@ void DtoDefineFunction(FuncDeclaration* fd)
} else if (!gIR->scopereturned()) {
// llvm requires all basic blocks to end with a TerminatorInst but DMD does not put a return statement
// in automatically, so we do it here.
// pass the previous block into this block
#ifndef DISABLE_DEBUG_INFO
if (global.params.symdebug) DtoDwarfFuncEnd(fd);
#endif
if (func->getReturnType() == LLType::getVoidTy(gIR->context())) {
llvm::ReturnInst::Create(gIR->context(), gIR->scopebb());
}