diff --git a/gen/classes.cpp b/gen/classes.cpp index f5daca9f..5512439c 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -798,16 +798,6 @@ DValue* DtoNewClass(TypeClass* tc, NewExp* newexp) { DValue* res = DtoCallDFunc(newexp->allocator, newexp->newargs); mem = DtoBitCast(res->getRVal(), DtoType(tc), "newclass_custom"); - -// DtoForceDeclareDsymbol(newexp->allocator); -// assert(newexp->newargs); -// assert(newexp->newargs->dim == 1); -// -// llvm::Function* fn = newexp->allocator->ir.irFunc->func; -// assert(fn); -// DValue* arg = ((Expression*)newexp->newargs->data[0])->toElem(gIR); -// mem = gIR->CreateCallOrInvoke(fn, arg->getRVal(), "newclass_custom_alloc")->get(); -// mem = DtoBitCast(mem, DtoType(tc), "newclass_custom"); } // default allocator else @@ -1089,8 +1079,6 @@ void ClassDeclaration::offsetToIndex(Type* t, unsigned os, std::vector assert(r != (unsigned)-1 && "Offset not found in any aggregate field"); // vtable is 0, monitor is 1 r += 2; - // interface offset further - //r += vtblInterfaces->dim; // the final index was not pushed result.push_back(r); } @@ -1107,7 +1095,6 @@ LLValue* DtoIndexClass(LLValue* ptr, ClassDeclaration* cd, Type* t, unsigned os, const LLType* st = DtoType(cd->type); if (ptr->getType() != st) { - //assert(cd->ir.irStruct->hasUnions); ptr = gIR->ir->CreateBitCast(ptr, st, "tmp"); } @@ -1116,8 +1103,6 @@ LLValue* DtoIndexClass(LLValue* ptr, ClassDeclaration* cd, Type* t, unsigned os, IrStruct* irstruct = cd->ir.irStruct; for (IrStruct::OffsetMap::iterator i=irstruct->offsets.begin(); i!=irstruct->offsets.end(); ++i) { - //for (unsigned i=0; ifields.dim; ++i) { - //VarDeclaration* vd = (VarDeclaration*)cd->fields.data[i]; VarDeclaration* vd = i->second.var; assert(vd); Type* vdtype = DtoDType(vd->type); @@ -1195,9 +1180,6 @@ LLValue* DtoVirtualFunctionPointer(DValue* inst, FuncDeclaration* fdecl) Logger::cout() << "funcval casted: " << *funcval << '\n'; #endif - //assert(funcval->getType() == DtoType(fdecl->type)); - //cc = DtoCallingConv(fdecl->linkage); - return funcval; } diff --git a/gen/functions.cpp b/gen/functions.cpp index 870fe6cb..f13432c0 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -212,12 +212,6 @@ const llvm::FunctionType* DtoFunctionType(FuncDeclaration* fdecl) return DtoVaFunctionType(fdecl); } - // unittest has null type, just build it manually - /*if (fdecl->isUnitTestDeclaration()) { - std::vector args; - return llvm::FunctionType::get(LLType::VoidTy, args, false); - }*/ - // type has already been resolved if (fdecl->type->ir.type != 0) { return llvm::cast(fdecl->type->ir.type->get()); diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index c59436a8..b7413c01 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -381,9 +381,7 @@ static LLValue* get_frame_ptr_impl(FuncDeclaration* func, Dsymbol* sc, LLValue* } else if (ClassDeclaration* cd = fd->toParent2()->isClassDeclaration()) { - size_t idx = 2; - //idx += cd->ir.irStruct->interfaceVec.size(); - v = DtoGEPi(v,0,idx,"tmp"); + v = DtoGEPi(v,0,2,"tmp"); v = DtoLoad(v); } else @@ -395,11 +393,6 @@ static LLValue* get_frame_ptr_impl(FuncDeclaration* func, Dsymbol* sc, LLValue* else if (ClassDeclaration* cd = sc->isClassDeclaration()) { Logger::println("scope is class: %s", cd->toChars()); - /*size_t idx = 2; - idx += cd->llvmIrStruct->interfaces.size(); - v = DtoGEPi(v,0,idx,"tmp"); - Logger::cout() << "gep = " << *v << '\n'; - v = DtoLoad(v);*/ return get_frame_ptr_impl(func, cd->toParent2(), v); } else diff --git a/gen/toir.cpp b/gen/toir.cpp index 4a8edb5e..7f8a163d 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -174,11 +174,7 @@ DValue* VarExp::toElem(IRState* p) if (vd->ident == Id::_arguments) { Logger::println("Id::_arguments"); - /*if (!vd->ir.getIrValue()) - vd->ir.getIrValue() = p->func()->decl->irFunc->_arguments; - assert(vd->ir.getIrValue()); - return new DVarValue(vd, vd->ir.getIrValue(), true);*/ - LLValue* v = p->func()->decl->ir.irFunc->_arguments; + LLValue* v = p->func()->_arguments; assert(v); return new DVarValue(vd, v, true); } @@ -186,11 +182,7 @@ DValue* VarExp::toElem(IRState* p) else if (vd->ident == Id::_argptr) { Logger::println("Id::_argptr"); - /*if (!vd->ir.getIrValue()) - vd->ir.getIrValue() = p->func()->decl->irFunc->_argptr; - assert(vd->ir.getIrValue()); - return new DVarValue(vd, vd->ir.getIrValue(), true);*/ - LLValue* v = p->func()->decl->ir.irFunc->_argptr; + LLValue* v = p->func()->_argptr; assert(v); return new DVarValue(vd, v, true); } @@ -1376,7 +1368,6 @@ DValue* DotVarExp::toElem(IRState* p) } LLValue* vthis = l->getRVal(); if (!vthis2) vthis2 = vthis; - //unsigned cc = (unsigned)-1; // super call if (e1->op == TOKsuper) { @@ -1406,7 +1397,6 @@ DValue* DotVarExp::toElem(IRState* p) DtoForceDeclareDsymbol(fdecl); funcval = fdecl->ir.irFunc->func; assert(funcval); - //assert(funcval->getType() == DtoType(fdecl->type)); } return new DFuncValue(fdecl, funcval, vthis2); } @@ -2116,7 +2106,6 @@ BinBitExp(And,And); BinBitExp(Or,Or); BinBitExp(Xor,Xor); BinBitExp(Shl,Shl); -//BinBitExp(Shr,AShr); BinBitExp(Ushr,LShr); DValue* ShrExp::toElem(IRState* p) @@ -2157,6 +2146,8 @@ DValue* HaltExp::toElem(IRState* p) Logger::print("HaltExp::toElem: %s\n", toChars()); LOG_SCOPE; + // FIXME: DMD inserts a trap here... we probably should as well !?! + #if 1 DtoAssert(&loc, NULL); #else diff --git a/gen/toobj.cpp b/gen/toobj.cpp index c485a233..d357decd 100644 --- a/gen/toobj.cpp +++ b/gen/toobj.cpp @@ -113,9 +113,6 @@ void Module::genobjfile(int multiobj) if (!ClassDeclaration::classinfo->type->ir.type) ClassDeclaration::classinfo->type->ir.type = new llvm::PATypeHolder(llvm::OpaqueType::get()); - /*if (!Type::typeinfoclass->type->ir.type) - Type::typeinfoclass->type->ir.type = new llvm::PATypeHolder(llvm::OpaqueType::get());*/ - // process module members for (int k=0; k < members->dim; k++) { Dsymbol* dsym = (Dsymbol*)(members->data[k]);