changeset 81:3587401b6eeb trunk

[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed. Changed: Renamed all the LLVM_Dto... helper function to just Dto...
author lindquist
date Thu, 01 Nov 2007 17:27:18 +0100
parents 7299ff502248
children d8dd47ef3973
files gen/arrays.c gen/arrays.h gen/irstate.c gen/irstate.h gen/statements.c gen/toir.c gen/tollvm.c gen/tollvm.h gen/toobj.c gen/typinf.c test/scope5.d
diffstat 11 files changed, 620 insertions(+), 561 deletions(-) [+]
line wrap: on
line diff
--- a/gen/arrays.c	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/arrays.c	Thu Nov 01 17:27:18 2007 +0100
@@ -15,10 +15,10 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const llvm::StructType* LLVM_DtoArrayType(Type* t)
+const llvm::StructType* DtoArrayType(Type* t)
 {
     assert(t->next);
-    const llvm::Type* at = LLVM_DtoType(t->next);
+    const llvm::Type* at = DtoType(t->next);
     const llvm::Type* arrty;
 
     /*if (t->ty == Tsarray) {
@@ -47,7 +47,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const llvm::ArrayType* LLVM_DtoStaticArrayType(Type* t)
+const llvm::ArrayType* DtoStaticArrayType(Type* t)
 {
     if (t->llvmType)
         return llvm::cast<llvm::ArrayType>(t->llvmType);
@@ -55,7 +55,7 @@
     assert(t->ty == Tsarray);
     assert(t->next);
 
-    const llvm::Type* at = LLVM_DtoType(t->next);
+    const llvm::Type* at = DtoType(t->next);
 
     TypeSArray* tsa = (TypeSArray*)t;
     assert(tsa->dim->type->isintegral());
@@ -67,15 +67,15 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoNullArray(llvm::Value* v)
+void DtoNullArray(llvm::Value* v)
 {
     assert(gIR);
 
-    llvm::Value* len = LLVM_DtoGEPi(v,0,0,"tmp",gIR->scopebb());
+    llvm::Value* len = DtoGEPi(v,0,0,"tmp",gIR->scopebb());
     llvm::Value* zerolen = llvm::ConstantInt::get(len->getType()->getContainedType(0), 0, false);
     new llvm::StoreInst(zerolen, len, gIR->scopebb());
 
-    llvm::Value* ptr = LLVM_DtoGEPi(v,0,1,"tmp",gIR->scopebb());
+    llvm::Value* ptr = DtoGEPi(v,0,1,"tmp",gIR->scopebb());
     const llvm::PointerType* pty = llvm::cast<llvm::PointerType>(ptr->getType()->getContainedType(0));
     llvm::Value* nullptr = llvm::ConstantPointerNull::get(pty);
     new llvm::StoreInst(nullptr, ptr, gIR->scopebb());
@@ -83,19 +83,19 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoArrayAssign(llvm::Value* dst, llvm::Value* src)
+void DtoArrayAssign(llvm::Value* dst, llvm::Value* src)
 {
     assert(gIR);
     if (dst->getType() == src->getType())
     {
-        llvm::Value* ptr = LLVM_DtoGEPi(src,0,0,"tmp",gIR->scopebb());
+        llvm::Value* ptr = DtoGEPi(src,0,0,"tmp",gIR->scopebb());
         llvm::Value* val = new llvm::LoadInst(ptr,"tmp",gIR->scopebb());
-        ptr = LLVM_DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
+        ptr = DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
         new llvm::StoreInst(val, ptr, gIR->scopebb());
 
-        ptr = LLVM_DtoGEPi(src,0,1,"tmp",gIR->scopebb());
+        ptr = DtoGEPi(src,0,1,"tmp",gIR->scopebb());
         val = new llvm::LoadInst(ptr,"tmp",gIR->scopebb());
-        ptr = LLVM_DtoGEPi(dst,0,1,"tmp",gIR->scopebb());
+        ptr = DtoGEPi(dst,0,1,"tmp",gIR->scopebb());
         new llvm::StoreInst(val, ptr, gIR->scopebb());
     }
     else
@@ -109,11 +109,11 @@
         const llvm::ArrayType* arrty = llvm::cast<llvm::ArrayType>(src->getType()->getContainedType(0));
         llvm::Type* dstty = llvm::PointerType::get(arrty->getElementType());
 
-        llvm::Value* dstlen = LLVM_DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
-        llvm::Value* srclen = LLVM_DtoConstSize_t(arrty->getNumElements());
+        llvm::Value* dstlen = DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
+        llvm::Value* srclen = DtoConstSize_t(arrty->getNumElements());
         new llvm::StoreInst(srclen, dstlen, gIR->scopebb());
 
-        llvm::Value* dstptr = LLVM_DtoGEPi(dst,0,1,"tmp",gIR->scopebb());
+        llvm::Value* dstptr = DtoGEPi(dst,0,1,"tmp",gIR->scopebb());
         llvm::Value* srcptr = new llvm::BitCastInst(src,dstty,"tmp",gIR->scopebb());
         new llvm::StoreInst(srcptr, dstptr, gIR->scopebb());
     }
@@ -121,17 +121,17 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoArrayInit(llvm::Value* l, llvm::Value* r)
+void DtoArrayInit(llvm::Value* l, llvm::Value* r)
 {
     const llvm::PointerType* ptrty = llvm::cast<llvm::PointerType>(l->getType());
     const llvm::Type* t = ptrty->getContainedType(0);
     const llvm::ArrayType* arrty = llvm::cast_or_null<llvm::ArrayType>(t);
     if (arrty)
     {
-        llvm::Value* ptr = LLVM_DtoGEPi(l,0,0,"tmp",gIR->scopebb());
-        llvm::Value* dim = llvm::ConstantInt::get(LLVM_DtoSize_t(), arrty->getNumElements(), false);
+        llvm::Value* ptr = DtoGEPi(l,0,0,"tmp",gIR->scopebb());
+        llvm::Value* dim = llvm::ConstantInt::get(DtoSize_t(), arrty->getNumElements(), false);
         llvm::Value* val = r;
-        LLVM_DtoArrayInit(ptr, dim, val);
+        DtoArrayInit(ptr, dim, val);
     }
     else if (llvm::isa<llvm::StructType>(t))
     {
@@ -157,7 +157,7 @@
     return 0;
 }
 
-void LLVM_DtoArrayInit(llvm::Value* ptr, llvm::Value* dim, llvm::Value* val)
+void DtoArrayInit(llvm::Value* ptr, llvm::Value* dim, llvm::Value* val)
 {
     const llvm::Type* pt = ptr->getType()->getContainedType(0);
     const llvm::Type* t = val->getType();
@@ -166,7 +166,7 @@
         assert(finalTy == t);
         llvm::Constant* c = llvm::cast_or_null<llvm::Constant>(dim);
         assert(c);
-        dim = llvm::ConstantExpr::getMul(c, LLVM_DtoConstSize_t(arrsz));
+        dim = llvm::ConstantExpr::getMul(c, DtoConstSize_t(arrsz));
         ptr = gIR->ir->CreateBitCast(ptr, llvm::PointerType::get(finalTy), "tmp");
     }
     else if (llvm::isa<llvm::StructType>(t)) {
@@ -229,34 +229,34 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoSetArray(llvm::Value* arr, llvm::Value* dim, llvm::Value* ptr)
+void DtoSetArray(llvm::Value* arr, llvm::Value* dim, llvm::Value* ptr)
 {
-    Logger::cout() << "LLVM_DtoSetArray(" << *arr << ", " << *dim << ", " << *ptr << ")\n";
+    Logger::cout() << "DtoSetArray(" << *arr << ", " << *dim << ", " << *ptr << ")\n";
     const llvm::StructType* st = llvm::cast<llvm::StructType>(arr->getType()->getContainedType(0));
     //const llvm::PointerType* pt = llvm::cast<llvm::PointerType>(r->getType());
     
     llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false);
     llvm::Value* one = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1, false);
 
-    llvm::Value* arrdim = LLVM_DtoGEP(arr,zero,zero,"tmp",gIR->scopebb());
+    llvm::Value* arrdim = DtoGEP(arr,zero,zero,"tmp",gIR->scopebb());
     new llvm::StoreInst(dim, arrdim, gIR->scopebb());
     
-    llvm::Value* arrptr = LLVM_DtoGEP(arr,zero,one,"tmp",gIR->scopebb());
+    llvm::Value* arrptr = DtoGEP(arr,zero,one,"tmp",gIR->scopebb());
     new llvm::StoreInst(ptr, arrptr, gIR->scopebb());
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Constant* LLVM_DtoConstArrayInitializer(ArrayInitializer* arrinit)
+llvm::Constant* DtoConstArrayInitializer(ArrayInitializer* arrinit)
 {
     Logger::println("arr init begin");
-    Type* arrinittype = LLVM_DtoDType(arrinit->type);
+    Type* arrinittype = DtoDType(arrinit->type);
     assert(arrinittype->ty == Tsarray);
     TypeSArray* t = (TypeSArray*)arrinittype;
     integer_t tdim = t->dim->toInteger();
 
     std::vector<llvm::Constant*> inits(tdim, 0);
 
-    const llvm::Type* elemty = LLVM_DtoType(arrinittype->next);
+    const llvm::Type* elemty = DtoType(arrinittype->next);
 
     assert(arrinit->index.dim == arrinit->value.dim);
     for (int i=0,j=0; i < tdim; ++i)
@@ -292,11 +292,11 @@
         }
         else if (StructInitializer* si = init->isStructInitializer())
         {
-            v = LLVM_DtoConstStructInitializer(si);
+            v = DtoConstStructInitializer(si);
         }
         else if (ArrayInitializer* ai = init->isArrayInitializer())
         {
-            v = LLVM_DtoConstArrayInitializer(ai);
+            v = DtoConstArrayInitializer(ai);
         }
         else if (init->isVoidInitializer())
         {
@@ -308,7 +308,7 @@
         inits[i] = v;
     }
 
-    const llvm::ArrayType* arrty = LLVM_DtoStaticArrayType(t);
+    const llvm::ArrayType* arrty = DtoStaticArrayType(t);
     return llvm::ConstantArray::get(arrty, inits);
 }
 
@@ -323,7 +323,7 @@
         ret = e->mem;
 
         size_t elembsz = gTargetData->getTypeSize(ret->getType());
-        llvm::ConstantInt* elemsz = llvm::ConstantInt::get(LLVM_DtoSize_t(), elembsz, false);
+        llvm::ConstantInt* elemsz = llvm::ConstantInt::get(DtoSize_t(), elembsz, false);
 
         if (llvm::isa<llvm::ConstantInt>(e->arg)) {
             sz = llvm::ConstantExpr::getMul(elemsz, llvm::cast<llvm::Constant>(e->arg));
@@ -333,24 +333,24 @@
         }
     }
     else if (llvm::isa<llvm::ArrayType>(t)) {
-        ret = LLVM_DtoGEPi(e->mem, 0, 0, "tmp", gIR->scopebb());
+        ret = DtoGEPi(e->mem, 0, 0, "tmp", gIR->scopebb());
 
         size_t elembsz = gTargetData->getTypeSize(ret->getType()->getContainedType(0));
-        llvm::ConstantInt* elemsz = llvm::ConstantInt::get(LLVM_DtoSize_t(), elembsz, false);
+        llvm::ConstantInt* elemsz = llvm::ConstantInt::get(DtoSize_t(), elembsz, false);
 
         size_t numelements = llvm::cast<llvm::ArrayType>(t)->getNumElements();
-        llvm::ConstantInt* nelems = llvm::ConstantInt::get(LLVM_DtoSize_t(), numelements, false);
+        llvm::ConstantInt* nelems = llvm::ConstantInt::get(DtoSize_t(), numelements, false);
 
         sz = llvm::ConstantExpr::getMul(elemsz, nelems);
     }
     else if (llvm::isa<llvm::StructType>(t)) {
-        ret = LLVM_DtoGEPi(e->mem, 0, 1, "tmp", gIR->scopebb());
+        ret = DtoGEPi(e->mem, 0, 1, "tmp", gIR->scopebb());
         ret = new llvm::LoadInst(ret, "tmp", gIR->scopebb());
 
         size_t elembsz = gTargetData->getTypeSize(ret->getType()->getContainedType(0));
-        llvm::ConstantInt* elemsz = llvm::ConstantInt::get(LLVM_DtoSize_t(), elembsz, false);
+        llvm::ConstantInt* elemsz = llvm::ConstantInt::get(DtoSize_t(), elembsz, false);
 
-        llvm::Value* len = LLVM_DtoGEPi(e->mem, 0, 0, "tmp", gIR->scopebb());
+        llvm::Value* len = DtoGEPi(e->mem, 0, 0, "tmp", gIR->scopebb());
         len = new llvm::LoadInst(len, "tmp", gIR->scopebb());
         sz = llvm::BinaryOperator::createMul(len,elemsz,"tmp",gIR->scopebb());
     }
@@ -360,7 +360,7 @@
     return ret;
 }
 
-void LLVM_DtoArrayCopy(elem* dst, elem* src)
+void DtoArrayCopy(elem* dst, elem* src)
 {
     Logger::cout() << "Array copy ((((" << *src->mem << ")))) into ((((" << *dst->mem << "))))\n";
 
@@ -387,11 +387,11 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-void LLVM_DtoStaticArrayCopy(llvm::Value* dst, llvm::Value* src)
+void DtoStaticArrayCopy(llvm::Value* dst, llvm::Value* src)
 {
     assert(dst->getType() == src->getType());
     size_t arrsz = gTargetData->getTypeSize(dst->getType()->getContainedType(0));
-    llvm::Value* n = llvm::ConstantInt::get(LLVM_DtoSize_t(), arrsz, false);
+    llvm::Value* n = llvm::ConstantInt::get(DtoSize_t(), arrsz, false);
 
     llvm::Type* arrty = llvm::PointerType::get(llvm::Type::Int8Ty);
     llvm::Value* dstarr = new llvm::BitCastInst(dst,arrty,"tmp",gIR->scopebb());
@@ -409,7 +409,7 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Constant* LLVM_DtoConstSlice(llvm::Constant* dim, llvm::Constant* ptr)
+llvm::Constant* DtoConstSlice(llvm::Constant* dim, llvm::Constant* ptr)
 {
     std::vector<const llvm::Type*> types;
     types.push_back(dim->getType());
@@ -422,73 +422,73 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Value* LLVM_DtoNewDynArray(llvm::Value* dst, llvm::Value* dim, Type* dty, bool doinit)
+llvm::Value* DtoNewDynArray(llvm::Value* dst, llvm::Value* dim, Type* dty, bool doinit)
 {
-    const llvm::Type* ty = LLVM_DtoType(dty);
+    const llvm::Type* ty = DtoType(dty);
     assert(ty != llvm::Type::VoidTy);
     size_t sz = gTargetData->getTypeSize(ty);
-    llvm::ConstantInt* n = llvm::ConstantInt::get(LLVM_DtoSize_t(), sz, false);
+    llvm::ConstantInt* n = llvm::ConstantInt::get(DtoSize_t(), sz, false);
     llvm::Value* bytesize = (sz == 1) ? dim : llvm::BinaryOperator::createMul(n,dim,"tmp",gIR->scopebb());
 
     llvm::Value* nullptr = llvm::ConstantPointerNull::get(llvm::PointerType::get(ty));
 
-    llvm::Value* newptr = LLVM_DtoRealloc(nullptr, bytesize);
+    llvm::Value* newptr = DtoRealloc(nullptr, bytesize);
 
     if (doinit) {
         elem* e = dty->defaultInit()->toElem(gIR);
-        LLVM_DtoArrayInit(newptr,dim,e->getValue());
+        DtoArrayInit(newptr,dim,e->getValue());
         delete e;
     }
 
-    llvm::Value* lenptr = LLVM_DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
+    llvm::Value* lenptr = DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
     new llvm::StoreInst(dim,lenptr,gIR->scopebb());
-    llvm::Value* ptrptr = LLVM_DtoGEPi(dst,0,1,"tmp",gIR->scopebb());
+    llvm::Value* ptrptr = DtoGEPi(dst,0,1,"tmp",gIR->scopebb());
     new llvm::StoreInst(newptr,ptrptr,gIR->scopebb());
 
     return newptr;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-void LLVM_DtoResizeDynArray(llvm::Value* arr, llvm::Value* sz)
+void DtoResizeDynArray(llvm::Value* arr, llvm::Value* sz)
 {
-    llvm::Value* ptr = LLVM_DtoGEPi(arr, 0, 1, "tmp", gIR->scopebb());
+    llvm::Value* ptr = DtoGEPi(arr, 0, 1, "tmp", gIR->scopebb());
     llvm::Value* ptrld = new llvm::LoadInst(ptr,"tmp",gIR->scopebb());
 
     size_t isz = gTargetData->getTypeSize(ptrld->getType()->getContainedType(0));
-    llvm::ConstantInt* n = llvm::ConstantInt::get(LLVM_DtoSize_t(), isz, false);
+    llvm::ConstantInt* n = llvm::ConstantInt::get(DtoSize_t(), isz, false);
     llvm::Value* bytesz = (isz == 1) ? sz : llvm::BinaryOperator::createMul(n,sz,"tmp",gIR->scopebb());
 
-    llvm::Value* newptr = LLVM_DtoRealloc(ptrld, bytesz);
+    llvm::Value* newptr = DtoRealloc(ptrld, bytesz);
     new llvm::StoreInst(newptr,ptr,gIR->scopebb());
 
-    llvm::Value* len = LLVM_DtoGEPi(arr, 0, 0, "tmp", gIR->scopebb());
+    llvm::Value* len = DtoGEPi(arr, 0, 0, "tmp", gIR->scopebb());
     new llvm::StoreInst(sz,len,gIR->scopebb());
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-void LLVM_DtoCatAssignElement(llvm::Value* arr, Expression* exp)
+void DtoCatAssignElement(llvm::Value* arr, Expression* exp)
 {
-    llvm::Value* ptr = LLVM_DtoGEPi(arr, 0, 0, "tmp", gIR->scopebb());
+    llvm::Value* ptr = DtoGEPi(arr, 0, 0, "tmp", gIR->scopebb());
     llvm::Value* idx = new llvm::LoadInst(ptr, "tmp", gIR->scopebb());
     llvm::Value* one = llvm::ConstantInt::get(idx->getType(),1,false);
     llvm::Value* len = llvm::BinaryOperator::createAdd(idx, one, "tmp", gIR->scopebb());
-    LLVM_DtoResizeDynArray(arr,len);
+    DtoResizeDynArray(arr,len);
 
-    ptr = LLVM_DtoGEPi(arr, 0, 1, "tmp", gIR->scopebb());
+    ptr = DtoGEPi(arr, 0, 1, "tmp", gIR->scopebb());
     ptr = new llvm::LoadInst(ptr, "tmp", gIR->scopebb());
     ptr = new llvm::GetElementPtrInst(ptr, idx, "tmp", gIR->scopebb());
 
     elem* e = exp->toElem(gIR);
-    Type* et = LLVM_DtoDType(exp->type);
-    LLVM_DtoAssign(et, ptr, e->getValue());
+    Type* et = DtoDType(exp->type);
+    DtoAssign(et, ptr, e->getValue());
     delete e;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-void LLVM_DtoCatArrays(llvm::Value* arr, Expression* exp1, Expression* exp2)
+void DtoCatArrays(llvm::Value* arr, Expression* exp1, Expression* exp2)
 {
-    Type* t1 = LLVM_DtoDType(exp1->type);
-    Type* t2 = LLVM_DtoDType(exp2->type);
+    Type* t1 = DtoDType(exp1->type);
+    Type* t2 = DtoDType(exp2->type);
 
     assert(t1->ty == Tarray);
     assert(t1->ty == t2->ty);
@@ -502,22 +502,22 @@
     delete e2;
 
     llvm::Value *len1, *len2, *src1, *src2, *res;
-    len1 = gIR->ir->CreateLoad(LLVM_DtoGEPi(a,0,0,"tmp"),"tmp");
-    len2 = gIR->ir->CreateLoad(LLVM_DtoGEPi(b,0,0,"tmp"),"tmp");
+    len1 = gIR->ir->CreateLoad(DtoGEPi(a,0,0,"tmp"),"tmp");
+    len2 = gIR->ir->CreateLoad(DtoGEPi(b,0,0,"tmp"),"tmp");
     res = gIR->ir->CreateAdd(len1,len2,"tmp");
 
-    llvm::Value* mem = LLVM_DtoNewDynArray(arr, res, LLVM_DtoDType(t1->next), false);
+    llvm::Value* mem = DtoNewDynArray(arr, res, DtoDType(t1->next), false);
 
-    src1 = gIR->ir->CreateLoad(LLVM_DtoGEPi(a,0,1,"tmp"),"tmp");
-    src2 = gIR->ir->CreateLoad(LLVM_DtoGEPi(b,0,1,"tmp"),"tmp");
+    src1 = gIR->ir->CreateLoad(DtoGEPi(a,0,1,"tmp"),"tmp");
+    src2 = gIR->ir->CreateLoad(DtoGEPi(b,0,1,"tmp"),"tmp");
 
-    LLVM_DtoMemCpy(mem,src1,len1);
+    DtoMemCpy(mem,src1,len1);
     mem = gIR->ir->CreateGEP(mem,len1,"tmp");
-    LLVM_DtoMemCpy(mem,src2,len2);
+    DtoMemCpy(mem,src2,len2);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Value* LLVM_DtoStaticArrayCompare(TOK op, llvm::Value* l, llvm::Value* r)
+llvm::Value* DtoStaticArrayCompare(TOK op, llvm::Value* l, llvm::Value* r)
 {
     const char* fname;
     if (op == TOKequal)
@@ -536,7 +536,7 @@
     
     llvm::Value* ll = new llvm::BitCastInst(l, llvm::PointerType::get(llvm::Type::Int8Ty), "tmp", gIR->scopebb());
     llvm::Value* rr = new llvm::BitCastInst(r, llvm::PointerType::get(llvm::Type::Int8Ty), "tmp", gIR->scopebb());
-    llvm::Value* n = llvm::ConstantInt::get(LLVM_DtoSize_t(),gTargetData->getTypeSize(arrty),false);
+    llvm::Value* n = llvm::ConstantInt::get(DtoSize_t(),gTargetData->getTypeSize(arrty),false);
 
     std::vector<llvm::Value*> args;
     args.push_back(ll);
@@ -547,7 +547,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoDynArrayCompare(TOK op, llvm::Value* l, llvm::Value* r)
+llvm::Value* DtoDynArrayCompare(TOK op, llvm::Value* l, llvm::Value* r)
 {
     const char* fname;
     if (op == TOKequal)
@@ -568,7 +568,7 @@
     const llvm::Type* elemType = structType->getElementType(1)->getContainedType(0);
 
     std::vector<const llvm::Type*> arrTypes;
-    arrTypes.push_back(LLVM_DtoSize_t());
+    arrTypes.push_back(DtoSize_t());
     arrTypes.push_back(llvm::PointerType::get(llvm::Type::Int8Ty));
     const llvm::StructType* arrType = llvm::StructType::get(arrTypes);
 
@@ -578,26 +578,26 @@
     if (arrty != arrType) {
         llmem= new llvm::AllocaInst(arrType,"tmparr",gIR->topallocapoint());
 
-        llvm::Value* ll = gIR->ir->CreateLoad(LLVM_DtoGEPi(l, 0,0, "tmp"),"tmp");
-        ll = LLVM_DtoArrayCastLength(ll, elemType, llvm::Type::Int8Ty);
-        llvm::Value* lllen = LLVM_DtoGEPi(llmem, 0,0, "tmp");
+        llvm::Value* ll = gIR->ir->CreateLoad(DtoGEPi(l, 0,0, "tmp"),"tmp");
+        ll = DtoArrayCastLength(ll, elemType, llvm::Type::Int8Ty);
+        llvm::Value* lllen = DtoGEPi(llmem, 0,0, "tmp");
         gIR->ir->CreateStore(ll,lllen);
 
-        ll = gIR->ir->CreateLoad(LLVM_DtoGEPi(l, 0,1, "tmp"),"tmp");
+        ll = gIR->ir->CreateLoad(DtoGEPi(l, 0,1, "tmp"),"tmp");
         ll = new llvm::BitCastInst(ll, llvm::PointerType::get(llvm::Type::Int8Ty), "tmp", gIR->scopebb());
-        llvm::Value* llptr = LLVM_DtoGEPi(llmem, 0,1, "tmp");
+        llvm::Value* llptr = DtoGEPi(llmem, 0,1, "tmp");
         gIR->ir->CreateStore(ll,llptr);
 
         rrmem = new llvm::AllocaInst(arrType,"tmparr",gIR->topallocapoint());
 
-        llvm::Value* rr = gIR->ir->CreateLoad(LLVM_DtoGEPi(r, 0,0, "tmp"),"tmp");
-        rr = LLVM_DtoArrayCastLength(rr, elemType, llvm::Type::Int8Ty);
-        llvm::Value* rrlen = LLVM_DtoGEPi(rrmem, 0,0, "tmp");
+        llvm::Value* rr = gIR->ir->CreateLoad(DtoGEPi(r, 0,0, "tmp"),"tmp");
+        rr = DtoArrayCastLength(rr, elemType, llvm::Type::Int8Ty);
+        llvm::Value* rrlen = DtoGEPi(rrmem, 0,0, "tmp");
         gIR->ir->CreateStore(rr,rrlen);
 
-        rr = gIR->ir->CreateLoad(LLVM_DtoGEPi(r, 0,1, "tmp"),"tmp");
+        rr = gIR->ir->CreateLoad(DtoGEPi(r, 0,1, "tmp"),"tmp");
         rr = new llvm::BitCastInst(rr, llvm::PointerType::get(llvm::Type::Int8Ty), "tmp", gIR->scopebb());
-        llvm::Value* rrptr = LLVM_DtoGEPi(rrmem, 0,1, "tmp");
+        llvm::Value* rrptr = DtoGEPi(rrmem, 0,1, "tmp");
         gIR->ir->CreateStore(rr,rrptr);
     }
 
@@ -608,28 +608,28 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Value* LLVM_DtoArrayCastLength(llvm::Value* len, const llvm::Type* elemty, const llvm::Type* newelemty)
+llvm::Value* DtoArrayCastLength(llvm::Value* len, const llvm::Type* elemty, const llvm::Type* newelemty)
 {
     llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_array_cast_len");
     assert(fn);
     std::vector<llvm::Value*> args;
     args.push_back(len);
-    args.push_back(llvm::ConstantInt::get(LLVM_DtoSize_t(), gTargetData->getTypeSize(elemty), false));
-    args.push_back(llvm::ConstantInt::get(LLVM_DtoSize_t(), gTargetData->getTypeSize(newelemty), false));
+    args.push_back(llvm::ConstantInt::get(DtoSize_t(), gTargetData->getTypeSize(elemty), false));
+    args.push_back(llvm::ConstantInt::get(DtoSize_t(), gTargetData->getTypeSize(newelemty), false));
     return new llvm::CallInst(fn, args.begin(), args.end(), "tmp", gIR->scopebb());
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Value* LLVM_DtoDynArrayIs(TOK op, llvm::Value* l, llvm::Value* r)
+llvm::Value* DtoDynArrayIs(TOK op, llvm::Value* l, llvm::Value* r)
 {
     llvm::ICmpInst::Predicate pred = (op == TOKidentity) ? llvm::ICmpInst::ICMP_EQ : llvm::ICmpInst::ICMP_NE;
 
     if (r == NULL) {
-        llvm::Value* ll = gIR->ir->CreateLoad(LLVM_DtoGEPi(l, 0,0, "tmp"),"tmp");
-        llvm::Value* rl = LLVM_DtoConstSize_t(0);
+        llvm::Value* ll = gIR->ir->CreateLoad(DtoGEPi(l, 0,0, "tmp"),"tmp");
+        llvm::Value* rl = DtoConstSize_t(0);
         llvm::Value* b1 = gIR->ir->CreateICmp(pred,ll,rl,"tmp");
 
-        llvm::Value* lp = gIR->ir->CreateLoad(LLVM_DtoGEPi(l, 0,1, "tmp"),"tmp");
+        llvm::Value* lp = gIR->ir->CreateLoad(DtoGEPi(l, 0,1, "tmp"),"tmp");
         const llvm::PointerType* pty = llvm::cast<llvm::PointerType>(lp->getType());
         llvm::Value* rp = llvm::ConstantPointerNull::get(pty);
         llvm::Value* b2 = gIR->ir->CreateICmp(pred,lp,rp,"tmp");
@@ -640,12 +640,12 @@
     else {
         assert(l->getType() == r->getType());
 
-        llvm::Value* ll = gIR->ir->CreateLoad(LLVM_DtoGEPi(l, 0,0, "tmp"),"tmp");
-        llvm::Value* rl = gIR->ir->CreateLoad(LLVM_DtoGEPi(r, 0,0, "tmp"),"tmp");
+        llvm::Value* ll = gIR->ir->CreateLoad(DtoGEPi(l, 0,0, "tmp"),"tmp");
+        llvm::Value* rl = gIR->ir->CreateLoad(DtoGEPi(r, 0,0, "tmp"),"tmp");
         llvm::Value* b1 = gIR->ir->CreateICmp(pred,ll,rl,"tmp");
 
-        llvm::Value* lp = gIR->ir->CreateLoad(LLVM_DtoGEPi(l, 0,1, "tmp"),"tmp");
-        llvm::Value* rp = gIR->ir->CreateLoad(LLVM_DtoGEPi(r, 0,1, "tmp"),"tmp");
+        llvm::Value* lp = gIR->ir->CreateLoad(DtoGEPi(l, 0,1, "tmp"),"tmp");
+        llvm::Value* rp = gIR->ir->CreateLoad(DtoGEPi(r, 0,1, "tmp"),"tmp");
         llvm::Value* b2 = gIR->ir->CreateICmp(pred,lp,rp,"tmp");
 
         llvm::Value* b = gIR->ir->CreateAnd(b1,b2,"tmp");
@@ -654,14 +654,14 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Constant* LLVM_DtoConstStaticArray(const llvm::Type* t, llvm::Constant* c)
+llvm::Constant* DtoConstStaticArray(const llvm::Type* t, llvm::Constant* c)
 {
     assert(llvm::isa<llvm::ArrayType>(t));
     const llvm::ArrayType* at = llvm::cast<llvm::ArrayType>(t);
 
     if (llvm::isa<llvm::ArrayType>(at->getElementType()))
     {
-        c = LLVM_DtoConstStaticArray(at->getElementType(), c);
+        c = DtoConstStaticArray(at->getElementType(), c);
     }
     else {
         assert(at->getElementType() == c->getType());
--- a/gen/arrays.h	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/arrays.h	Thu Nov 01 17:27:18 2007 +0100
@@ -1,33 +1,33 @@
 #ifndef LLVMC_GEN_ARRAYS_H
 #define LLVMC_GEN_ARRAYS_H
 
-const llvm::StructType* LLVM_DtoArrayType(Type* t);
-const llvm::ArrayType* LLVM_DtoStaticArrayType(Type* t);
+const llvm::StructType* DtoArrayType(Type* t);
+const llvm::ArrayType* DtoStaticArrayType(Type* t);
 
-llvm::Constant* LLVM_DtoConstArrayInitializer(ArrayInitializer* si);
-llvm::Constant* LLVM_DtoConstSlice(llvm::Constant* dim, llvm::Constant* ptr);
-llvm::Constant* LLVM_DtoConstStaticArray(const llvm::Type* t, llvm::Constant* c);
+llvm::Constant* DtoConstArrayInitializer(ArrayInitializer* si);
+llvm::Constant* DtoConstSlice(llvm::Constant* dim, llvm::Constant* ptr);
+llvm::Constant* DtoConstStaticArray(const llvm::Type* t, llvm::Constant* c);
 
-void LLVM_DtoArrayCopy(elem* dst, elem* src);
-void LLVM_DtoArrayInit(llvm::Value* l, llvm::Value* r);
-void LLVM_DtoArrayInit(llvm::Value* ptr, llvm::Value* dim, llvm::Value* val);
-void LLVM_DtoArrayAssign(llvm::Value* l, llvm::Value* r);
-void LLVM_DtoSetArray(llvm::Value* arr, llvm::Value* dim, llvm::Value* ptr);
-void LLVM_DtoNullArray(llvm::Value* v);
+void DtoArrayCopy(elem* dst, elem* src);
+void DtoArrayInit(llvm::Value* l, llvm::Value* r);
+void DtoArrayInit(llvm::Value* ptr, llvm::Value* dim, llvm::Value* val);
+void DtoArrayAssign(llvm::Value* l, llvm::Value* r);
+void DtoSetArray(llvm::Value* arr, llvm::Value* dim, llvm::Value* ptr);
+void DtoNullArray(llvm::Value* v);
 
-llvm::Value* LLVM_DtoNewDynArray(llvm::Value* dst, llvm::Value* dim, Type* dty, bool doinit=true);
-void LLVM_DtoResizeDynArray(llvm::Value* arr, llvm::Value* sz);
+llvm::Value* DtoNewDynArray(llvm::Value* dst, llvm::Value* dim, Type* dty, bool doinit=true);
+void DtoResizeDynArray(llvm::Value* arr, llvm::Value* sz);
 
-void LLVM_DtoCatAssignElement(llvm::Value* arr, Expression* exp);
-void LLVM_DtoCatArrays(llvm::Value* arr, Expression* e1, Expression* e2);
+void DtoCatAssignElement(llvm::Value* arr, Expression* exp);
+void DtoCatArrays(llvm::Value* arr, Expression* e1, Expression* e2);
 
-void LLVM_DtoStaticArrayCopy(llvm::Value* dst, llvm::Value* src);
+void DtoStaticArrayCopy(llvm::Value* dst, llvm::Value* src);
 
-llvm::Value* LLVM_DtoStaticArrayCompare(TOK op, llvm::Value* l, llvm::Value* r);
+llvm::Value* DtoStaticArrayCompare(TOK op, llvm::Value* l, llvm::Value* r);
 
-llvm::Value* LLVM_DtoDynArrayCompare(TOK op, llvm::Value* l, llvm::Value* r);
-llvm::Value* LLVM_DtoDynArrayIs(TOK op, llvm::Value* l, llvm::Value* r);
+llvm::Value* DtoDynArrayCompare(TOK op, llvm::Value* l, llvm::Value* r);
+llvm::Value* DtoDynArrayIs(TOK op, llvm::Value* l, llvm::Value* r);
 
-llvm::Value* LLVM_DtoArrayCastLength(llvm::Value* len, const llvm::Type* elemty, const llvm::Type* newelemty);
+llvm::Value* DtoArrayCastLength(llvm::Value* len, const llvm::Type* elemty, const llvm::Type* newelemty);
 
 #endif // LLVMC_GEN_ARRAYS_H
--- a/gen/irstate.c	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/irstate.c	Thu Nov 01 17:27:18 2007 +0100
@@ -122,13 +122,15 @@
 //////////////////////////////////////////////////////////////////////////////////////////
 
 IRFinally::IRFinally()
- : bb(NULL), ret(false), retval(NULL)
 {
+    bb = 0;
+    retbb = 0;
 }
 
-IRFinally::IRFinally(llvm::BasicBlock* b)
- : bb(b), ret(false), retval(NULL)
+IRFinally::IRFinally(llvm::BasicBlock* b, llvm::BasicBlock* rb)
 {
+    bb = b;
+    retbb = rb;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -145,11 +147,12 @@
 IRFunction::IRFunction(FuncDeclaration* fd)
 {
     decl = fd;
-    Type* t = LLVM_DtoDType(fd->type);
+    Type* t = DtoDType(fd->type);
     assert(t->ty == Tfunction);
     type = (TypeFunction*)t;
     func = NULL;
     allocapoint = NULL;
+    finallyretval = NULL;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
--- a/gen/irstate.h	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/irstate.h	Thu Nov 01 17:27:18 2007 +0100
@@ -69,11 +69,10 @@
 struct IRFinally
 {
     llvm::BasicBlock* bb;
-    bool ret;
-    llvm::Value* retval;
+    llvm::BasicBlock* retbb;
 
     IRFinally();
-    IRFinally(llvm::BasicBlock* b);
+    IRFinally(llvm::BasicBlock* b, llvm::BasicBlock* rb);
 };
 
 // represents a function
@@ -87,6 +86,7 @@
     // finally blocks
     typedef std::vector<IRFinally> FinallyVec;
     FinallyVec finallys;
+    llvm::Value* finallyretval;
 
     IRFunction(FuncDeclaration*);
 };
--- a/gen/statements.c	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/statements.c	Thu Nov 01 17:27:18 2007 +0100
@@ -7,6 +7,7 @@
 #include <iostream>
 
 #include "gen/llvm.h"
+#include "llvm/Transforms/Utils/Cloning.h"
 
 #include "total.h"
 #include "init.h"
@@ -40,7 +41,6 @@
             //assert(0);
         }
     }
-
 }
 
 //////////////////////////////////////////////////////////////////////////////
@@ -55,10 +55,10 @@
     {
         Logger::println("return type is: %s", exp->type->toChars());
 
-        Type* exptype = LLVM_DtoDType(exp->type);
+        Type* exptype = DtoDType(exp->type);
         TY expty = exptype->ty;
         if (p->topfunc()->getReturnType() == llvm::Type::VoidTy) {
-            assert(LLVM_DtoIsPassedByRef(exptype));
+            assert(DtoIsPassedByRef(exptype));
 
             TypeFunction* f = p->topfunctype();
             assert(f->llvmRetInPtr && f->llvmRetArg);
@@ -69,23 +69,23 @@
 
             if (expty == Tstruct) {
                 if (!e->inplace)
-                    LLVM_DtoStructCopy(f->llvmRetArg,e->getValue());
+                    DtoStructCopy(f->llvmRetArg,e->getValue());
             }
             else if (expty == Tdelegate) {
                 if (!e->inplace)
-                    LLVM_DtoDelegateCopy(f->llvmRetArg,e->getValue());
+                    DtoDelegateCopy(f->llvmRetArg,e->getValue());
             }
             else if (expty == Tarray) {
                 if (e->type == elem::SLICE) {
                     assert(e->mem);
-                    LLVM_DtoSetArray(f->llvmRetArg,e->arg,e->mem);
+                    DtoSetArray(f->llvmRetArg,e->arg,e->mem);
                 }
                 else if (!e->inplace) {
                     if (e->type == elem::NUL) {
-                        LLVM_DtoNullArray(f->llvmRetArg);
+                        DtoNullArray(f->llvmRetArg);
                     }
                     else {
-                        LLVM_DtoArrayAssign(f->llvmRetArg, e->getValue());
+                        DtoArrayAssign(f->llvmRetArg, e->getValue());
                     }
                 }
             }
@@ -96,8 +96,7 @@
             if (fin.empty())
                 new llvm::ReturnInst(p->scopebb());
             else {
-                new llvm::BranchInst(fin.back().bb, p->scopebb());
-                fin.back().ret = true;
+                new llvm::BranchInst(fin.back().retbb, p->scopebb());
             }
             delete e;
         }
@@ -112,11 +111,11 @@
                 new llvm::ReturnInst(v, p->scopebb());
             }
             else {
-                llvm::Value* rettmp = new llvm::AllocaInst(v->getType(),"tmpreturn",p->topallocapoint());
+                if (!p->func().finallyretval)
+                    p->func().finallyretval = new llvm::AllocaInst(v->getType(),"tmpreturn",p->topallocapoint());
+                llvm::Value* rettmp = p->func().finallyretval;
                 new llvm::StoreInst(v,rettmp,p->scopebb());
-                new llvm::BranchInst(fin.back().bb, p->scopebb());
-                fin.back().ret = true;
-                fin.back().retval = rettmp;
+                new llvm::BranchInst(fin.back().retbb, p->scopebb());
             }
         }
     }
@@ -128,8 +127,7 @@
                 new llvm::ReturnInst(p->scopebb());
             }
             else {
-                new llvm::BranchInst(fin.back().bb, p->scopebb());
-                fin.back().ret = true;
+                new llvm::BranchInst(fin.back().retbb, p->scopebb());
             }
         }
         else {
@@ -173,30 +171,21 @@
 
     llvm::BasicBlock* ifbb = new llvm::BasicBlock("if", gIR->topfunc(), oldend);
     llvm::BasicBlock* endbb = new llvm::BasicBlock("endif", gIR->topfunc(), oldend);
-    llvm::BasicBlock* elsebb = 0;
-    if (elsebody) {
-        elsebb = new llvm::BasicBlock("else", gIR->topfunc(), endbb);
-    }
-    else {
-        elsebb = endbb;
-    }
+    llvm::BasicBlock* elsebb = elsebody ? new llvm::BasicBlock("else", gIR->topfunc(), endbb) : endbb;
 
     if (cond_val->getType() != llvm::Type::Int1Ty) {
         Logger::cout() << "if conditional: " << *cond_val << '\n';
-        cond_val = LLVM_DtoBoolean(cond_val);
+        cond_val = DtoBoolean(cond_val);
     }
     llvm::Value* ifgoback = new llvm::BranchInst(ifbb, elsebb, cond_val, gIR->scopebegin());
 
     // replace current scope
     gIR->scope() = IRScope(ifbb,elsebb);
 
-    bool endifUsed = false;
-
     // do scoped statements
     ifbody->toIR(p);
     if (!gIR->scopereturned()) {
         new llvm::BranchInst(endbb,gIR->scopebegin());
-        endifUsed = true;
     }
 
     if (elsebody) {
@@ -205,7 +194,6 @@
         elsebody->toIR(p);
         if (!gIR->scopereturned()) {
             new llvm::BranchInst(endbb,gIR->scopebegin());
-            endifUsed = true;
         }
     }
 
@@ -223,7 +211,7 @@
     llvm::BasicBlock* oldend = p->scopeend();
 
     llvm::BasicBlock* beginbb = 0;
-    
+
     // remove useless branches by clearing and reusing the current basicblock
     llvm::BasicBlock* bb = p->scopebegin();
     if (bb->empty()) {
@@ -267,7 +255,7 @@
 
     // create the condition
     elem* cond_e = condition->toElem(p);
-    llvm::Value* cond_val = LLVM_DtoBoolean(cond_e->getValue());
+    llvm::Value* cond_val = DtoBoolean(cond_e->getValue());
     delete cond_e;
 
     // conditional branch
@@ -310,7 +298,7 @@
 
     // create the condition
     elem* cond_e = condition->toElem(p);
-    llvm::Value* cond_val = LLVM_DtoBoolean(cond_e->getValue());
+    llvm::Value* cond_val = DtoBoolean(cond_e->getValue());
     delete cond_e;
 
     // conditional branch
@@ -349,7 +337,7 @@
 
     // create the condition
     elem* cond_e = condition->toElem(p);
-    llvm::Value* cond_val = LLVM_DtoBoolean(cond_e->getValue());
+    llvm::Value* cond_val = DtoBoolean(cond_e->getValue());
     delete cond_e;
 
     // conditional branch
@@ -428,51 +416,82 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
+static void replaceFinallyBBs(std::vector<llvm::BasicBlock*>& a, std::vector<llvm::BasicBlock*>& b)
+{
+}
+
 void TryFinallyStatement::toIR(IRState* p)
 {
-    static int wsi = 0;
-    Logger::println("TryFinallyStatement::toIR(%d): %s", wsi++, toChars());
+    Logger::println("TryFinallyStatement::toIR(): %s", toChars());
     LOG_SCOPE;
 
+    // create basic blocks
     llvm::BasicBlock* oldend = p->scopeend();
 
     llvm::BasicBlock* trybb = new llvm::BasicBlock("try", p->topfunc(), oldend);
     llvm::BasicBlock* finallybb = new llvm::BasicBlock("finally", p->topfunc(), oldend);
+    llvm::BasicBlock* finallyretbb = new llvm::BasicBlock("finallyreturn", p->topfunc(), oldend);
     llvm::BasicBlock* endbb = new llvm::BasicBlock("endtryfinally", p->topfunc(), oldend);
 
     // pass the previous BB into this
+    assert(!gIR->scopereturned());
     new llvm::BranchInst(trybb, p->scopebb());
 
+    // do the try block
     p->scope() = IRScope(trybb,finallybb);
+    gIR->func().finallys.push_back(IRFinally(finallybb,finallyretbb));
+    IRFinally& fin = p->func().finallys.back();
 
     assert(body);
-    gIR->func().finallys.push_back(IRFinally(finallybb));
     body->toIR(p);
-    if (!gIR->scopereturned())
+
+    // terminate try BB
+    if (!p->scopereturned())
         new llvm::BranchInst(finallybb, p->scopebb());
 
-    // rewrite the scope
-    p->scope() = IRScope(finallybb,endbb);
-
+    // do finally block
+    p->scope() = IRScope(finallybb,finallyretbb);
     assert(finalbody);
     finalbody->toIR(p);
-    if (gIR->func().finallys.back().ret) {
-        llvm::Value* retval = p->func().finallys.back().retval;
-        if (retval) {
-            retval = new llvm::LoadInst(retval,"tmp",p->scopebb());
-            new llvm::ReturnInst(retval, p->scopebb());
-        }
-        else {
-            new llvm::ReturnInst(p->scopebb());
-        }
-    }
-    else if (!gIR->scopereturned()) {
+
+    // terminate finally
+    if (!gIR->scopereturned()) {
         new llvm::BranchInst(endbb, p->scopebb());
     }
 
-    p->func().finallys.pop_back();
+    // do finally block (return path)
+    p->scope() = IRScope(finallyretbb,endbb);
+    assert(finalbody);
+    finalbody->toIR(p); // hope this will work, otherwise it's time it gets fixed
+
+    // terminate finally (return path)
+    size_t nfin = p->func().finallys.size();
+    if (nfin > 1) {
+        IRFinally& ofin = p->func().finallys[nfin-2];
+        p->ir->CreateBr(ofin.retbb);
+    }
+    // no outer
+    else
+    {
+        llvm::Value* retval = p->func().finallyretval;
+        if (retval) {
+            retval = p->ir->CreateLoad(retval,"tmp");
+            p->ir->CreateRet(retval);
+        }
+        else {
+            FuncDeclaration* fd = p->func().decl;
+            if (fd->isMain()) {
+                assert(fd->type->next->ty == Tvoid);
+                p->ir->CreateRet(DtoConstInt(0));
+            }
+            else {
+                p->ir->CreateRetVoid();
+            }
+        }
+    }
 
     // rewrite the scope
+    p->func().finallys.pop_back();
     p->scope() = IRScope(endbb,oldend);
 }
 
@@ -508,7 +527,7 @@
     Logger::println("*** ATTENTION: throw is not yet implemented, replacing expression with assert(0);");
 
     llvm::Value* line = llvm::ConstantInt::get(llvm::Type::Int32Ty, loc.linnum, false);
-    LLVM_DtoAssert(NULL, line, NULL);
+    DtoAssert(NULL, line, NULL);
 
     /*
     assert(exp);
@@ -653,14 +672,14 @@
 
     llvm::Value* numiters = 0;
 
-    const llvm::Type* keytype = key ? LLVM_DtoType(key->type) : LLVM_DtoSize_t();
+    const llvm::Type* keytype = key ? DtoType(key->type) : DtoSize_t();
     llvm::Value* keyvar = new llvm::AllocaInst(keytype, "foreachkey", p->topallocapoint());
     if (key) key->llvmValue = keyvar;
 
-    const llvm::Type* valtype = LLVM_DtoType(value->type);
+    const llvm::Type* valtype = DtoType(value->type);
     llvm::Value* valvar = !value->isRef() ? new llvm::AllocaInst(valtype, "foreachval", p->topallocapoint()) : NULL;
 
-    Type* aggrtype = LLVM_DtoDType(aggr->type);
+    Type* aggrtype = DtoDType(aggr->type);
     if (aggrtype->ty == Tsarray)
     {
         assert(llvm::isa<llvm::PointerType>(val->getType()));
@@ -676,8 +695,8 @@
             val = arr->mem;
         }
         else {
-            numiters = p->ir->CreateLoad(LLVM_DtoGEPi(val,0,0,"tmp",p->scopebb()));
-            val = p->ir->CreateLoad(LLVM_DtoGEPi(val,0,1,"tmp",p->scopebb()));
+            numiters = p->ir->CreateLoad(DtoGEPi(val,0,0,"tmp",p->scopebb()));
+            val = p->ir->CreateLoad(DtoGEPi(val,0,1,"tmp",p->scopebb()));
         }
     }
     else
@@ -725,7 +744,7 @@
     llvm::Constant* zero = llvm::ConstantInt::get(keytype,0,false);
     llvm::Value* loadedKey = p->ir->CreateLoad(keyvar,"tmp");
     if (aggrtype->ty == Tsarray)
-        value->llvmValue = LLVM_DtoGEP(val,zero,loadedKey,"tmp");
+        value->llvmValue = DtoGEP(val,zero,loadedKey,"tmp");
     else if (aggrtype->ty == Tarray)
         value->llvmValue = new llvm::GetElementPtrInst(val,loadedKey,"tmp",p->scopebb());
 
@@ -733,7 +752,7 @@
         elem* e = new elem;
         e->mem = value->llvmValue;
         e->type = elem::VAR;
-        LLVM_DtoAssign(LLVM_DtoDType(value->type), valvar, e->getValue());
+        DtoAssign(DtoDType(value->type), valvar, e->getValue());
         delete e;
         value->llvmValue = valvar;
     }
--- a/gen/toir.c	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/toir.c	Thu Nov 01 17:27:18 2007 +0100
@@ -59,12 +59,12 @@
             // normal stack variable
             else {
                 // allocate storage on the stack
-                const llvm::Type* lltype = LLVM_DtoType(vd->type);
+                const llvm::Type* lltype = DtoType(vd->type);
                 llvm::AllocaInst* allocainst = new llvm::AllocaInst(lltype, vd->toChars(), p->topallocapoint());
                 //allocainst->setAlignment(vd->type->alignsize()); // TODO
                 vd->llvmValue = allocainst;
             }
-            LLVM_DtoInitializer(vd->init);
+            DtoInitializer(vd->init);
         }
     }
     // struct declaration
@@ -136,7 +136,7 @@
         {
             Logger::println("Id::dollar");
             assert(!p->arrays.empty());
-            llvm::Value* tmp = LLVM_DtoGEPi(p->arrays.back(),0,0,"tmp",p->scopebb());
+            llvm::Value* tmp = DtoGEPi(p->arrays.back(),0,0,"tmp",p->scopebb());
             e->val = new llvm::LoadInst(tmp,"tmp",p->scopebb());
             e->type = elem::VAL;
         }
@@ -146,7 +146,7 @@
             Logger::println("TypeInfoDeclaration");
             tid->toObjFile();
             assert(tid->llvmValue);
-            const llvm::Type* vartype = LLVM_DtoType(type);
+            const llvm::Type* vartype = DtoType(type);
             if (tid->llvmValue->getType() != llvm::PointerType::get(vartype))
                 e->mem = p->ir->CreateBitCast(tid->llvmValue, vartype, "tmp");
             else
@@ -156,7 +156,7 @@
         // nested variable
         else if (vd->nestedref) {
             Logger::println("nested variable");
-            e->mem = LLVM_DtoNestedVariable(vd);
+            e->mem = DtoNestedVariable(vd);
             e->type = elem::VAR;
             e->vardecl = vd;
         }
@@ -173,7 +173,7 @@
                 e->type = elem::VAR;
             }
             else {
-                if (LLVM_DtoIsPassedByRef(vd->type)) {
+                if (DtoIsPassedByRef(vd->type)) {
                     e->mem = vd->llvmValue;
                     e->type = elem::VAR;
                 }
@@ -216,7 +216,7 @@
     else if (SymbolDeclaration* sdecl = var->isSymbolDeclaration())
     {
         // this seems to be the static initialiser for structs
-        Type* sdecltype = LLVM_DtoDType(sdecl->type);
+        Type* sdecltype = DtoDType(sdecl->type);
         Logger::print("Sym: type=%s\n", sdecltype->toChars());
         assert(sdecltype->ty == Tstruct);
         TypeStruct* ts = (TypeStruct*)sdecltype;
@@ -241,7 +241,7 @@
     if (SymbolDeclaration* sdecl = var->isSymbolDeclaration())
     {
         // this seems to be the static initialiser for structs
-        Type* sdecltype = LLVM_DtoDType(sdecl->type);
+        Type* sdecltype = DtoDType(sdecl->type);
         Logger::print("Sym: type=%s\n", sdecltype->toChars());
         assert(sdecltype->ty == Tstruct);
         TypeStruct* ts = (TypeStruct*)sdecltype;
@@ -270,9 +270,9 @@
 {
     Logger::print("IntegerExp::toConstElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
-    const llvm::Type* t = LLVM_DtoType(type);
+    const llvm::Type* t = DtoType(type);
     if (llvm::isa<llvm::PointerType>(t)) {
-        llvm::Constant* i = llvm::ConstantInt::get(LLVM_DtoSize_t(),(uint64_t)value,false);
+        llvm::Constant* i = llvm::ConstantInt::get(DtoSize_t(),(uint64_t)value,false);
         return llvm::ConstantExpr::getIntToPtr(i, t);
     }
     else if (llvm::isa<llvm::IntegerType>(t)) {
@@ -300,8 +300,8 @@
 {
     Logger::print("RealExp::toConstElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
-    Type* t = LLVM_DtoDType(type);
-    const llvm::Type* fty = LLVM_DtoType(t);
+    Type* t = DtoDType(type);
+    const llvm::Type* fty = DtoType(t);
     if (t->ty == Tfloat32 || t->ty == Timaginary32)
         return llvm::ConstantFP::get(fty,float(value));
     else if (t->ty == Tfloat64 || t->ty == Timaginary64 || t->ty == Tfloat80 || t->ty == Timaginary80)
@@ -329,7 +329,7 @@
 {
     Logger::print("NullExp::toConstElem(type=%s): %s\n", type->toChars(),toChars());
     LOG_SCOPE;
-    const llvm::Type* t = LLVM_DtoType(type);
+    const llvm::Type* t = DtoType(type);
     if (type->ty == Tarray) {
         assert(llvm::isa<llvm::StructType>(t));
         return llvm::ConstantAggregateZero::get(t);
@@ -348,12 +348,12 @@
     Logger::print("StringExp::toElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
 
-    Type* dtype = LLVM_DtoDType(type);
+    Type* dtype = DtoDType(type);
 
     assert(dtype->next->ty == Tchar && "Only char is supported");
     assert(sz == 1);
 
-    const llvm::Type* ct = LLVM_DtoType(dtype->next);
+    const llvm::Type* ct = DtoType(dtype->next);
     //printf("ct = %s\n", type->next->toChars());
     const llvm::ArrayType* at = llvm::ArrayType::get(ct,len+1);
 
@@ -372,16 +372,16 @@
     elem* e = new elem;
 
     if (dtype->ty == Tarray) {
-        llvm::Constant* clen = llvm::ConstantInt::get(LLVM_DtoSize_t(),len,false);
+        llvm::Constant* clen = llvm::ConstantInt::get(DtoSize_t(),len,false);
         if (!p->topexp() || p->topexp()->e2 != this) {
-            llvm::Value* tmpmem = new llvm::AllocaInst(LLVM_DtoType(dtype),"tmp",p->topallocapoint());
-            LLVM_DtoSetArray(tmpmem, clen, arrptr);
+            llvm::Value* tmpmem = new llvm::AllocaInst(DtoType(dtype),"tmp",p->topallocapoint());
+            DtoSetArray(tmpmem, clen, arrptr);
             e->mem = tmpmem;
         }
         else if (p->topexp()->e2 == this) {
             llvm::Value* arr = p->topexp()->v;
             assert(arr);
-            LLVM_DtoSetArray(arr, clen, arrptr);
+            DtoSetArray(arr, clen, arrptr);
             e->inplace = true;
         }
         else
@@ -413,7 +413,7 @@
     uint8_t* str = (uint8_t*)string;
     std::string cont((char*)str, len);
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
 
     if (t->ty == Tsarray) {
         return llvm::ConstantArray::get(cont,false);
@@ -432,8 +432,8 @@
     }
 
     if (t->ty == Tarray) {
-        llvm::Constant* clen = llvm::ConstantInt::get(LLVM_DtoSize_t(),len,false);
-        return LLVM_DtoConstSlice(clen, arrptr);
+        llvm::Constant* clen = llvm::ConstantInt::get(DtoSize_t(),len,false);
+        return DtoConstSlice(clen, arrptr);
     }
 
     assert(0);
@@ -457,7 +457,7 @@
 
     if (l->type == elem::ARRAYLEN)
     {
-        LLVM_DtoResizeDynArray(l->mem, r->getValue());
+        DtoResizeDynArray(l->mem, r->getValue());
         delete r;
         delete l;
         return 0;
@@ -467,7 +467,7 @@
     if (l->mem == 0) {
         assert(l->val);
         if (llvm::isa<llvm::Argument>(l->val))
-            LLVM_DtoGiveArgumentStorage(l);
+            DtoGiveArgumentStorage(l);
         else {
             Logger::cout() << "here it comes... " << *l->val << '\n';
             assert(0);
@@ -475,8 +475,8 @@
     }
     //e->val = l->store(r->getValue());
 
-    Type* e1type = LLVM_DtoDType(e1->type);
-    Type* e2type = LLVM_DtoDType(e2->type);
+    Type* e1type = DtoDType(e1->type);
+    Type* e2type = DtoDType(e2->type);
     TY e1ty = e1type->ty;
     TY e2ty = e2type->ty;
 
@@ -490,7 +490,7 @@
         if (e2ty == Tstruct) {
             // struct literals do the assignment themselvs (in place)
             if (!r->inplace) {
-                LLVM_DtoStructCopy(l->mem,r->getValue());
+                DtoStructCopy(l->mem,r->getValue());
             }
             else {
                 e->inplace = true;
@@ -500,7 +500,7 @@
         else if (e2type->isintegral()){
             IntegerExp* iexp = (IntegerExp*)e2;
             assert(iexp->value == 0 && "Only integral struct initializer allowed is zero");
-            LLVM_DtoStructZeroInit(l->mem);
+            DtoStructZeroInit(l->mem);
         }
         // :x
         else
@@ -511,25 +511,25 @@
     }
     else if (e1ty == Tarray) {
         if (e2type->isscalar() || e2type->ty == Tclass){
-            LLVM_DtoArrayInit(l->mem, r->getValue());
+            DtoArrayInit(l->mem, r->getValue());
         }
         else if (e2ty == Tarray) {
             //new llvm::StoreInst(r->val,l->val,p->scopebb());
             if (r->type == elem::NUL) {
                 llvm::Constant* c = llvm::cast<llvm::Constant>(r->val);
                 assert(c->isNullValue());
-                LLVM_DtoNullArray(l->mem);
+                DtoNullArray(l->mem);
                 e->mem = l->mem;
             }
             else if (r->type == elem::SLICE) {
                 if (l->type == elem::SLICE) {
-                    LLVM_DtoArrayCopy(l,r);
+                    DtoArrayCopy(l,r);
                     e->type = elem::SLICE;
                     e->mem = l->mem;
                     e->arg = l->arg;
                 }
                 else {
-                    LLVM_DtoSetArray(l->mem,r->arg,r->mem);
+                    DtoSetArray(l->mem,r->arg,r->mem);
                     e->mem = l->mem;
                 }
             }
@@ -539,7 +539,7 @@
                 e->mem = l->mem;
                 if (!r->inplace) {
                     assert(r->mem);
-                    LLVM_DtoArrayAssign(l->mem, r->mem);
+                    DtoArrayAssign(l->mem, r->mem);
                 }
                 else {
                     e->inplace = true;
@@ -587,7 +587,7 @@
             if (r->type == elem::NUL) {
                 llvm::Constant* c = llvm::cast<llvm::Constant>(r->val);
                 if (c->isNullValue()) {
-                    LLVM_DtoNullDelegate(l->mem);
+                    DtoNullDelegate(l->mem);
                     e->mem = l->mem;
                 }
                 else
@@ -599,7 +599,7 @@
                 e->mem = l->mem;
             }
             else {
-                LLVM_DtoDelegateCopy(l->mem, r->getValue());
+                DtoDelegateCopy(l->mem, r->getValue());
                 e->mem = l->mem;
             }
         }
@@ -629,9 +629,9 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* t = LLVM_DtoDType(type);
-    Type* e1type = LLVM_DtoDType(e1->type);
-    Type* e2type = LLVM_DtoDType(e2->type);
+    Type* t = DtoDType(type);
+    Type* e1type = DtoDType(e1->type);
+    Type* e2type = DtoDType(e2->type);
 
     if (e1type != e2type) {
         if (e1type->ty == Tpointer && e1type->next->ty == Tstruct) {
@@ -641,7 +641,7 @@
 
             TypeStruct* ts = (TypeStruct*)e1type->next;
             std::vector<unsigned> offsets;
-            e->mem = LLVM_DtoIndexStruct(l->getValue(), ts->sym, t->next, cofs->getZExtValue(), offsets);
+            e->mem = DtoIndexStruct(l->getValue(), ts->sym, t->next, cofs->getZExtValue(), offsets);
             e->type = elem::VAR;
             e->field = true;
         }
@@ -672,7 +672,7 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* e1type = LLVM_DtoDType(e1->type);
+    Type* e1type = DtoDType(e1->type);
 
     elem* e = new elem;
     llvm::Value* val = 0;
@@ -686,11 +686,11 @@
     /*llvm::Value* storeVal = l->storeVal ? l->storeVal : l->val;
     if (llvm::isa<llvm::PointerType>(storeVal->getType()) && storeVal->getType()->getContainedType(0) != tmp->getType())
     {
-        tmp = LLVM_DtoPointedType(storeVal, tmp);
+        tmp = DtoPointedType(storeVal, tmp);
     }*/
 
     if (l->mem == 0)
-        LLVM_DtoGiveArgumentStorage(l);
+        DtoGiveArgumentStorage(l);
     new llvm::StoreInst(val,l->mem,p->scopebb());
     e->type = elem::VAR;
 
@@ -711,16 +711,16 @@
 
     llvm::Value* left = l->getValue();
     if (llvm::isa<llvm::PointerType>(left->getType()))
-        left = new llvm::PtrToIntInst(left,LLVM_DtoSize_t(),"tmp",p->scopebb());
+        left = new llvm::PtrToIntInst(left,DtoSize_t(),"tmp",p->scopebb());
 
     llvm::Value* right = r->getValue();
     if (llvm::isa<llvm::PointerType>(right->getType()))
-        right = new llvm::PtrToIntInst(right,LLVM_DtoSize_t(),"tmp",p->scopebb());
+        right = new llvm::PtrToIntInst(right,DtoSize_t(),"tmp",p->scopebb());
 
     e->val = llvm::BinaryOperator::createSub(left,right,"tmp",p->scopebb());
     e->type = elem::VAL;
 
-    const llvm::Type* totype = LLVM_DtoType(type);
+    const llvm::Type* totype = DtoType(type);
     if (e->val->getType() != totype) {
         assert(0);
         assert(llvm::isa<llvm::PointerType>(e->val->getType()));
@@ -743,7 +743,7 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* e1type = LLVM_DtoDType(e1->type);
+    Type* e1type = DtoDType(e1->type);
 
     llvm::Value* tmp = 0;
     if (e1type->ty == Tpointer) {
@@ -759,11 +759,11 @@
     /*llvm::Value* storeVal = l->storeVal ? l->storeVal : l->val;
     if (storeVal->getType()->getContainedType(0) != tmp->getType())
     {
-        tmp = LLVM_DtoPointedType(storeVal, tmp);
+        tmp = DtoPointedType(storeVal, tmp);
     }*/
 
     if (l->mem == 0)
-        LLVM_DtoGiveArgumentStorage(l);
+        DtoGiveArgumentStorage(l);
     new llvm::StoreInst(tmp, l->mem, p->scopebb());
 
     delete l;
@@ -811,11 +811,11 @@
     /*llvm::Value* storeVal = l->storeVal ? l->storeVal : l->val;
     if (storeVal->getType()->getContainedType(0) != tmp->getType())
     {
-        tmp = LLVM_DtoPointedType(storeVal, tmp);
+        tmp = DtoPointedType(storeVal, tmp);
     }*/
 
     if (l->mem == 0)
-        LLVM_DtoGiveArgumentStorage(l);
+        DtoGiveArgumentStorage(l);
     new llvm::StoreInst(tmp,l->mem,p->scopebb());
 
     delete l;
@@ -837,7 +837,7 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
 
     if (t->isunsigned())
         e->val = llvm::BinaryOperator::createUDiv(l->getValue(),r->getValue(),"tmp",p->scopebb());
@@ -863,7 +863,7 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
 
     llvm::Value* tmp;
     if (t->isunsigned())
@@ -878,11 +878,11 @@
     /*llvm::Value* storeVal = l->storeVal ? l->storeVal : l->val;
     if (storeVal->getType()->getContainedType(0) != tmp->getType())
     {
-        tmp = LLVM_DtoPointedType(storeVal, tmp);
+        tmp = DtoPointedType(storeVal, tmp);
     }*/
 
     if (l->mem == 0)
-        LLVM_DtoGiveArgumentStorage(l);
+        DtoGiveArgumentStorage(l);
     new llvm::StoreInst(tmp,l->mem,p->scopebb());
 
     delete l;
@@ -904,7 +904,7 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
 
     if (t->isunsigned())
         e->val = llvm::BinaryOperator::createURem(l->getValue(),r->getValue(),"tmp",p->scopebb());
@@ -930,7 +930,7 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
 
     llvm::Value* tmp;
     if (t->isunsigned())
@@ -945,11 +945,11 @@
     /*llvm::Value* storeVal = l->storeVal ? l->storeVal : l->val;
     if (storeVal->getType()->getContainedType(0) != tmp->getType())
     {
-        tmp = LLVM_DtoPointedType(storeVal, tmp);
+        tmp = DtoPointedType(storeVal, tmp);
     }*/
 
     if (l->mem == 0)
-        LLVM_DtoGiveArgumentStorage(l);
+        DtoGiveArgumentStorage(l);
     new llvm::StoreInst(tmp,l->mem,p->scopebb());
 
     delete l;
@@ -972,7 +972,7 @@
     elem* fn = e1->toElem(p);
 
     TypeFunction* tf = 0;
-    Type* e1type = LLVM_DtoDType(e1->type);
+    Type* e1type = DtoDType(e1->type);
 
     bool delegateCall = false;
     llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty,0,false);
@@ -1025,9 +1025,9 @@
             elem* expelem = exp->toElem(p);
             assert(expelem->mem);
             elem* e = new elem;
-            Type* t = LLVM_DtoDType(type);
-            const llvm::Type* llt = LLVM_DtoType(type);
-            if (LLVM_DtoIsPassedByRef(t))
+            Type* t = DtoDType(type);
+            const llvm::Type* llt = DtoType(type);
+            if (DtoIsPassedByRef(t))
                 llt = llvm::PointerType::get(llt);
             e->type = elem::VAL;
             e->val = p->ir->CreateVAArg(expelem->mem,llt,"tmp");
@@ -1069,7 +1069,7 @@
         }
         // struct pointer - delegate
         else if (llvm::isa<llvm::StructType>(funcval->getType()->getContainedType(0))) {
-            funcval = LLVM_DtoGEP(funcval,zero,one,"tmp",p->scopebb());
+            funcval = DtoGEP(funcval,zero,one,"tmp",p->scopebb());
             funcval = new llvm::LoadInst(funcval,"tmp",p->scopebb());
             const llvm::Type* ty = funcval->getType()->getContainedType(0);
             llfnty = llvm::cast<llvm::FunctionType>(ty);
@@ -1097,7 +1097,7 @@
             assert(topexp->v);
             assert(llvm::isa<llvm::StructType>(topexp->v->getType()->getContainedType(0)));
             llargs[j] = topexp->v;
-            if (LLVM_DtoIsPassedByRef(tf->next)) {
+            if (DtoIsPassedByRef(tf->next)) {
                 e->inplace = true;
             }
             else
@@ -1130,7 +1130,7 @@
     // delegate context arguments
     else if (delegateCall) {
         Logger::println("Delegate Call");
-        llvm::Value* contextptr = LLVM_DtoGEP(fn->mem,zero,zero,"tmp",p->scopebb());
+        llvm::Value* contextptr = DtoGEP(fn->mem,zero,zero,"tmp",p->scopebb());
         llargs[j] = new llvm::LoadInst(contextptr,"tmp",p->scopebb());
         ++j;
         ++argiter;
@@ -1171,7 +1171,7 @@
             for (int i=0; i<arguments->dim; i++) {
                 Argument* fnarg = Argument::getNth(tf->parameters, i);
                 Expression* argexp = (Expression*)arguments->data[i];
-                vvalues.push_back(LLVM_DtoArgument(NULL, fnarg, argexp));
+                vvalues.push_back(DtoArgument(NULL, fnarg, argexp));
                 vtypes.push_back(vvalues.back()->getType());
 
                 TypeInfoDeclaration* tidecl = argexp->type->getTypeInfoDeclaration();
@@ -1183,7 +1183,7 @@
             const llvm::StructType* vtype = llvm::StructType::get(vtypes);
             llvm::Value* mem = new llvm::AllocaInst(vtype,"_argptr_storage",p->topallocapoint());
             for (unsigned i=0; i<vtype->getNumElements(); ++i)
-                p->ir->CreateStore(vvalues[i], LLVM_DtoGEPi(mem,0,i,"tmp"));
+                p->ir->CreateStore(vvalues[i], DtoGEPi(mem,0,i,"tmp"));
 
             //llvm::Constant* typeinfoparam = llvm::ConstantPointerNull::get(llvm::cast<llvm::PointerType>(llfnty->getParamType(j)));
             assert(Type::typeinfo->llvmInitZ);
@@ -1193,13 +1193,13 @@
             llvm::Value* typeinfomem = new llvm::AllocaInst(typeinfoarraytype,"_arguments_storage",p->topallocapoint());
             for (unsigned i=0; i<vtype->getNumElements(); ++i) {
                 llvm::Value* v = p->ir->CreateBitCast(vtypeinfos[i], typeinfotype, "tmp");
-                p->ir->CreateStore(v, LLVM_DtoGEPi(typeinfomem,0,i,"tmp"));
+                p->ir->CreateStore(v, DtoGEPi(typeinfomem,0,i,"tmp"));
             }
 
             llvm::Value* typeinfoarrayparam = new llvm::AllocaInst(llfnty->getParamType(j)->getContainedType(0),"_arguments_array",p->topallocapoint());
-            p->ir->CreateStore(LLVM_DtoConstSize_t(vtype->getNumElements()), LLVM_DtoGEPi(typeinfoarrayparam,0,0,"tmp"));
+            p->ir->CreateStore(DtoConstSize_t(vtype->getNumElements()), DtoGEPi(typeinfoarrayparam,0,0,"tmp"));
             llvm::Value* casttypeinfomem = p->ir->CreateBitCast(typeinfomem, llvm::PointerType::get(typeinfotype), "tmp");
-            p->ir->CreateStore(casttypeinfomem, LLVM_DtoGEPi(typeinfoarrayparam,0,1,"tmp"));
+            p->ir->CreateStore(casttypeinfomem, DtoGEPi(typeinfoarrayparam,0,1,"tmp"));
 
             llargs[j] = typeinfoarrayparam;;
             j++;
@@ -1211,7 +1211,7 @@
             Logger::println("doing normal arguments");
             for (int i=0; i<arguments->dim; i++,j++) {
                 Argument* fnarg = Argument::getNth(tf->parameters, i);
-                llargs[j] = LLVM_DtoArgument(llfnty->getParamType(j), fnarg, (Expression*)arguments->data[i]);
+                llargs[j] = DtoArgument(llfnty->getParamType(j), fnarg, (Expression*)arguments->data[i]);
             }
             Logger::println("%d params passed", n);
             for (int i=0; i<n; ++i) {
@@ -1238,11 +1238,11 @@
     if (fn->funcdecl) {
         int li = fn->funcdecl->llvmInternal;
         if (li != LLVMintrinsic && li != LLVMva_start && li != LLVMva_intrinsic) {
-            call->setCallingConv(LLVM_DtoCallingConv(dlink));
+            call->setCallingConv(DtoCallingConv(dlink));
         }
     }
     else if (delegateCall) {
-        call->setCallingConv(LLVM_DtoCallingConv(dlink));
+        call->setCallingConv(DtoCallingConv(dlink));
     }
     else if (fn->callconv != (unsigned)-1) {
         call->setCallingConv(fn->callconv);
@@ -1260,9 +1260,9 @@
     LOG_SCOPE;
     elem* e = new elem;
     elem* u = e1->toElem(p);
-    const llvm::Type* tolltype = LLVM_DtoType(to);
-    Type* fromtype = LLVM_DtoDType(e1->type);
-    Type* totype = LLVM_DtoDType(to);
+    const llvm::Type* tolltype = DtoType(to);
+    Type* fromtype = DtoDType(e1->type);
+    Type* totype = DtoDType(to);
     int lsz = fromtype->size();
     int rsz = totype->size();
 
@@ -1343,7 +1343,7 @@
             assert(fromtype->next == totype->next || totype->next->ty == Tvoid);
             llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false);
             llvm::Value* one = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1, false);
-            llvm::Value* ptr = LLVM_DtoGEP(u->getValue(),zero,one,"tmp",p->scopebb());
+            llvm::Value* ptr = DtoGEP(u->getValue(),zero,one,"tmp",p->scopebb());
             e->val = new llvm::LoadInst(ptr, "tmp", p->scopebb());
             if (fromtype->next != totype->next)
                 e->val = p->ir->CreateBitCast(e->val, llvm::PointerType::get(llvm::Type::Int8Ty), "tmp");
@@ -1351,12 +1351,12 @@
         }
         else if (totype->ty == Tarray) {
             Logger::cout() << "to array" << '\n';
-            const llvm::Type* ptrty = LLVM_DtoType(totype->next);
+            const llvm::Type* ptrty = DtoType(totype->next);
             if (ptrty == llvm::Type::VoidTy)
                 ptrty = llvm::Type::Int8Ty;
             ptrty = llvm::PointerType::get(ptrty);
 
-            const llvm::Type* ety = LLVM_DtoType(fromtype->next);
+            const llvm::Type* ety = DtoType(fromtype->next);
             if (ety == llvm::Type::VoidTy)
                 ety = llvm::Type::Int8Ty;
 
@@ -1365,7 +1365,7 @@
                 if (fromtype->next->size() == totype->next->size())
                     e->arg = u->arg;
                 else
-                    e->arg = LLVM_DtoArrayCastLength(u->arg, ety, ptrty->getContainedType(0));
+                    e->arg = DtoArrayCastLength(u->arg, ety, ptrty->getContainedType(0));
             }
             else {
                 llvm::Value* uval = u->getValue();
@@ -1373,18 +1373,18 @@
                     Logger::cout() << "uvalTy = " << *uval->getType() << '\n';
                     assert(llvm::isa<llvm::PointerType>(uval->getType()));
                     const llvm::ArrayType* arrty = llvm::cast<llvm::ArrayType>(uval->getType()->getContainedType(0));
-                    e->arg = llvm::ConstantInt::get(LLVM_DtoSize_t(), arrty->getNumElements(), false);
-                    e->arg = LLVM_DtoArrayCastLength(e->arg, ety, ptrty->getContainedType(0));
+                    e->arg = llvm::ConstantInt::get(DtoSize_t(), arrty->getNumElements(), false);
+                    e->arg = DtoArrayCastLength(e->arg, ety, ptrty->getContainedType(0));
                     e->mem = new llvm::BitCastInst(uval, ptrty, "tmp", p->scopebb());
                 }
                 else {
                     llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false);
                     llvm::Value* one = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1, false);
-                    e->arg = LLVM_DtoGEP(uval,zero,zero,"tmp",p->scopebb());
+                    e->arg = DtoGEP(uval,zero,zero,"tmp",p->scopebb());
                     e->arg = new llvm::LoadInst(e->arg, "tmp", p->scopebb());
-                    e->arg = LLVM_DtoArrayCastLength(e->arg, ety, ptrty->getContainedType(0));
-
-                    e->mem = LLVM_DtoGEP(uval,zero,one,"tmp",p->scopebb());
+                    e->arg = DtoArrayCastLength(e->arg, ety, ptrty->getContainedType(0));
+
+                    e->mem = DtoGEP(uval,zero,one,"tmp",p->scopebb());
                     e->mem = new llvm::LoadInst(e->mem, "tmp", p->scopebb());
                     //Logger::cout() << *e->mem->getType() << '|' << *ptrty << '\n';
                     e->mem = new llvm::BitCastInst(e->mem, ptrty, "tmp", p->scopebb());
@@ -1438,24 +1438,24 @@
         }
 
         assert(vd->llvmValue);
-        Type* t = LLVM_DtoDType(type);
-        Type* tnext = LLVM_DtoDType(t->next);
-        Type* vdtype = LLVM_DtoDType(vd->type); 
-
-        llvm::Value* llvalue = vd->nestedref ? LLVM_DtoNestedVariable(vd) : vd->llvmValue;
+        Type* t = DtoDType(type);
+        Type* tnext = DtoDType(t->next);
+        Type* vdtype = DtoDType(vd->type);
+
+        llvm::Value* llvalue = vd->nestedref ? DtoNestedVariable(vd) : vd->llvmValue;
 
         if (vdtype->ty == Tstruct && !(t->ty == Tpointer && t->next == vdtype)) {
             Logger::println("struct");
             TypeStruct* vdt = (TypeStruct*)vdtype;
             assert(vdt->sym);
             e = new elem;
-            const llvm::Type* llt = LLVM_DtoType(t);
+            const llvm::Type* llt = DtoType(t);
             if (offset == 0) {
                 e->mem = p->ir->CreateBitCast(llvalue, llt, "tmp");
             }
             else {
                 std::vector<unsigned> dst;
-                e->mem = LLVM_DtoIndexStruct(llvalue,vdt->sym, tnext, offset, dst);
+                e->mem = DtoIndexStruct(llvalue,vdt->sym, tnext, offset, dst);
             }
             e->type = elem::VAL;
             e->field = true;
@@ -1467,7 +1467,7 @@
             e->arg = llvalue;
             e->type = elem::VAL;
 
-            const llvm::Type* llt = LLVM_DtoType(t);
+            const llvm::Type* llt = DtoType(t);
             llvm::Value* off = 0;
             if (offset != 0) {
                 Logger::println("offset = %d\n", offset);
@@ -1475,11 +1475,11 @@
             if (llvalue->getType() != llt) {
                 e->mem = p->ir->CreateBitCast(llvalue, llt, "tmp");
                 if (offset != 0)
-                    e->mem = LLVM_DtoGEPi(e->mem, offset, "tmp");
+                    e->mem = DtoGEPi(e->mem, offset, "tmp");
             }
             else {
                 assert(offset == 0);
-                e->mem = LLVM_DtoGEPi(llvalue,0,0,"tmp");
+                e->mem = DtoGEPi(llvalue,0,0,"tmp");
             }
         }
         else if (offset == 0) {
@@ -1489,7 +1489,7 @@
             assert(llvalue);
             e->mem = llvalue;
 
-            const llvm::Type* llt = LLVM_DtoType(t);
+            const llvm::Type* llt = DtoType(t);
             if (llvalue->getType() != llt) {
                 e->mem = p->ir->CreateBitCast(e->mem, llt, "tmp");
             }
@@ -1546,8 +1546,8 @@
 
     elem* l = e1->toElem(p);
 
-    Type* t = LLVM_DtoDType(type);
-    Type* e1type = LLVM_DtoDType(e1->type);
+    Type* t = DtoDType(type);
+    Type* e1type = DtoDType(e1->type);
 
     Logger::print("e1->type=%s\n", e1type->toChars());
 
@@ -1559,7 +1559,7 @@
             Logger::println("Struct member offset:%d", vd->offset);
             llvm::Value* src = l->val ? l->val : l->mem;
             std::vector<unsigned> vdoffsets;
-            arrptr = LLVM_DtoIndexStruct(src, ts->sym, vd->type, vd->offset, vdoffsets);
+            arrptr = DtoIndexStruct(src, ts->sym, vd->type, vd->offset, vdoffsets);
         }
         else if (e1->type->ty == Tclass) {
             TypeClass* tc = (TypeClass*)e1type;
@@ -1568,7 +1568,7 @@
             tc->sym->offsetToIndex(vd->type, vd->offset, vdoffsets);
             llvm::Value* src = l->getValue();
             Logger::cout() << "src: " << *src << '\n';
-            arrptr = LLVM_DtoGEP(src,vdoffsets,"tmp",p->scopebb());
+            arrptr = DtoGEP(src,vdoffsets,"tmp",p->scopebb());
         }
         else
             assert(0);
@@ -1593,12 +1593,12 @@
 
             llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false);
             llvm::Value* vtblidx = llvm::ConstantInt::get(llvm::Type::Int32Ty, (size_t)fdecl->vtblIndex, false);
-            funcval = LLVM_DtoGEP(e->arg, zero, zero, "tmp", p->scopebb());
+            funcval = DtoGEP(e->arg, zero, zero, "tmp", p->scopebb());
             funcval = new llvm::LoadInst(funcval,"tmp",p->scopebb());
-            funcval = LLVM_DtoGEP(funcval, zero, vtblidx, toChars(), p->scopebb());
+            funcval = DtoGEP(funcval, zero, vtblidx, toChars(), p->scopebb());
             funcval = new llvm::LoadInst(funcval,"tmp",p->scopebb());
             assert(funcval->getType() == fdecl->llvmValue->getType());
-            e->callconv = LLVM_DtoCallingConv(fdecl->linkage);
+            e->callconv = DtoCallingConv(fdecl->linkage);
         }
         e->val = funcval;
         e->type = elem::FUNC;
@@ -1657,7 +1657,7 @@
     elem* e = new elem;
 
     llvm::Value* sptr;
-    const llvm::Type* llt = LLVM_DtoType(type);
+    const llvm::Type* llt = DtoType(type);
 
     // temporary struct literal
     if (!p->topexp() || p->topexp()->e2 != this)
@@ -1683,7 +1683,7 @@
         for (unsigned i=0; i<n; ++i) {
             Expression* vx = (Expression*)elements->data[i];
             if (!vx) continue;
-            tys.push_back(LLVM_DtoType(vx->type));
+            tys.push_back(DtoType(vx->type));
         }
         const llvm::StructType* t = llvm::StructType::get(tys);
         if (t != llt) {
@@ -1704,7 +1704,7 @@
         if (!vx) continue;
 
         Logger::cout() << "getting index " << j << " of " << *sptr << '\n';
-        llvm::Value* arrptr = LLVM_DtoGEPi(sptr,0,j,"tmp",p->scopebb());
+        llvm::Value* arrptr = DtoGEPi(sptr,0,j,"tmp",p->scopebb());
 
         p->exps.push_back(IRExp(NULL,vx,arrptr));
         elem* ve = vx->toElem(p);
@@ -1714,8 +1714,8 @@
             llvm::Value* val = ve->getValue();
             Logger::cout() << *val << " | " << *arrptr << '\n';
 
-            Type* vxtype = LLVM_DtoDType(vx->type);
-            LLVM_DtoAssign(vxtype, arrptr, val);
+            Type* vxtype = DtoDType(vx->type);
+            DtoAssign(vxtype, arrptr, val);
         }
         delete ve;
 
@@ -1743,8 +1743,8 @@
         vals[i] = vx->toConstElem(p);
     }
 
-    assert(LLVM_DtoDType(type)->ty == Tstruct);
-    const llvm::Type* t = LLVM_DtoType(type);
+    assert(DtoDType(type)->ty == Tstruct);
+    const llvm::Type* t = DtoType(type);
     const llvm::StructType* st = llvm::cast<llvm::StructType>(t);
     return llvm::ConstantStruct::get(st,vals);
 }
@@ -1760,7 +1760,7 @@
 
     elem* l = e1->toElem(p);
 
-    Type* e1type = LLVM_DtoDType(e1->type);
+    Type* e1type = DtoDType(e1->type);
 
     p->arrays.push_back(l->mem); // if $ is used it must be an array so this is fine.
     elem* r = e2->toElem(p);
@@ -1774,10 +1774,10 @@
         arrptr = new llvm::GetElementPtrInst(l->getValue(),r->getValue(),"tmp",p->scopebb());
     }
     else if (e1type->ty == Tsarray) {
-        arrptr = LLVM_DtoGEP(l->getValue(), zero, r->getValue(),"tmp",p->scopebb());
+        arrptr = DtoGEP(l->getValue(), zero, r->getValue(),"tmp",p->scopebb());
     }
     else if (e1type->ty == Tarray) {
-        arrptr = LLVM_DtoGEP(l->mem,zero,one,"tmp",p->scopebb());
+        arrptr = DtoGEP(l->mem,zero,one,"tmp",p->scopebb());
         arrptr = new llvm::LoadInst(arrptr,"tmp",p->scopebb());
         arrptr = new llvm::GetElementPtrInst(arrptr,r->getValue(),"tmp",p->scopebb());
     }
@@ -1799,11 +1799,11 @@
     Logger::print("SliceExp::toElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
     assert(t->ty == Tarray);
 
     elem* v = e1->toElem(p);
-    Type* e1type = LLVM_DtoDType(e1->type);
+    Type* e1type = DtoDType(e1->type);
 
     elem* e = new elem;
     assert(v->mem);
@@ -1829,11 +1829,11 @@
                 e->mem = v->getValue();
             }
             else if (e1type->ty == Tarray) {
-                llvm::Value* tmp = LLVM_DtoGEP(v->mem,zero,one,"tmp",p->scopebb());
+                llvm::Value* tmp = DtoGEP(v->mem,zero,one,"tmp",p->scopebb());
                 e->mem = new llvm::LoadInst(tmp,"tmp",p->scopebb());
             }
             else if (e1type->ty == Tsarray) {
-                e->mem = LLVM_DtoGEP(v->mem,zero,zero,"tmp",p->scopebb());
+                e->mem = DtoGEP(v->mem,zero,zero,"tmp",p->scopebb());
             }
             else
             assert(e->mem);
@@ -1846,12 +1846,12 @@
         else
         {
             if (e1type->ty == Tarray) {
-                llvm::Value* tmp = LLVM_DtoGEP(v->mem,zero,one,"tmp",p->scopebb());
+                llvm::Value* tmp = DtoGEP(v->mem,zero,one,"tmp",p->scopebb());
                 tmp = new llvm::LoadInst(tmp,"tmp",p->scopebb());
                 e->mem = new llvm::GetElementPtrInst(tmp,lo->getValue(),"tmp",p->scopebb());
             }
             else if (e1type->ty == Tsarray) {
-                e->mem = LLVM_DtoGEP(v->mem,zero,lo->getValue(),"tmp",p->scopebb());
+                e->mem = DtoGEP(v->mem,zero,lo->getValue(),"tmp",p->scopebb());
             }
             else if (e1type->ty == Tpointer) {
                 e->mem = new llvm::GetElementPtrInst(v->getValue(),lo->getValue(),"tmp",p->scopebb());
@@ -1897,10 +1897,10 @@
         delete up;
 
         /*
-        llvm::Value* tmpmem = new llvm::AllocaInst(LLVM_DtoType(t),"tmp",p->topallocapoint());
-        llvm::Value* ptr = LLVM_DtoGEPi(tmpmem,0,0,"tmp");
+        llvm::Value* tmpmem = new llvm::AllocaInst(DtoType(t),"tmp",p->topallocapoint());
+        llvm::Value* ptr = DtoGEPi(tmpmem,0,0,"tmp");
         p->ir->CreateStore(e->arg, ptr);
-        ptr = LLVM_DtoGEPi(tmpmem,0,1,"tmp");
+        ptr = DtoGEPi(tmpmem,0,1,"tmp");
         p->ir->CreateStore(e->mem, ptr);
         e->arg = NULL;
         e->mem = tmpmem;
@@ -1929,8 +1929,8 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* t = LLVM_DtoDType(e1->type);
-    Type* e2t = LLVM_DtoDType(e2->type);
+    Type* t = DtoDType(e1->type);
+    Type* e2t = DtoDType(e2->type);
     assert(t == e2t);
 
     if (t->isintegral() || t->ty == Tpointer)
@@ -2038,8 +2038,8 @@
     elem* l = e1->toElem(p);
     elem* r = e2->toElem(p);
 
-    Type* t = LLVM_DtoDType(e1->type);
-    Type* e2t = LLVM_DtoDType(e2->type);
+    Type* t = DtoDType(e1->type);
+    Type* e2t = DtoDType(e2->type);
     assert(t == e2t);
 
     if (t->isintegral() || t->ty == Tpointer)
@@ -2079,17 +2079,17 @@
     else if (t->ty == Tsarray)
     {
         Logger::println("static array");
-        e->val = LLVM_DtoStaticArrayCompare(op,l->mem,r->mem);
+        e->val = DtoStaticArrayCompare(op,l->mem,r->mem);
     }
     else if (t->ty == Tarray)
     {
         Logger::println("dynamic array");
-        e->val = LLVM_DtoDynArrayCompare(op,l->mem,r->mem);
+        e->val = DtoDynArrayCompare(op,l->mem,r->mem);
     }
     else if (t->ty == Tdelegate)
     {
         Logger::println("delegate");
-        e->val = LLVM_DtoCompareDelegate(op,l->mem,r->mem);
+        e->val = DtoCompareDelegate(op,l->mem,r->mem);
     }
     else
     {
@@ -2122,8 +2122,8 @@
     llvm::Value* val = e->val;
     llvm::Value* post = 0;
 
-    Type* e1type = LLVM_DtoDType(e1->type);
-    Type* e2type = LLVM_DtoDType(e2->type);
+    Type* e1type = DtoDType(e1->type);
+    Type* e2type = DtoDType(e2->type);
 
     if (e1type->isintegral())
     {
@@ -2139,8 +2139,8 @@
     else if (e1type->ty == Tpointer)
     {
         assert(e2type->isintegral());
-        llvm::Constant* minusone = llvm::ConstantInt::get(LLVM_DtoSize_t(),(uint64_t)-1,true);
-        llvm::Constant* plusone = llvm::ConstantInt::get(LLVM_DtoSize_t(),(uint64_t)1,false);
+        llvm::Constant* minusone = llvm::ConstantInt::get(DtoSize_t(),(uint64_t)-1,true);
+        llvm::Constant* plusone = llvm::ConstantInt::get(DtoSize_t(),(uint64_t)1,false);
         llvm::Constant* whichone = (op == TOKplusplus) ? plusone : minusone;
         post = new llvm::GetElementPtrInst(val, whichone, "tmp", p->scopebb());
     }
@@ -2159,7 +2159,7 @@
     assert(post);
 
     if (l->mem == 0)
-        LLVM_DtoGiveArgumentStorage(l);
+        DtoGiveArgumentStorage(l);
     new llvm::StoreInst(post,l->mem,p->scopebb());
 
     delete l;
@@ -2183,9 +2183,9 @@
     elem* e = new elem;
     e->inplace = true;
 
-    Type* ntype = LLVM_DtoDType(newtype);
-
-    const llvm::Type* t = LLVM_DtoType(ntype);
+    Type* ntype = DtoDType(newtype);
+
+    const llvm::Type* t = DtoType(ntype);
 
     if (onstack) {
         assert(ntype->ty == Tclass);
@@ -2200,20 +2200,20 @@
             if (arguments->dim == 1) {
                 elem* sz = ((Expression*)arguments->data[0])->toElem(p);
                 llvm::Value* dimval = sz->getValue();
-                Type* nnt = LLVM_DtoDType(ntype->next);
+                Type* nnt = DtoDType(ntype->next);
                 if (nnt->ty == Tvoid)
                     nnt = Type::tint8;
                 if (!p->topexp() || p->topexp()->e2 != this) {
-                    const llvm::Type* restype = LLVM_DtoType(type);
+                    const llvm::Type* restype = DtoType(type);
                     Logger::cout() << "restype = " << *restype << '\n';
                     e->mem = new llvm::AllocaInst(restype,"tmp",p->topallocapoint());
-                    LLVM_DtoNewDynArray(e->mem, dimval, nnt);
+                    DtoNewDynArray(e->mem, dimval, nnt);
                     e->inplace = false;
                 }
                 else if (p->topexp() || p->topexp()->e2 != this) {
                     assert(p->topexp()->v);
                     e->mem = p->topexp()->v;
-                    LLVM_DtoNewDynArray(e->mem, dimval, nnt);
+                    DtoNewDynArray(e->mem, dimval, nnt);
                 }
                 else
                 assert(0);
@@ -2231,14 +2231,14 @@
     if (ntype->ty == Tclass) {
         // first apply the static initializer
         assert(e->mem);
-        LLVM_DtoInitClass((TypeClass*)ntype, e->mem);
+        DtoInitClass((TypeClass*)ntype, e->mem);
 
         // then call constructor
         if (arguments) {
             assert(member);
             assert(member->llvmValue);
             llvm::Function* fn = llvm::cast<llvm::Function>(member->llvmValue);
-            TypeFunction* tf = (TypeFunction*)LLVM_DtoDType(member->type);
+            TypeFunction* tf = (TypeFunction*)DtoDType(member->type);
 
             std::vector<llvm::Value*> ctorargs;
             ctorargs.push_back(e->mem);
@@ -2246,7 +2246,7 @@
             {
                 Expression* ex = (Expression*)arguments->data[i];
                 Argument* fnarg = Argument::getNth(tf->parameters, i);
-                llvm::Value* a = LLVM_DtoArgument(fn->getFunctionType()->getParamType(i+1), fnarg, ex);
+                llvm::Value* a = DtoArgument(fn->getFunctionType()->getParamType(i+1), fnarg, ex);
                 ctorargs.push_back(a);
             }
             e->mem = new llvm::CallInst(fn, ctorargs.begin(), ctorargs.end(), "tmp", p->scopebb());
@@ -2255,10 +2255,10 @@
     else if (ntype->ty == Tstruct) {
         TypeStruct* ts = (TypeStruct*)ntype;
         if (ts->isZeroInit()) {
-            LLVM_DtoStructZeroInit(e->mem);
+            DtoStructZeroInit(e->mem);
         }
         else {
-            LLVM_DtoStructCopy(e->mem,ts->llvmInit);
+            DtoStructCopy(e->mem,ts->llvmInit);
         }
     }
 
@@ -2283,7 +2283,7 @@
     const llvm::Type* t = val->getType();
     llvm::Constant* z = llvm::Constant::getNullValue(t);
 
-    Type* e1type = LLVM_DtoDType(e1->type);
+    Type* e1type = DtoDType(e1->type);
 
     if (e1type->ty == Tpointer) {
         ldval = v->getValue();
@@ -2295,7 +2295,7 @@
     }
     else if (e1type->ty == Tclass) {
         TypeClass* tc = (TypeClass*)e1type;
-        LLVM_DtoCallClassDtors(tc, val);
+        DtoCallClassDtors(tc, val);
 
         if (v->vardecl && !v->vardecl->onstack) {
             new llvm::FreeInst(val, p->scopebb());
@@ -2309,10 +2309,10 @@
         llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false);
         llvm::Value* one = llvm::ConstantInt::get(llvm::Type::Int32Ty, 1, false);
         
-        llvm::Value* ptr = LLVM_DtoGEP(ldval,zero,one,"tmp",p->scopebb());
+        llvm::Value* ptr = DtoGEP(ldval,zero,one,"tmp",p->scopebb());
         ptr = new llvm::LoadInst(ptr,"tmp",p->scopebb());
         new llvm::FreeInst(ptr, p->scopebb());
-        LLVM_DtoNullArray(val);
+        DtoNullArray(val);
     }
     else {
         assert(0);
@@ -2342,7 +2342,7 @@
     else
     {
         llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0, false);
-        llvm::Value* ptr = LLVM_DtoGEP(u->mem,zero,zero,"tmp",p->scopebb());
+        llvm::Value* ptr = DtoGEP(u->mem,zero,zero,"tmp",p->scopebb());
         e->val = new llvm::LoadInst(ptr, "tmp", p->scopebb());
         e->type = elem::VAL;
     }
@@ -2362,7 +2362,7 @@
     elem* m = msg ? msg->toElem(p) : NULL;
 
     llvm::Value* loca = llvm::ConstantInt::get(llvm::Type::Int32Ty, loc.linnum, false);
-    LLVM_DtoAssert(u->getValue(), loca, m ? m->val : NULL);
+    DtoAssert(u->getValue(), loca, m ? m->val : NULL);
 
     delete m;
     delete u;
@@ -2380,7 +2380,7 @@
     elem* e = new elem;
     elem* u = e1->toElem(p);
 
-    llvm::Value* b = LLVM_DtoBoolean(u->getValue());
+    llvm::Value* b = DtoBoolean(u->getValue());
 
     llvm::Value* zero = llvm::ConstantInt::get(llvm::Type::Int1Ty, 0, true);
     e->val = p->ir->CreateICmpEQ(b,zero);
@@ -2411,14 +2411,14 @@
     llvm::BasicBlock* andand = new llvm::BasicBlock("andand", gIR->topfunc(), oldend);
     llvm::BasicBlock* andandend = new llvm::BasicBlock("andandend", gIR->topfunc(), oldend);
     
-    llvm::Value* ubool = LLVM_DtoBoolean(u->getValue());
+    llvm::Value* ubool = DtoBoolean(u->getValue());
     new llvm::StoreInst(ubool,resval,p->scopebb());
     new llvm::BranchInst(andand,andandend,ubool,p->scopebb());
     
     p->scope() = IRScope(andand, andandend);
     elem* v = e2->toElem(p);
 
-    llvm::Value* vbool = LLVM_DtoBoolean(v->getValue());
+    llvm::Value* vbool = DtoBoolean(v->getValue());
     llvm::Value* uandvbool = llvm::BinaryOperator::create(llvm::BinaryOperator::And, ubool, vbool,"tmp",p->scopebb());
     new llvm::StoreInst(uandvbool,resval,p->scopebb());
     new llvm::BranchInst(andandend,p->scopebb());
@@ -2453,14 +2453,14 @@
     llvm::BasicBlock* oror = new llvm::BasicBlock("oror", gIR->topfunc(), oldend);
     llvm::BasicBlock* ororend = new llvm::BasicBlock("ororend", gIR->topfunc(), oldend);
     
-    llvm::Value* ubool = LLVM_DtoBoolean(u->getValue());
+    llvm::Value* ubool = DtoBoolean(u->getValue());
     new llvm::StoreInst(ubool,resval,p->scopebb());
     new llvm::BranchInst(ororend,oror,ubool,p->scopebb());
     
     p->scope() = IRScope(oror, ororend);
     elem* v = e2->toElem(p);
 
-    llvm::Value* vbool = LLVM_DtoBoolean(v->getValue());
+    llvm::Value* vbool = DtoBoolean(v->getValue());
     new llvm::StoreInst(vbool,resval,p->scopebb());
     new llvm::BranchInst(ororend,p->scopebb());
 
@@ -2504,9 +2504,9 @@
     assert(vval); \
     llvm::Value* tmp = llvm::BinaryOperator::create(llvm::Instruction::Y, uval, vval, "tmp", p->scopebb()); \
     if (u->mem == 0) \
-        LLVM_DtoGiveArgumentStorage(u); \
+        DtoGiveArgumentStorage(u); \
     Logger::cout() << *tmp << '|' << *u->mem << '\n'; \
-    new llvm::StoreInst(LLVM_DtoPointedType(u->mem, tmp), u->mem, p->scopebb()); \
+    new llvm::StoreInst(DtoPointedType(u->mem, tmp), u->mem, p->scopebb()); \
     delete u; \
     delete v; \
     elem* e = new elem; \
@@ -2530,7 +2530,7 @@
     LOG_SCOPE;
 
     llvm::Value* loca = llvm::ConstantInt::get(llvm::Type::Int32Ty, loc.linnum, false);
-    LLVM_DtoAssert(llvm::ConstantInt::getFalse(), loca, NULL);
+    DtoAssert(llvm::ConstantInt::getFalse(), loca, NULL);
 
     new llvm::UnreachableInst(p->scopebb());
     return 0;
@@ -2554,11 +2554,11 @@
     assert(p->topexp() && p->topexp()->e2 == this && p->topexp()->v);
     llvm::Value* lval = p->topexp()->v;
 
-    llvm::Value* context = LLVM_DtoGEP(lval,zero,zero,"tmp",p->scopebb());
+    llvm::Value* context = DtoGEP(lval,zero,zero,"tmp",p->scopebb());
     llvm::Value* castcontext = new llvm::BitCastInst(u->getValue(),int8ptrty,"tmp",p->scopebb());
     new llvm::StoreInst(castcontext, context, p->scopebb());
 
-    llvm::Value* fptr = LLVM_DtoGEP(lval,zero,one,"tmp",p->scopebb());
+    llvm::Value* fptr = DtoGEP(lval,zero,one,"tmp",p->scopebb());
 
     assert(func->llvmValue);
     llvm::Value* castfptr = new llvm::BitCastInst(func->llvmValue,fptr->getType()->getContainedType(0),"tmp",p->scopebb());
@@ -2585,7 +2585,7 @@
     llvm::Value* l = u->field ? u->mem : u->getValue();
     llvm::Value* r = v->field ? v->mem : v->getValue();
 
-    Type* t1 = LLVM_DtoDType(e1->type);
+    Type* t1 = DtoDType(e1->type);
 
     if (t1->ty == Tarray) {
         if (v->type == elem::NUL) {
@@ -2594,7 +2594,7 @@
         else {
             assert(l->getType() == r->getType());
         }
-        e->val = LLVM_DtoDynArrayIs(op,l,r);
+        e->val = DtoDynArrayIs(op,l,r);
     }
     else {
         llvm::ICmpInst::Predicate pred = (op == TOKidentity) ? llvm::ICmpInst::ICMP_EQ : llvm::ICmpInst::ICMP_NE;
@@ -2632,8 +2632,8 @@
     Logger::print("CondExp::toElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
 
-    Type* dtype = LLVM_DtoDType(type);
-    const llvm::Type* resty = LLVM_DtoType(dtype);
+    Type* dtype = DtoDType(type);
+    const llvm::Type* resty = DtoType(dtype);
 
     // allocate a temporary for the final result. failed to come up with a better way :/
     llvm::BasicBlock* entryblock = &p->topfunc()->front();
@@ -2645,19 +2645,19 @@
     llvm::BasicBlock* condend = new llvm::BasicBlock("condend", gIR->topfunc(), oldend);
 
     elem* c = econd->toElem(p);
-    llvm::Value* cond_val = LLVM_DtoBoolean(c->getValue());
+    llvm::Value* cond_val = DtoBoolean(c->getValue());
     delete c;
     new llvm::BranchInst(condtrue,condfalse,cond_val,p->scopebb());
 
     p->scope() = IRScope(condtrue, condfalse);
     elem* u = e1->toElem(p);
-    LLVM_DtoAssign(dtype, resval, u->getValue());
+    DtoAssign(dtype, resval, u->getValue());
     new llvm::BranchInst(condend,p->scopebb());
     delete u;
 
     p->scope() = IRScope(condfalse, condend);
     elem* v = e2->toElem(p);
-    LLVM_DtoAssign(dtype, resval, v->getValue());
+    DtoAssign(dtype, resval, v->getValue());
     new llvm::BranchInst(condend,p->scopebb());
     delete v;
 
@@ -2701,7 +2701,7 @@
     llvm::Value* val = l->getValue();
     delete l;
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
 
     llvm::Value* zero = 0;
     if (t->isintegral())
@@ -2730,7 +2730,7 @@
     Logger::print("CatExp::toElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
 
     bool inplace = false;
     llvm::Value* dst = 0;
@@ -2742,11 +2742,11 @@
     }
     else {
         assert(t->ty == Tarray);
-        const llvm::Type* arrty = LLVM_DtoType(t);
+        const llvm::Type* arrty = DtoType(t);
         dst = new llvm::AllocaInst(arrty, "tmpmem", p->topallocapoint());
     }
 
-    LLVM_DtoCatArrays(dst,e1,e2);
+    DtoCatArrays(dst,e1,e2);
 
     elem* e = new elem;
     e->mem = dst;
@@ -2766,12 +2766,12 @@
     elem* l = e1->toElem(p);
     assert(l->mem);
 
-    Type* e1type = LLVM_DtoDType(e1->type);
-    Type* elemtype = LLVM_DtoDType(e1type->next);
-    Type* e2type = LLVM_DtoDType(e2->type);
+    Type* e1type = DtoDType(e1->type);
+    Type* elemtype = DtoDType(e1type->next);
+    Type* e2type = DtoDType(e2->type);
 
     if (e2type == elemtype) {
-        LLVM_DtoCatAssignElement(l->mem,e2);
+        DtoCatAssignElement(l->mem,e2);
     }
     else
         assert(0 && "only one element at a time right now");
@@ -2786,12 +2786,12 @@
     Logger::print("ArrayLiteralExp::toElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
 
-    const llvm::Type* t = LLVM_DtoType(type);
+    const llvm::Type* t = DtoType(type);
     Logger::cout() << "array literal has llvm type: " << *t << '\n';
 
     llvm::Value* mem = 0;
     if (!p->topexp() || p->topexp()->e2 != this) {
-        assert(LLVM_DtoDType(type)->ty == Tsarray);
+        assert(DtoDType(type)->ty == Tsarray);
         mem = new llvm::AllocaInst(t,"tmparrayliteral",p->topallocapoint());
     }
     else if (p->topexp()->e2 == this) {
@@ -2810,7 +2810,7 @@
     for (unsigned i=0; i<elements->dim; ++i)
     {
         Expression* expr = (Expression*)elements->data[i];
-        llvm::Value* elemAddr = LLVM_DtoGEPi(mem,0,i,"tmp",p->scopebb());
+        llvm::Value* elemAddr = DtoGEPi(mem,0,i,"tmp",p->scopebb());
         elem* e = expr->toElem(p);
         new llvm::StoreInst(e->getValue(), elemAddr, p->scopebb());
     }
@@ -2830,7 +2830,7 @@
     Logger::print("ArrayLiteralExp::toConstElem: %s | %s\n", toChars(), type->toChars());
     LOG_SCOPE;
 
-    const llvm::Type* t = LLVM_DtoType(type);
+    const llvm::Type* t = DtoType(type);
     Logger::cout() << "array literal has llvm type: " << *t << '\n';
     assert(llvm::isa<llvm::ArrayType>(t));
     const llvm::ArrayType* arrtype = llvm::cast<llvm::ArrayType>(t);
@@ -2862,7 +2862,7 @@
 
     llvm::Value* lval = NULL;
     if (!p->topexp() || p->topexp()->e2 != this) {
-        const llvm::Type* dgty = LLVM_DtoType(type);
+        const llvm::Type* dgty = DtoType(type);
         Logger::cout() << "delegate without explicit storage:" << '\n' << *dgty << '\n';
         lval = new llvm::AllocaInst(dgty,"dgstorage",p->topallocapoint());
     }
@@ -2875,7 +2875,7 @@
 
     elem* e = new elem;
 
-    llvm::Value* context = LLVM_DtoGEPi(lval,0,0,"tmp",p->scopebb());
+    llvm::Value* context = DtoGEPi(lval,0,0,"tmp",p->scopebb());
     const llvm::PointerType* pty = llvm::cast<llvm::PointerType>(context->getType()->getContainedType(0));
     llvm::Value* llvmNested = p->func().decl->llvmNested;
     if (llvmNested == NULL) {
@@ -2887,7 +2887,7 @@
         p->ir->CreateStore(nestedcontext, context);
     }
 
-    llvm::Value* fptr = LLVM_DtoGEPi(lval,0,1,"tmp",p->scopebb());
+    llvm::Value* fptr = DtoGEPi(lval,0,1,"tmp",p->scopebb());
 
     assert(fd->llvmValue);
     llvm::Value* castfptr = new llvm::BitCastInst(fd->llvmValue,fptr->getType()->getContainedType(0),"tmp",p->scopebb());
--- a/gen/tollvm.c	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/tollvm.c	Thu Nov 01 17:27:18 2007 +0100
@@ -15,23 +15,23 @@
 #include "gen/elem.h"
 #include "gen/arrays.h"
 
-bool LLVM_DtoIsPassedByRef(Type* type)
+bool DtoIsPassedByRef(Type* type)
 {
-    TY t = LLVM_DtoDType(type)->ty;
+    TY t = DtoDType(type)->ty;
     return (t == Tstruct || t == Tarray || t == Tdelegate);
 }
 
-Type* LLVM_DtoDType(Type* t)
+Type* DtoDType(Type* t)
 {
     if (t->ty == Ttypedef) {
         Type* bt = t->toBasetype();
         assert(bt);
-        return LLVM_DtoDType(bt);
+        return DtoDType(bt);
     }
     return t;
 }
 
-const llvm::Type* LLVM_DtoType(Type* t)
+const llvm::Type* DtoType(Type* t)
 {
     assert(t);
     switch (t->ty)
@@ -78,14 +78,14 @@
         if (t->next->ty == Tvoid)
             return (const llvm::Type*)llvm::PointerType::get(llvm::Type::Int8Ty);
         else
-            return (const llvm::Type*)llvm::PointerType::get(LLVM_DtoType(t->next));
+            return (const llvm::Type*)llvm::PointerType::get(DtoType(t->next));
     }
 
     // arrays
     case Tarray:
-        return LLVM_DtoArrayType(t);
+        return DtoArrayType(t);
     case Tsarray:
-        return LLVM_DtoStaticArrayType(t);
+        return DtoStaticArrayType(t);
 
     // void
     case Tvoid:
@@ -144,7 +144,7 @@
     case Tfunction:
     {
         if (t->llvmType == 0) {
-            return LLVM_DtoFunctionType(t,NULL);
+            return DtoFunctionType(t,NULL);
         }
         else {
             return t->llvmType;
@@ -155,7 +155,7 @@
     case Tdelegate:
     {
         if (t->llvmType == 0) {
-            return LLVM_DtoDelegateType(t);
+            return DtoDelegateType(t);
         }
         else {
             return t->llvmType;
@@ -169,7 +169,7 @@
     {
         Type* bt = t->toBasetype();
         assert(bt);
-        return LLVM_DtoType(bt);
+        return DtoType(bt);
     }
 
     default:
@@ -181,7 +181,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const llvm::FunctionType* LLVM_DtoFunctionType(Type* type, const llvm::Type* thistype, bool ismain)
+const llvm::FunctionType* DtoFunctionType(Type* type, const llvm::Type* thistype, bool ismain)
 {
     TypeFunction* f = (TypeFunction*)type;
     assert(f != 0);
@@ -204,13 +204,13 @@
     }
     else {
         assert(rt);
-        if (LLVM_DtoIsPassedByRef(rt)) {
-            rettype = llvm::PointerType::get(LLVM_DtoType(rt));
+        if (DtoIsPassedByRef(rt)) {
+            rettype = llvm::PointerType::get(DtoType(rt));
             actualRettype = llvm::Type::VoidTy;
             f->llvmRetInPtr = retinptr = true;
         }
         else {
-            rettype = LLVM_DtoType(rt);
+            rettype = DtoType(rt);
             actualRettype = rettype;
         }
     }
@@ -234,7 +234,7 @@
             ti->toObjFile();
         assert(ti->llvmInitZ);
         std::vector<const llvm::Type*> types;
-        types.push_back(LLVM_DtoSize_t());
+        types.push_back(DtoSize_t());
         types.push_back(llvm::PointerType::get(llvm::PointerType::get(ti->llvmInitZ->getType())));
         const llvm::Type* t1 = llvm::StructType::get(types);
         paramvec.push_back(llvm::PointerType::get(t1));
@@ -246,7 +246,7 @@
     for (int i=0; i < n; ++i) {
         Argument* arg = Argument::getNth(f->parameters, i);
         // ensure scalar
-        Type* argT = LLVM_DtoDType(arg->type);
+        Type* argT = DtoDType(arg->type);
         assert(argT);
 
         if ((arg->storageClass & STCref) || (arg->storageClass & STCout)) {
@@ -256,7 +256,7 @@
         else
             arg->llvmCopy = true;
 
-        const llvm::Type* at = LLVM_DtoType(argT);
+        const llvm::Type* at = DtoType(argT);
         if (llvm::isa<llvm::StructType>(at)) {
             Logger::println("struct param");
             paramvec.push_back(llvm::PointerType::get(at));
@@ -300,7 +300,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-static const llvm::FunctionType* LLVM_DtoVaFunctionType(FuncDeclaration* fdecl)
+static const llvm::FunctionType* DtoVaFunctionType(FuncDeclaration* fdecl)
 {
     TypeFunction* f = (TypeFunction*)fdecl->type;
     assert(f != 0);
@@ -327,10 +327,10 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const llvm::FunctionType* LLVM_DtoFunctionType(FuncDeclaration* fdecl)
+const llvm::FunctionType* DtoFunctionType(FuncDeclaration* fdecl)
 {
     if ((fdecl->llvmInternal == LLVMva_start) || (fdecl->llvmInternal == LLVMva_intrinsic)) {
-        return LLVM_DtoVaFunctionType(fdecl);
+        return DtoVaFunctionType(fdecl);
     }
 
     // type has already been resolved
@@ -342,7 +342,7 @@
     if (fdecl->needThis()) {
         if (AggregateDeclaration* ad = fdecl->isMember()) {
             Logger::print("isMember = this is: %s\n", ad->type->toChars());
-            thisty = LLVM_DtoType(ad->type);
+            thisty = DtoType(ad->type);
             Logger::cout() << "this llvm type: " << *thisty << '\n';
             if (llvm::isa<llvm::StructType>(thisty) || thisty == gIR->topstruct().recty.get())
                 thisty = llvm::PointerType::get(thisty);
@@ -354,17 +354,17 @@
         thisty = llvm::PointerType::get(llvm::Type::Int8Ty);
     }
 
-    const llvm::FunctionType* functype = LLVM_DtoFunctionType(fdecl->type, thisty, fdecl->isMain());
+    const llvm::FunctionType* functype = DtoFunctionType(fdecl->type, thisty, fdecl->isMain());
     fdecl->type->llvmType = functype;
     return functype;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const llvm::StructType* LLVM_DtoDelegateType(Type* t)
+const llvm::StructType* DtoDelegateType(Type* t)
 {
     const llvm::Type* i8ptr = llvm::PointerType::get(llvm::Type::Int8Ty);
-    const llvm::Type* func = LLVM_DtoFunctionType(t->next, i8ptr);
+    const llvm::Type* func = DtoFunctionType(t->next, i8ptr);
     const llvm::Type* funcptr = llvm::PointerType::get(func);
 
     std::vector<const llvm::Type*> types;
@@ -375,7 +375,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const llvm::Type* LLVM_DtoStructType(Type* t)
+const llvm::Type* DtoStructType(Type* t)
 {
     assert(0);
     std::vector<const llvm::Type*> types;
@@ -456,7 +456,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoStructZeroInit(llvm::Value* v)
+llvm::Value* DtoStructZeroInit(llvm::Value* v)
 {
     assert(gIR);
     uint64_t n = gTargetData->getTypeSize(v->getType()->getContainedType(0));
@@ -480,7 +480,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoStructCopy(llvm::Value* dst, llvm::Value* src)
+llvm::Value* DtoStructCopy(llvm::Value* dst, llvm::Value* src)
 {
     assert(dst->getType() == src->getType());
     assert(gIR);
@@ -504,7 +504,7 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
-llvm::Constant* LLVM_DtoConstStructInitializer(StructInitializer* si)
+llvm::Constant* DtoConstStructInitializer(StructInitializer* si)
 {
     llvm::StructType* structtype = llvm::cast<llvm::StructType>(si->ad->llvmType);
     size_t n = structtype->getNumElements();
@@ -519,7 +519,7 @@
         assert(ini);
 
         VarDeclaration* vd = (VarDeclaration*)si->vars.data[i];
-        Type* vdtype = LLVM_DtoDType(vd->type);
+        Type* vdtype = DtoDType(vd->type);
         assert(vd);
         Logger::println("vars[%d] = %s", i, vd->toChars());
 
@@ -534,11 +534,11 @@
         }
         else if (StructInitializer* si = ini->isStructInitializer())
         {
-            v = LLVM_DtoConstStructInitializer(si);
+            v = DtoConstStructInitializer(si);
         }
         else if (ArrayInitializer* ai = ini->isArrayInitializer())
         {
-            v = LLVM_DtoConstArrayInitializer(ai);
+            v = DtoConstArrayInitializer(ai);
         }
         else if (ini->isVoidInitializer())
         {
@@ -581,7 +581,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoNullDelegate(llvm::Value* v)
+llvm::Value* DtoNullDelegate(llvm::Value* v)
 {
     assert(gIR);
     d_uns64 n = (global.params.is64bit) ? 16 : 8;
@@ -605,7 +605,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoDelegateCopy(llvm::Value* dst, llvm::Value* src)
+llvm::Value* DtoDelegateCopy(llvm::Value* dst, llvm::Value* src)
 {
     assert(dst->getType() == src->getType());
     assert(gIR);
@@ -630,14 +630,14 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoCompareDelegate(TOK op, llvm::Value* lhs, llvm::Value* rhs)
+llvm::Value* DtoCompareDelegate(TOK op, llvm::Value* lhs, llvm::Value* rhs)
 {
     llvm::ICmpInst::Predicate pred = (op == TOKequal) ? llvm::ICmpInst::ICMP_EQ : llvm::ICmpInst::ICMP_NE;
-    llvm::Value* l = gIR->ir->CreateLoad(LLVM_DtoGEPi(lhs,0,0,"tmp"),"tmp");
-    llvm::Value* r = gIR->ir->CreateLoad(LLVM_DtoGEPi(rhs,0,0,"tmp"),"tmp");
+    llvm::Value* l = gIR->ir->CreateLoad(DtoGEPi(lhs,0,0,"tmp"),"tmp");
+    llvm::Value* r = gIR->ir->CreateLoad(DtoGEPi(rhs,0,0,"tmp"),"tmp");
     llvm::Value* b1 = gIR->ir->CreateICmp(pred,l,r,"tmp");
-    l = gIR->ir->CreateLoad(LLVM_DtoGEPi(lhs,0,1,"tmp"),"tmp");
-    r = gIR->ir->CreateLoad(LLVM_DtoGEPi(rhs,0,1,"tmp"),"tmp");
+    l = gIR->ir->CreateLoad(DtoGEPi(lhs,0,1,"tmp"),"tmp");
+    r = gIR->ir->CreateLoad(DtoGEPi(rhs,0,1,"tmp"),"tmp");
     llvm::Value* b2 = gIR->ir->CreateICmp(pred,l,r,"tmp");
     llvm::Value* b = gIR->ir->CreateAnd(b1,b2,"tmp");
     if (op == TOKnotequal)
@@ -647,7 +647,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::GlobalValue::LinkageTypes LLVM_DtoLinkage(PROT prot, uint stc)
+llvm::GlobalValue::LinkageTypes DtoLinkage(PROT prot, uint stc)
 {
     switch(prot)
     {
@@ -673,7 +673,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-unsigned LLVM_DtoCallingConv(LINK l)
+unsigned DtoCallingConv(LINK l)
 {
     if (l == LINKc)
         return llvm::CallingConv::C;
@@ -687,7 +687,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoPointedType(llvm::Value* ptr, llvm::Value* val)
+llvm::Value* DtoPointedType(llvm::Value* ptr, llvm::Value* val)
 {
     const llvm::Type* ptrTy = ptr->getType()->getContainedType(0);
     const llvm::Type* valTy = val->getType();
@@ -720,7 +720,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoBoolean(llvm::Value* val)
+llvm::Value* DtoBoolean(llvm::Value* val)
 {
     const llvm::Type* t = val->getType();
     if (t->isInteger())
@@ -733,7 +733,7 @@
         }
     }
     else if (llvm::isa<llvm::PointerType>(t)) {
-        const llvm::Type* st = LLVM_DtoSize_t();
+        const llvm::Type* st = DtoSize_t();
         llvm::Value* ptrasint = new llvm::PtrToIntInst(val,st,"tmp",gIR->scopebb());
         llvm::Value* zero = llvm::ConstantInt::get(st, 0, false);
         return new llvm::ICmpInst(llvm::ICmpInst::ICMP_NE, ptrasint, zero, "tmp", gIR->scopebb());
@@ -748,7 +748,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-const llvm::Type* LLVM_DtoSize_t()
+const llvm::Type* DtoSize_t()
 {
     if (global.params.is64bit)
     return llvm::Type::Int64Ty;
@@ -758,7 +758,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoMain()
+void DtoMain()
 {
     // emit main function llvm style
     // int main(int argc, char**argv, char**env);
@@ -799,7 +799,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoCallClassDtors(TypeClass* tc, llvm::Value* instance)
+void DtoCallClassDtors(TypeClass* tc, llvm::Value* instance)
 {
     Array* arr = &tc->sym->dtors;
     for (size_t i=0; i<arr->dim; i++)
@@ -812,16 +812,16 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoInitClass(TypeClass* tc, llvm::Value* dst)
+void DtoInitClass(TypeClass* tc, llvm::Value* dst)
 {
     assert(gIR);
 
     assert(tc->llvmType);
-    uint64_t size_t_size = gTargetData->getTypeSize(LLVM_DtoSize_t());
+    uint64_t size_t_size = gTargetData->getTypeSize(DtoSize_t());
     uint64_t n = gTargetData->getTypeSize(tc->llvmType) - size_t_size;
 
     // set vtable field
-    llvm::Value* vtblvar = LLVM_DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
+    llvm::Value* vtblvar = DtoGEPi(dst,0,0,"tmp",gIR->scopebb());
     assert(tc->sym->llvmVtbl);
     new llvm::StoreInst(tc->sym->llvmVtbl, vtblvar, gIR->scopebb());
 
@@ -833,10 +833,10 @@
         llvm::Type* arrty = llvm::PointerType::get(llvm::Type::Int8Ty);
 
         llvm::Value* dstarr = new llvm::BitCastInst(dst,arrty,"tmp",gIR->scopebb());
-        dstarr = LLVM_DtoGEPi(dstarr,size_t_size,"tmp",gIR->scopebb());
+        dstarr = DtoGEPi(dstarr,size_t_size,"tmp",gIR->scopebb());
 
         llvm::Value* srcarr = new llvm::BitCastInst(tc->llvmInit,arrty,"tmp",gIR->scopebb());
-        srcarr = LLVM_DtoGEPi(srcarr,size_t_size,"tmp",gIR->scopebb());
+        srcarr = DtoGEPi(srcarr,size_t_size,"tmp",gIR->scopebb());
 
         llvm::Function* fn = LLVM_DeclareMemCpy32();
         std::vector<llvm::Value*> llargs;
@@ -852,7 +852,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Constant* LLVM_DtoConstInitializer(Type* type, Initializer* init)
+llvm::Constant* DtoConstInitializer(Type* type, Initializer* init)
 {
     llvm::Constant* _init = 0; // may return zero
     if (!init)
@@ -868,17 +868,17 @@
     else if (StructInitializer* si = init->isStructInitializer())
     {
         Logger::println("const struct initializer");
-        _init = LLVM_DtoConstStructInitializer(si);
+        _init = DtoConstStructInitializer(si);
     }
     else if (ArrayInitializer* ai = init->isArrayInitializer())
     {
         Logger::println("const array initializer");
-        _init = LLVM_DtoConstArrayInitializer(ai);
+        _init = DtoConstArrayInitializer(ai);
     }
     else if (init->isVoidInitializer())
     {
         Logger::println("const void initializer");
-        const llvm::Type* ty = LLVM_DtoType(type);
+        const llvm::Type* ty = DtoType(type);
         _init = llvm::Constant::getNullValue(ty);
     }
     else {
@@ -889,7 +889,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoInitializer(Initializer* init)
+void DtoInitializer(Initializer* init)
 {
     if (ExpInitializer* ex = init->isExpInitializer())
     {
@@ -904,7 +904,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoGEP(llvm::Value* ptr, llvm::Value* i0, llvm::Value* i1, const std::string& var, llvm::BasicBlock* bb)
+llvm::Value* DtoGEP(llvm::Value* ptr, llvm::Value* i0, llvm::Value* i1, const std::string& var, llvm::BasicBlock* bb)
 {
     std::vector<llvm::Value*> v(2);
     v[0] = i0;
@@ -915,7 +915,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoGEP(llvm::Value* ptr, const std::vector<unsigned>& src, const std::string& var, llvm::BasicBlock* bb)
+llvm::Value* DtoGEP(llvm::Value* ptr, const std::vector<unsigned>& src, const std::string& var, llvm::BasicBlock* bb)
 {
     size_t n = src.size();
     std::vector<llvm::Value*> dst(n);
@@ -932,14 +932,14 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoGEPi(llvm::Value* ptr, unsigned i, const std::string& var, llvm::BasicBlock* bb)
+llvm::Value* DtoGEPi(llvm::Value* ptr, unsigned i, const std::string& var, llvm::BasicBlock* bb)
 {
     return new llvm::GetElementPtrInst(ptr, llvm::ConstantInt::get(llvm::Type::Int32Ty, i, false), var, bb?bb:gIR->scopebb());
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoGEPi(llvm::Value* ptr, unsigned i0, unsigned i1, const std::string& var, llvm::BasicBlock* bb)
+llvm::Value* DtoGEPi(llvm::Value* ptr, unsigned i0, unsigned i1, const std::string& var, llvm::BasicBlock* bb)
 {
     std::vector<llvm::Value*> v(2);
     v[0] = llvm::ConstantInt::get(llvm::Type::Int32Ty, i0, false);
@@ -949,10 +949,10 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-static llvm::Function* LLVM_DtoDeclareVaFunction(FuncDeclaration* fdecl)
+static llvm::Function* DtoDeclareVaFunction(FuncDeclaration* fdecl)
 {
-    TypeFunction* f = (TypeFunction*)LLVM_DtoDType(fdecl->type);
-    const llvm::FunctionType* fty = LLVM_DtoVaFunctionType(fdecl);
+    TypeFunction* f = (TypeFunction*)DtoDType(fdecl->type);
+    const llvm::FunctionType* fty = DtoVaFunctionType(fdecl);
     llvm::Constant* fn = 0;
 
     if (fdecl->llvmInternal == LLVMva_start) {
@@ -975,10 +975,10 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Function* LLVM_DtoDeclareFunction(FuncDeclaration* fdecl)
+llvm::Function* DtoDeclareFunction(FuncDeclaration* fdecl)
 {
     if ((fdecl->llvmInternal == LLVMva_start) || (fdecl->llvmInternal == LLVMva_intrinsic)) {
-        return LLVM_DtoDeclareVaFunction(fdecl);
+        return DtoDeclareVaFunction(fdecl);
     }
 
     // mangled name
@@ -1004,7 +1004,7 @@
     }
 
     // regular function
-    TypeFunction* f = (TypeFunction*)LLVM_DtoDType(fdecl->type);
+    TypeFunction* f = (TypeFunction*)DtoDType(fdecl->type);
     assert(f != 0);
 
     if (fdecl->llvmValue != 0) {
@@ -1025,16 +1025,16 @@
     }
 
     // construct function
-    const llvm::FunctionType* functype = (f->llvmType == 0) ? LLVM_DtoFunctionType(fdecl) : llvm::cast<llvm::FunctionType>(f->llvmType);
+    const llvm::FunctionType* functype = (f->llvmType == 0) ? DtoFunctionType(fdecl) : llvm::cast<llvm::FunctionType>(f->llvmType);
 
     // make the function
     llvm::Function* func = gIR->module->getFunction(mangled_name);
     if (func == 0) {
-        func = new llvm::Function(functype,LLVM_DtoLinkage(fdecl->protection, fdecl->storage_class),mangled_name,gIR->module);
+        func = new llvm::Function(functype,DtoLinkage(fdecl->protection, fdecl->storage_class),mangled_name,gIR->module);
     }
 
     if (fdecl->llvmInternal != LLVMintrinsic)
-        func->setCallingConv(LLVM_DtoCallingConv(f->linkage));
+        func->setCallingConv(DtoCallingConv(f->linkage));
 
     fdecl->llvmValue = func;
     f->llvmType = functype;
@@ -1093,7 +1093,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoGiveArgumentStorage(elem* l)
+void DtoGiveArgumentStorage(elem* l)
 {
     assert(l->mem == 0);
     assert(l->val);
@@ -1107,21 +1107,21 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoRealloc(llvm::Value* ptr, const llvm::Type* ty)
+llvm::Value* DtoRealloc(llvm::Value* ptr, const llvm::Type* ty)
 {
     /*size_t sz = gTargetData->getTypeSize(ty);
-    llvm::ConstantInt* n = llvm::ConstantInt::get(LLVM_DtoSize_t(), sz, false);
+    llvm::ConstantInt* n = llvm::ConstantInt::get(DtoSize_t(), sz, false);
     if (ptr == 0) {
         llvm::PointerType* i8pty = llvm::PointerType::get(llvm::Type::Int8Ty);
         ptr = llvm::ConstantPointerNull::get(i8pty);
     }
-    return LLVM_DtoRealloc(ptr, n);*/
+    return DtoRealloc(ptr, n);*/
     return NULL;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoRealloc(llvm::Value* ptr, llvm::Value* n)
+llvm::Value* DtoRealloc(llvm::Value* ptr, llvm::Value* n)
 {
     assert(ptr);
     assert(n);
@@ -1146,12 +1146,12 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoAssert(llvm::Value* cond, llvm::Value* loc, llvm::Value* msg)
+void DtoAssert(llvm::Value* cond, llvm::Value* loc, llvm::Value* msg)
 {
     assert(loc);
     std::vector<llvm::Value*> llargs;
     llargs.resize(3);
-    llargs[0] = cond ? LLVM_DtoBoolean(cond) : llvm::ConstantInt::getFalse();
+    llargs[0] = cond ? DtoBoolean(cond) : llvm::ConstantInt::getFalse();
     llargs[1] = loc;
     llargs[2] = msg ? msg : llvm::ConstantPointerNull::get(llvm::PointerType::get(llvm::Type::Int8Ty));
 
@@ -1163,7 +1163,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoArgument(const llvm::Type* paramtype, Argument* fnarg, Expression* argexp)
+llvm::Value* DtoArgument(const llvm::Type* paramtype, Argument* fnarg, Expression* argexp)
 {
     llvm::Value* retval = 0;
 
@@ -1183,9 +1183,9 @@
         return retval;
     }
 
-    Type* realtype = LLVM_DtoDType(argexp->type);
+    Type* realtype = DtoDType(argexp->type);
     TY argty = realtype->ty;
-    if (LLVM_DtoIsPassedByRef(realtype)) {
+    if (DtoIsPassedByRef(realtype)) {
         if (!fnarg || !fnarg->llvmCopy) {
             retval = arg->getValue();
             assert(retval != 0);
@@ -1194,24 +1194,24 @@
             llvm::Value* allocaInst = 0;
             llvm::BasicBlock* entryblock = &gIR->topfunc()->front();
             //const llvm::PointerType* pty = llvm::cast<llvm::PointerType>(arg->mem->getType());
-            const llvm::Type* realtypell = LLVM_DtoType(realtype);
+            const llvm::Type* realtypell = DtoType(realtype);
             const llvm::PointerType* pty = llvm::PointerType::get(realtypell);
             if (argty == Tstruct) {
                 allocaInst = new llvm::AllocaInst(pty->getElementType(), "tmpparam", gIR->topallocapoint());
-                LLVM_DtoStructCopy(allocaInst,arg->mem);
+                DtoStructCopy(allocaInst,arg->mem);
             }
             else if (argty == Tdelegate) {
                 allocaInst = new llvm::AllocaInst(pty->getElementType(), "tmpparam", gIR->topallocapoint());
-                LLVM_DtoDelegateCopy(allocaInst,arg->mem);
+                DtoDelegateCopy(allocaInst,arg->mem);
             }
             else if (argty == Tarray) {
                 if (arg->type == elem::SLICE) {
                     allocaInst = new llvm::AllocaInst(realtypell, "tmpparam", gIR->topallocapoint());
-                    LLVM_DtoSetArray(allocaInst, arg->arg, arg->mem);
+                    DtoSetArray(allocaInst, arg->arg, arg->mem);
                 }
                 else {
                     allocaInst = new llvm::AllocaInst(pty->getElementType(), "tmpparam", gIR->topallocapoint());
-                    LLVM_DtoArrayAssign(allocaInst,arg->mem);
+                    DtoArrayAssign(allocaInst,arg->mem);
                 }
             }
             else
@@ -1235,7 +1235,7 @@
         if (paramtype && retval->getType() != paramtype)
         {
             assert(retval->getType() == paramtype->getContainedType(0));
-            LLVM_DtoGiveArgumentStorage(arg);
+            DtoGiveArgumentStorage(arg);
             new llvm::StoreInst(retval, arg->mem, gIR->scopebb());
             retval = arg->mem;
         }
@@ -1260,7 +1260,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoNestedVariable(VarDeclaration* vd)
+llvm::Value* DtoNestedVariable(VarDeclaration* vd)
 {
     FuncDeclaration* fd = vd->toParent()->isFuncDeclaration();
     assert(fd != NULL);
@@ -1270,8 +1270,8 @@
 
     // on this stack
     if (fd == f) {
-        llvm::Value* v = LLVM_DtoGEPi(vd->llvmValue,0,unsigned(vd->llvmNestedIndex),"tmp");
-        if (vd->isParameter() && (vd->isRef() || vd->isOut() || LLVM_DtoIsPassedByRef(vd->type))) {
+        llvm::Value* v = DtoGEPi(vd->llvmValue,0,unsigned(vd->llvmNestedIndex),"tmp");
+        if (vd->isParameter() && (vd->isRef() || vd->isOut() || DtoIsPassedByRef(vd->type))) {
             Logger::cout() << "1267 loading: " << *v << '\n';
             v = gIR->ir->CreateLoad(v,"tmp");
         }
@@ -1294,15 +1294,15 @@
 
     while (f) {
         if (fd == f) {
-            llvm::Value* v = LLVM_DtoGEPi(ptr,0,vd->llvmNestedIndex,"tmp");
-            if (vd->isParameter() && (vd->isRef() || vd->isOut() || LLVM_DtoIsPassedByRef(vd->type))) {
+            llvm::Value* v = DtoGEPi(ptr,0,vd->llvmNestedIndex,"tmp");
+            if (vd->isParameter() && (vd->isRef() || vd->isOut() || DtoIsPassedByRef(vd->type))) {
                 Logger::cout() << "1291 loading: " << *v << '\n';
                 v = gIR->ir->CreateLoad(v,"tmp");
             }
             return v;
         }
         else {
-            ptr = LLVM_DtoGEPi(ptr,0,0,"tmp");
+            ptr = DtoGEPi(ptr,0,0,"tmp");
             ptr = gIR->ir->CreateLoad(ptr,"tmp");
         }
         f = f->toParent()->isFuncDeclaration();
@@ -1314,25 +1314,25 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoAssign(Type* t, llvm::Value* lhs, llvm::Value* rhs)
+void DtoAssign(Type* t, llvm::Value* lhs, llvm::Value* rhs)
 {
     Logger::cout() << "assignment:" << '\n' << *lhs << *rhs << '\n';
 
     if (t->ty == Tstruct) {
         assert(lhs->getType() == rhs->getType());
-        LLVM_DtoStructCopy(lhs,rhs);
+        DtoStructCopy(lhs,rhs);
     }
     else if (t->ty == Tarray) {
         assert(lhs->getType() == rhs->getType());
-        LLVM_DtoArrayAssign(lhs,rhs);
+        DtoArrayAssign(lhs,rhs);
     }
     else if (t->ty == Tsarray) {
         assert(lhs->getType() == rhs->getType());
-        LLVM_DtoStaticArrayCopy(lhs,rhs);
+        DtoStaticArrayCopy(lhs,rhs);
     }
     else if (t->ty == Tdelegate) {
         assert(lhs->getType() == rhs->getType());
-        LLVM_DtoDelegateCopy(lhs,rhs);
+        DtoDelegateCopy(lhs,rhs);
     }
     else {
         assert(lhs->getType()->getContainedType(0) == rhs->getType());
@@ -1342,33 +1342,41 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::ConstantInt* LLVM_DtoConstSize_t(size_t i)
+llvm::ConstantInt* DtoConstSize_t(size_t i)
 {
-    return llvm::ConstantInt::get(LLVM_DtoSize_t(), i, false);
+    return llvm::ConstantInt::get(DtoSize_t(), i, false);
 }
-llvm::ConstantInt* LLVM_DtoConstUint(unsigned i)
+llvm::ConstantInt* DtoConstUint(unsigned i)
 {
     return llvm::ConstantInt::get(llvm::Type::Int32Ty, i, false);
 }
+llvm::ConstantInt* DtoConstInt(int i)
+{
+    return llvm::ConstantInt::get(llvm::Type::Int32Ty, i, true);
+}
+llvm::Constant* DtoConstBool(bool b)
+{
+    return llvm::ConstantInt::get(llvm::Type::Int1Ty, b, false);
+}
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Constant* LLVM_DtoConstString(const char* str)
+llvm::Constant* DtoConstString(const char* str)
 {
     std::string s(str);
     llvm::Constant* init = llvm::ConstantArray::get(s, true);
     llvm::GlobalVariable* gvar = new llvm::GlobalVariable(
         init->getType(), true,llvm::GlobalValue::InternalLinkage, init, "stringliteral", gIR->module);
-    llvm::Constant* idxs[2] = { LLVM_DtoConstUint(0), LLVM_DtoConstUint(0) };
-    return LLVM_DtoConstSlice(
-        LLVM_DtoConstSize_t(s.length()),
+    llvm::Constant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) };
+    return DtoConstSlice(
+        DtoConstSize_t(s.length()),
         llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2)
     );
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVM_DtoMemCpy(llvm::Value* dst, llvm::Value* src, llvm::Value* nbytes)
+void DtoMemCpy(llvm::Value* dst, llvm::Value* src, llvm::Value* nbytes)
 {
     assert(dst->getType() == src->getType());
 
@@ -1398,7 +1406,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Value* LLVM_DtoIndexStruct(llvm::Value* ptr, StructDeclaration* sd, Type* t, unsigned os, std::vector<unsigned>& idxs)
+llvm::Value* DtoIndexStruct(llvm::Value* ptr, StructDeclaration* sd, Type* t, unsigned os, std::vector<unsigned>& idxs)
 {
     Logger::println("checking for offset %u type %s:", os, t->toChars());
     LOG_SCOPE;
@@ -1406,20 +1414,20 @@
     if (idxs.empty())
         idxs.push_back(0);
 
-    const llvm::Type* llt = llvm::PointerType::get(LLVM_DtoType(t));
+    const llvm::Type* llt = llvm::PointerType::get(DtoType(t));
 
     for (unsigned i=0; i<sd->fields.dim; ++i) {
         VarDeclaration* vd = (VarDeclaration*)sd->fields.data[i];
-        Type* vdtype = LLVM_DtoDType(vd->type);
+        Type* vdtype = DtoDType(vd->type);
         Logger::println("found %u type %s", vd->offset, vdtype->toChars());
         assert(vd->llvmFieldIndex >= 0);
         if (os == vd->offset && vdtype == t) {
             idxs.push_back(vd->llvmFieldIndex);
-            ptr = LLVM_DtoGEP(ptr, idxs, "tmp");
+            ptr = DtoGEP(ptr, idxs, "tmp");
             if (ptr->getType() != llt)
                 ptr = gIR->ir->CreateBitCast(ptr, llt, "tmp");
             if (vd->llvmFieldIndexOffset)
-                ptr = new llvm::GetElementPtrInst(ptr, LLVM_DtoConstUint(vd->llvmFieldIndexOffset), "tmp", gIR->scopebb());
+                ptr = new llvm::GetElementPtrInst(ptr, DtoConstUint(vd->llvmFieldIndexOffset), "tmp", gIR->scopebb());
             return ptr;
         }
         else if (vdtype->ty == Tstruct && (vd->offset + vdtype->size()) > os) {
@@ -1428,22 +1436,22 @@
             idxs.push_back(vd->llvmFieldIndex);
             if (vd->llvmFieldIndexOffset) {
                 Logger::println("has union field offset");
-                ptr = LLVM_DtoGEP(ptr, idxs, "tmp");
+                ptr = DtoGEP(ptr, idxs, "tmp");
                 if (ptr->getType() != llt)
                     ptr = gIR->ir->CreateBitCast(ptr, llt, "tmp");
-                ptr = new llvm::GetElementPtrInst(ptr, LLVM_DtoConstUint(vd->llvmFieldIndexOffset), "tmp", gIR->scopebb());
+                ptr = new llvm::GetElementPtrInst(ptr, DtoConstUint(vd->llvmFieldIndexOffset), "tmp", gIR->scopebb());
                 std::vector<unsigned> tmp;
-                return LLVM_DtoIndexStruct(ptr, ssd, t, os-vd->offset, tmp);
+                return DtoIndexStruct(ptr, ssd, t, os-vd->offset, tmp);
             }
             else {
-                const llvm::Type* sty = llvm::PointerType::get(LLVM_DtoType(vd->type));
+                const llvm::Type* sty = llvm::PointerType::get(DtoType(vd->type));
                 if (ptr->getType() != sty) {
                     ptr = gIR->ir->CreateBitCast(ptr, sty, "tmp");
                     std::vector<unsigned> tmp;
-                    return LLVM_DtoIndexStruct(ptr, ssd, t, os-vd->offset, tmp);
+                    return DtoIndexStruct(ptr, ssd, t, os-vd->offset, tmp);
                 }
                 else {
-                    return LLVM_DtoIndexStruct(ptr, ssd, t, os-vd->offset, idxs);
+                    return DtoIndexStruct(ptr, ssd, t, os-vd->offset, idxs);
                 }
             }
         }
@@ -1452,5 +1460,5 @@
     size_t llt_sz = gTargetData->getTypeSize(llt->getContainedType(0));
     assert(os % llt_sz == 0);
     ptr = gIR->ir->CreateBitCast(ptr, llt, "tmp");
-    return new llvm::GetElementPtrInst(ptr, LLVM_DtoConstUint(os / llt_sz), "tmp", gIR->scopebb());
+    return new llvm::GetElementPtrInst(ptr, DtoConstUint(os / llt_sz), "tmp", gIR->scopebb());
 }
--- a/gen/tollvm.h	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/tollvm.h	Thu Nov 01 17:27:18 2007 +0100
@@ -2,69 +2,71 @@
 
 struct StructInitializer;
 
-const llvm::Type* LLVM_DtoType(Type* t);
-bool LLVM_DtoIsPassedByRef(Type* type);
-Type* LLVM_DtoDType(Type* t);
+const llvm::Type* DtoType(Type* t);
+bool DtoIsPassedByRef(Type* type);
+Type* DtoDType(Type* t);
 
-const llvm::Type* LLVM_DtoStructType(Type* t);
-llvm::Value* LLVM_DtoStructZeroInit(llvm::Value* v);
-llvm::Value* LLVM_DtoStructCopy(llvm::Value* dst, llvm::Value* src);
-llvm::Constant* LLVM_DtoConstStructInitializer(StructInitializer* si);
+const llvm::Type* DtoStructType(Type* t);
+llvm::Value* DtoStructZeroInit(llvm::Value* v);
+llvm::Value* DtoStructCopy(llvm::Value* dst, llvm::Value* src);
+llvm::Constant* DtoConstStructInitializer(StructInitializer* si);
 
-const llvm::FunctionType* LLVM_DtoFunctionType(Type* t, const llvm::Type* thistype, bool ismain = false);
-const llvm::FunctionType* LLVM_DtoFunctionType(FuncDeclaration* fdecl);
-llvm::Function* LLVM_DtoDeclareFunction(FuncDeclaration* fdecl);
+const llvm::FunctionType* DtoFunctionType(Type* t, const llvm::Type* thistype, bool ismain = false);
+const llvm::FunctionType* DtoFunctionType(FuncDeclaration* fdecl);
+llvm::Function* DtoDeclareFunction(FuncDeclaration* fdecl);
 
-const llvm::StructType* LLVM_DtoDelegateType(Type* t);
-llvm::Value* LLVM_DtoNullDelegate(llvm::Value* v);
-llvm::Value* LLVM_DtoDelegateCopy(llvm::Value* dst, llvm::Value* src);
-llvm::Value* LLVM_DtoCompareDelegate(TOK op, llvm::Value* lhs, llvm::Value* rhs);
+const llvm::StructType* DtoDelegateType(Type* t);
+llvm::Value* DtoNullDelegate(llvm::Value* v);
+llvm::Value* DtoDelegateCopy(llvm::Value* dst, llvm::Value* src);
+llvm::Value* DtoCompareDelegate(TOK op, llvm::Value* lhs, llvm::Value* rhs);
 
-llvm::GlobalValue::LinkageTypes LLVM_DtoLinkage(PROT prot, uint stc);
-unsigned LLVM_DtoCallingConv(LINK l);
+llvm::GlobalValue::LinkageTypes DtoLinkage(PROT prot, uint stc);
+unsigned DtoCallingConv(LINK l);
 
-llvm::Value* LLVM_DtoPointedType(llvm::Value* ptr, llvm::Value* val);
-llvm::Value* LLVM_DtoBoolean(llvm::Value* val);
+llvm::Value* DtoPointedType(llvm::Value* ptr, llvm::Value* val);
+llvm::Value* DtoBoolean(llvm::Value* val);
 
-const llvm::Type* LLVM_DtoSize_t();
+const llvm::Type* DtoSize_t();
 
-void LLVM_DtoMain();
+void DtoMain();
 
-void LLVM_DtoCallClassDtors(TypeClass* tc, llvm::Value* instance);
-void LLVM_DtoInitClass(TypeClass* tc, llvm::Value* dst);
+void DtoCallClassDtors(TypeClass* tc, llvm::Value* instance);
+void DtoInitClass(TypeClass* tc, llvm::Value* dst);
 
-llvm::Constant* LLVM_DtoConstInitializer(Type* type, Initializer* init);
-void LLVM_DtoInitializer(Initializer* init);
+llvm::Constant* DtoConstInitializer(Type* type, Initializer* init);
+void DtoInitializer(Initializer* init);
 
 llvm::Function* LLVM_DeclareMemSet32();
 llvm::Function* LLVM_DeclareMemSet64();
 llvm::Function* LLVM_DeclareMemCpy32();
 llvm::Function* LLVM_DeclareMemCpy64();
 
-llvm::Value* LLVM_DtoGEP(llvm::Value* ptr, llvm::Value* i0, llvm::Value* i1, const std::string& var, llvm::BasicBlock* bb=NULL);
-llvm::Value* LLVM_DtoGEP(llvm::Value* ptr, const std::vector<unsigned>& src, const std::string& var, llvm::BasicBlock* bb=NULL);
-llvm::Value* LLVM_DtoGEPi(llvm::Value* ptr, unsigned i0, const std::string& var, llvm::BasicBlock* bb=NULL);
-llvm::Value* LLVM_DtoGEPi(llvm::Value* ptr, unsigned i0, unsigned i1, const std::string& var, llvm::BasicBlock* bb=NULL);
+llvm::Value* DtoGEP(llvm::Value* ptr, llvm::Value* i0, llvm::Value* i1, const std::string& var, llvm::BasicBlock* bb=NULL);
+llvm::Value* DtoGEP(llvm::Value* ptr, const std::vector<unsigned>& src, const std::string& var, llvm::BasicBlock* bb=NULL);
+llvm::Value* DtoGEPi(llvm::Value* ptr, unsigned i0, const std::string& var, llvm::BasicBlock* bb=NULL);
+llvm::Value* DtoGEPi(llvm::Value* ptr, unsigned i0, unsigned i1, const std::string& var, llvm::BasicBlock* bb=NULL);
+
+void DtoGiveArgumentStorage(elem* e);
 
-void LLVM_DtoGiveArgumentStorage(elem* e);
+llvm::Value* DtoRealloc(llvm::Value* ptr, const llvm::Type* ty);
+llvm::Value* DtoRealloc(llvm::Value* ptr, llvm::Value* len);
 
-llvm::Value* LLVM_DtoRealloc(llvm::Value* ptr, const llvm::Type* ty);
-llvm::Value* LLVM_DtoRealloc(llvm::Value* ptr, llvm::Value* len);
+void DtoAssert(llvm::Value* cond, llvm::Value* loc, llvm::Value* msg);
 
-void LLVM_DtoAssert(llvm::Value* cond, llvm::Value* loc, llvm::Value* msg);
+llvm::Value* DtoArgument(const llvm::Type* paramtype, Argument* fnarg, Expression* argexp);
 
-llvm::Value* LLVM_DtoArgument(const llvm::Type* paramtype, Argument* fnarg, Expression* argexp);
+llvm::Value* DtoNestedVariable(VarDeclaration* vd);
 
-llvm::Value* LLVM_DtoNestedVariable(VarDeclaration* vd);
-
-void LLVM_DtoAssign(Type* lhsType, llvm::Value* lhs, llvm::Value* rhs);
+void DtoAssign(Type* lhsType, llvm::Value* lhs, llvm::Value* rhs);
 
-llvm::ConstantInt* LLVM_DtoConstSize_t(size_t);
-llvm::ConstantInt* LLVM_DtoConstUint(unsigned i);
-llvm::Constant* LLVM_DtoConstString(const char*);
+llvm::ConstantInt* DtoConstSize_t(size_t);
+llvm::ConstantInt* DtoConstUint(unsigned i);
+llvm::ConstantInt* DtoConstInt(int i);
+llvm::Constant* DtoConstString(const char*);
+llvm::Constant* DtoConstBool(bool);
 
-void LLVM_DtoMemCpy(llvm::Value* dst, llvm::Value* src, llvm::Value* nbytes);
+void DtoMemCpy(llvm::Value* dst, llvm::Value* src, llvm::Value* nbytes);
 
-llvm::Value* LLVM_DtoIndexStruct(llvm::Value* ptr, StructDeclaration* sd, Type* t, unsigned os, std::vector<unsigned>& idxs);
+llvm::Value* DtoIndexStruct(llvm::Value* ptr, StructDeclaration* sd, Type* t, unsigned os, std::vector<unsigned>& idxs);
 
 #include "enums.h"
--- a/gen/toobj.c	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/toobj.c	Thu Nov 01 17:27:18 2007 +0100
@@ -86,7 +86,7 @@
 
     // emit the llvm main function if necessary
     if (ir.emitMain) {
-        LLVM_DtoMain();
+        DtoMain();
     }
 
     // verify the llvm
@@ -157,7 +157,7 @@
 
 void StructDeclaration::toObjFile()
 {
-    TypeStruct* ts = (TypeStruct*)LLVM_DtoDType(type);
+    TypeStruct* ts = (TypeStruct*)DtoDType(type);
     if (llvmType != 0)
         return;
 
@@ -200,14 +200,14 @@
             if (lastoffset == (unsigned)-1) {
                 lastoffset = i->first;
                 assert(lastoffset == 0);
-                fieldtype = LLVM_DtoType(i->second.var->type);
+                fieldtype = DtoType(i->second.var->type);
                 fieldinit = i->second.init;
                 prevsize = gTargetData->getTypeSize(fieldtype);
                 i->second.var->llvmFieldIndex = idx;
             }
             // colliding offset?
             else if (lastoffset == i->first) {
-                const llvm::Type* t = LLVM_DtoType(i->second.var->type);
+                const llvm::Type* t = DtoType(i->second.var->type);
                 size_t s = gTargetData->getTypeSize(t);
                 if (s > prevsize) {
                     fieldpad += s - prevsize;
@@ -218,7 +218,7 @@
             }
             // intersecting offset?
             else if (i->first < (lastoffset + prevsize)) {
-                const llvm::Type* t = LLVM_DtoType(i->second.var->type);
+                const llvm::Type* t = DtoType(i->second.var->type);
                 size_t s = gTargetData->getTypeSize(t);
                 assert((i->first + s) <= (lastoffset + prevsize)); // this holds because all types are aligned to their size
                 llvmHasUnions = true;
@@ -243,7 +243,7 @@
 
                 // start new
                 lastoffset = i->first;
-                fieldtype = LLVM_DtoType(i->second.var->type);
+                fieldtype = DtoType(i->second.var->type);
                 fieldinit = i->second.init;
                 prevsize = gTargetData->getTypeSize(fieldtype);
                 i->second.var->llvmFieldIndex = idx;
@@ -389,7 +389,7 @@
 
 void ClassDeclaration::toObjFile()
 {
-    TypeClass* ts = (TypeClass*)LLVM_DtoDType(type);
+    TypeClass* ts = (TypeClass*)DtoDType(type);
     if (ts->llvmType != 0 || llvmInProgress)
         return;
 
@@ -423,7 +423,7 @@
 
     // fill out fieldtypes/inits
     for (IRStruct::OffsetMap::iterator i=gIR->topstruct().offsets.begin(); i!=gIR->topstruct().offsets.end(); ++i) {
-        fieldtypes.push_back(LLVM_DtoType(i->second.var->type));
+        fieldtypes.push_back(DtoType(i->second.var->type));
         fieldinits.push_back(i->second.init);
     }
 
@@ -574,11 +574,11 @@
         if (parent && parent->isFuncDeclaration())
             _linkage = llvm::GlobalValue::InternalLinkage;
         else
-            _linkage = LLVM_DtoLinkage(protection, storage_class);
+            _linkage = DtoLinkage(protection, storage_class);
 
-        Type* t = LLVM_DtoDType(type);
+        Type* t = DtoDType(type);
 
-        const llvm::Type* _type = LLVM_DtoType(t);
+        const llvm::Type* _type = DtoType(t);
         assert(_type);
 
         llvm::Constant* _init = 0;
@@ -593,7 +593,7 @@
         // if extern don't emit initializer
         if (!(storage_class & STCextern))
         {
-            _init = LLVM_DtoConstInitializer(t, init);
+            _init = DtoConstInitializer(t, init);
 
             //Logger::cout() << "initializer: " << *_init << '\n';
             if (_type != _init->getType()) {
@@ -614,7 +614,7 @@
                 // array single value init
                 else if (llvm::isa<llvm::ArrayType>(_type))
                 {
-                    _init = LLVM_DtoConstStaticArray(_type, _init);
+                    _init = DtoConstStaticArray(_type, _init);
                 }
                 else {
                     Logger::cout() << "Unexpected initializer type: " << *_type << '\n';
@@ -637,10 +637,10 @@
     {
         Logger::println("Aggregate var declaration: '%s' offset=%d", toChars(), offset);
 
-        Type* t = LLVM_DtoDType(type);
-        const llvm::Type* _type = LLVM_DtoType(t);
+        Type* t = DtoDType(type);
+        const llvm::Type* _type = DtoType(t);
 
-        llvm::Constant*_init = LLVM_DtoConstInitializer(t, init);
+        llvm::Constant*_init = DtoConstInitializer(t, init);
         assert(_init);
         Logger::cout() << "field init is: " << *_init << " type should be " << *_type << '\n';
         if (_type != _init->getType())
@@ -716,7 +716,7 @@
         return;
     }
 
-    Type* t = LLVM_DtoDType(type);
+    Type* t = DtoDType(type);
     TypeFunction* f = (TypeFunction*)t;
 
     bool declareOnly = false;
@@ -736,7 +736,7 @@
         }
     }
 
-    llvm::Function* func = LLVM_DtoDeclareFunction(this);
+    llvm::Function* func = DtoDeclareFunction(this);
 
     if (declareOnly)
         return;
@@ -830,7 +830,7 @@
                             nestTypes.push_back(vd->llvmValue->getType());
                         }
                         else {
-                            nestTypes.push_back(LLVM_DtoType(vd->type));
+                            nestTypes.push_back(DtoType(vd->type));
                         }
                     }
                     const llvm::StructType* nestSType = llvm::StructType::get(nestTypes);
@@ -839,12 +839,12 @@
                     if (parentNested) {
                         assert(llvmThisVar);
                         llvm::Value* ptr = gIR->ir->CreateBitCast(llvmThisVar, parentNested->getType(), "tmp");
-                        gIR->ir->CreateStore(ptr, LLVM_DtoGEPi(llvmNested, 0,0, "tmp"));
+                        gIR->ir->CreateStore(ptr, DtoGEPi(llvmNested, 0,0, "tmp"));
                     }
                     for (std::set<VarDeclaration*>::iterator i=llvmNestedVars.begin(); i!=llvmNestedVars.end(); ++i) {
                         VarDeclaration* vd = *i;
                         if (vd->isParameter()) {
-                            gIR->ir->CreateStore(vd->llvmValue, LLVM_DtoGEPi(llvmNested, 0, vd->llvmNestedIndex, "tmp"));
+                            gIR->ir->CreateStore(vd->llvmValue, DtoGEPi(llvmNested, 0, vd->llvmNestedIndex, "tmp"));
                             vd->llvmValue = llvmNested;
                         }
                     }
--- a/gen/typinf.c	Wed Oct 31 22:35:39 2007 +0100
+++ b/gen/typinf.c	Thu Nov 01 17:27:18 2007 +0100
@@ -302,24 +302,24 @@
 
     // char[] name
     char *name = sd->toPrettyChars();
-    sinits.push_back(LLVM_DtoConstString(name));
+    sinits.push_back(DtoConstString(name));
     assert(sinits.back()->getType() == initZ->getOperand(2)->getType());
 
     // void[] init
     const llvm::PointerType* initpt = llvm::PointerType::get(llvm::Type::Int8Ty);
     if (tinfo->isZeroInit() || !sd->init) // 0 initializer, or the same as the base type
     {
-        sinits.push_back(LLVM_DtoConstSlice(LLVM_DtoConstSize_t(0), llvm::ConstantPointerNull::get(initpt)));
+        sinits.push_back(DtoConstSlice(DtoConstSize_t(0), llvm::ConstantPointerNull::get(initpt)));
     }
     else
     {
-        llvm::Constant* ci = LLVM_DtoConstInitializer(sd->basetype, sd->init);
+        llvm::Constant* ci = DtoConstInitializer(sd->basetype, sd->init);
         std::string ciname(sd->mangle());
         ciname.append("__init");
-        llvm::GlobalVariable* civar = new llvm::GlobalVariable(LLVM_DtoType(sd->basetype),true,llvm::GlobalValue::InternalLinkage,ci,ciname,gIR->module);
+        llvm::GlobalVariable* civar = new llvm::GlobalVariable(DtoType(sd->basetype),true,llvm::GlobalValue::InternalLinkage,ci,ciname,gIR->module);
         llvm::Constant* cicast = llvm::ConstantExpr::getBitCast(civar, initpt);
-        size_t cisize = gTargetData->getTypeSize(LLVM_DtoType(sd->basetype));
-        sinits.push_back(LLVM_DtoConstSlice(LLVM_DtoConstSize_t(cisize), cicast));
+        size_t cisize = gTargetData->getTypeSize(DtoType(sd->basetype));
+        sinits.push_back(DtoConstSlice(DtoConstSize_t(cisize), cicast));
     }
 
     // create the symbol
@@ -366,25 +366,25 @@
 
     // char[] name
     char *name = sd->toPrettyChars();
-    sinits.push_back(LLVM_DtoConstString(name));
+    sinits.push_back(DtoConstString(name));
     assert(sinits.back()->getType() == initZ->getOperand(2)->getType());
 
     // void[] init
     const llvm::PointerType* initpt = llvm::PointerType::get(llvm::Type::Int8Ty);
     if (tinfo->isZeroInit() || !sd->defaultval) // 0 initializer, or the same as the base type
     {
-        sinits.push_back(LLVM_DtoConstSlice(LLVM_DtoConstSize_t(0), llvm::ConstantPointerNull::get(initpt)));
+        sinits.push_back(DtoConstSlice(DtoConstSize_t(0), llvm::ConstantPointerNull::get(initpt)));
     }
     else
     {
-        const llvm::Type* memty = LLVM_DtoType(sd->memtype);
+        const llvm::Type* memty = DtoType(sd->memtype);
         llvm::Constant* ci = llvm::ConstantInt::get(memty, sd->defaultval, !sd->memtype->isunsigned());
         std::string ciname(sd->mangle());
         ciname.append("__init");
         llvm::GlobalVariable* civar = new llvm::GlobalVariable(memty,true,llvm::GlobalValue::InternalLinkage,ci,ciname,gIR->module);
         llvm::Constant* cicast = llvm::ConstantExpr::getBitCast(civar, initpt);
         size_t cisize = gTargetData->getTypeSize(memty);
-        sinits.push_back(LLVM_DtoConstSlice(LLVM_DtoConstSize_t(cisize), cicast));
+        sinits.push_back(DtoConstSlice(DtoConstSize_t(cisize), cicast));
     }
 
     // create the symbol
@@ -544,7 +544,7 @@
 
     // char[] name
     char *name = sd->toPrettyChars();
-    sinits.push_back(LLVM_DtoConstString(name));
+    sinits.push_back(DtoConstString(name));
     Logger::println("************** A");
     assert(sinits.back()->getType() == stype->getElementType(1));
 
@@ -552,14 +552,14 @@
     const llvm::PointerType* initpt = llvm::PointerType::get(llvm::Type::Int8Ty);
     if (sd->zeroInit) // 0 initializer, or the same as the base type
     {
-        sinits.push_back(LLVM_DtoConstSlice(LLVM_DtoConstSize_t(0), llvm::ConstantPointerNull::get(initpt)));
+        sinits.push_back(DtoConstSlice(DtoConstSize_t(0), llvm::ConstantPointerNull::get(initpt)));
     }
     else
     {
         assert(sd->llvmInitZ);
         size_t cisize = gTargetData->getTypeSize(tc->llvmType);
         llvm::Constant* cicast = llvm::ConstantExpr::getBitCast(tc->llvmInit, initpt);
-        sinits.push_back(LLVM_DtoConstSlice(LLVM_DtoConstSize_t(cisize), cicast));
+        sinits.push_back(DtoConstSlice(DtoConstSize_t(cisize), cicast));
     }
 
     // toX functions ground work
@@ -684,7 +684,7 @@
     }
 
     // uint m_flags;
-    sinits.push_back(LLVM_DtoConstUint(tc->hasPointers()));
+    sinits.push_back(DtoConstUint(tc->hasPointers()));
 
     // create the symbol
     llvm::Constant* tiInit = llvm::ConstantStruct::get(stype, sinits);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/scope5.d	Thu Nov 01 17:27:18 2007 +0100
@@ -0,0 +1,27 @@
+module scope5;
+
+int i;
+
+void func(int a, int b)
+{
+    i = 0;
+    {
+        scope(exit) i++;
+        if (a) {
+            scope(exit) i++;
+            if (b) return;
+            i++;
+        }
+    }
+    i++;
+}
+
+void main()
+{
+    func(0,0);
+    assert(i == 2);
+    func(1,1);
+    assert(i == 2);
+    func(1,0);
+    assert(i == 4);
+}