diff --git a/gen/classes.cpp b/gen/classes.cpp index d50462116c..f5d164ac74 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -57,9 +57,9 @@ void DtoResolveClass(ClassDeclaration* cd) DtoType(cd->type); // create IrAggr - assert(cd->ir.irStruct == NULL); + assert(cd->ir.irAggr == NULL); IrAggr* irAggr = new IrAggr(cd); - cd->ir.irStruct = irAggr; + cd->ir.irAggr = irAggr; // make sure all fields really get their ir field ArrayIter it(cd->fields); @@ -152,7 +152,7 @@ DValue* DtoNewClass(Loc loc, TypeClass* tc, NewExp* newexp) else { llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, _d_allocclass); - LLConstant* ci = DtoBitCast(tc->sym->ir.irStruct->getClassInfoSymbol(), DtoType(ClassDeclaration::classinfo->type)); + LLConstant* ci = DtoBitCast(tc->sym->ir.irAggr->getClassInfoSymbol(), DtoType(ClassDeclaration::classinfo->type)); mem = gIR->CreateCallOrInvoke(fn, ci, ".newclass_gc_alloc").getInstruction(); mem = DtoBitCast(mem, DtoType(tc), ".newclass_gc"); } @@ -203,7 +203,7 @@ void DtoInitClass(TypeClass* tc, LLValue* dst) // set vtable field seperately, this might give better optimization LLValue* tmp = DtoGEPi(dst,0,0,"vtbl"); - LLValue* val = DtoBitCast(tc->sym->ir.irStruct->getVtblSymbol(), tmp->getType()->getContainedType(0)); + LLValue* val = DtoBitCast(tc->sym->ir.irAggr->getVtblSymbol(), tmp->getType()->getContainedType(0)); DtoStore(val, tmp); // monitor always defaults to zero @@ -219,7 +219,7 @@ void DtoInitClass(TypeClass* tc, LLValue* dst) LLValue* dstarr = DtoGEPi(dst,0,2,"tmp"); // init symbols might not have valid types - LLValue* initsym = tc->sym->ir.irStruct->getInitSymbol(); + LLValue* initsym = tc->sym->ir.irAggr->getInitSymbol(); initsym = DtoBitCast(initsym, DtoType(tc)); LLValue* srcarr = DtoGEPi(initsym,0,2,"tmp"); @@ -380,7 +380,7 @@ DValue* DtoDynamicCastObject(DValue* val, Type* _to) TypeClass* to = static_cast(_to->toBasetype()); to->sym->codegen(Type::sir); - LLValue* cinfo = to->sym->ir.irStruct->getClassInfoSymbol(); + LLValue* cinfo = to->sym->ir.irAggr->getClassInfoSymbol(); // unfortunately this is needed as the implementation of object differs somehow from the declaration // this could happen in user code as well :/ cinfo = DtoBitCast(cinfo, funcTy->getParamType(1)); @@ -441,7 +441,7 @@ DValue* DtoDynamicCastInterface(DValue* val, Type* _to) // ClassInfo c TypeClass* to = static_cast(_to->toBasetype()); to->sym->codegen(Type::sir); - LLValue* cinfo = to->sym->ir.irStruct->getClassInfoSymbol(); + LLValue* cinfo = to->sym->ir.irAggr->getClassInfoSymbol(); // unfortunately this is needed as the implementation of object differs somehow from the declaration // this could happen in user code as well :/ cinfo = DtoBitCast(cinfo, funcTy->getParamType(1)); @@ -580,14 +580,14 @@ static LLConstant* build_offti_entry(ClassDeclaration* cd, VarDeclaration* vd) static LLConstant* build_offti_array(ClassDeclaration* cd, LLType* arrayT) { - IrStruct* irstruct = cd->ir.irStruct; + IrAggr* iraggr = cd->ir.irAggr; - size_t nvars = irstruct->varDecls.size(); + size_t nvars = iraggr->varDecls.size(); std::vector arrayInits(nvars); for (size_t i=0; ivarDecls[i]); + arrayInits[i] = build_offti_entry(cd, iraggr->varDecls[i]); } LLConstant* size = DtoConstSize_t(nvars); @@ -691,7 +691,7 @@ LLConstant* DtoDefineClassInfo(ClassDeclaration* cd) assert(cd->type->ty == Tclass); TypeClass* cdty = static_cast(cd->type); - IrAggr* ir = cd->ir.irStruct; + IrAggr* ir = cd->ir.irAggr; assert(ir); ClassDeclaration* cinfo = ClassDeclaration::classinfo; diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 32676228ee..8c01cd7b3a 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -1279,7 +1279,7 @@ LLConstant* DtoConstInitializer(Loc loc, Type* type, Initializer* init) { Logger::println("const struct initializer"); si->ad->codegen(Type::sir); - return si->ad->ir.irStruct->createStructInitializer(si); + return si->ad->ir.irAggr->createStructInitializer(si); } else if (ArrayInitializer* ai = init->isArrayInitializer()) { @@ -1851,7 +1851,7 @@ DValue* DtoSymbolAddress(const Loc& loc, Type* type, Declaration* decl) { Logger::println("ClassInfoDeclaration: %s", cid->cd->toChars()); cid->cd->codegen(Type::sir);; - return new DVarValue(type, vd, cid->cd->ir.irStruct->getClassInfoSymbol()); + return new DVarValue(type, vd, cid->cd->ir.irAggr->getClassInfoSymbol()); } // typeinfo else if (TypeInfoDeclaration* tid = vd->isTypeInfoDeclaration()) @@ -1960,7 +1960,7 @@ DValue* DtoSymbolAddress(const Loc& loc, Type* type, Declaration* decl) assert(ts->sym); ts->sym->codegen(Type::sir); - LLValue* initsym = ts->sym->ir.irStruct->getInitSymbol(); + LLValue* initsym = ts->sym->ir.irAggr->getInitSymbol(); initsym = DtoBitCast(initsym, DtoType(ts->pointerTo())); return new DVarValue(type, initsym); } diff --git a/gen/module.cpp b/gen/module.cpp index 2b4de34fe3..7ff40101b9 100644 --- a/gen/module.cpp +++ b/gen/module.cpp @@ -431,7 +431,7 @@ void Module::genmoduleinfo() continue; } Logger::println("class: %s", cd->toPrettyChars()); - LLConstant *c = DtoBitCast(cd->ir.irStruct->getClassInfoSymbol(), classinfoTy); + LLConstant *c = DtoBitCast(cd->ir.irAggr->getClassInfoSymbol(), classinfoTy); classInits.push_back(c); } // has class array? diff --git a/gen/rttibuilder.cpp b/gen/rttibuilder.cpp index 79f1c9bfea..c1711d7037 100644 --- a/gen/rttibuilder.cpp +++ b/gen/rttibuilder.cpp @@ -26,7 +26,7 @@ RTTIBuilder::RTTIBuilder(AggregateDeclaration* base_class) base = base_class; basetype = static_cast(base->type); - baseir = base->ir.irStruct; + baseir = base->ir.irAggr; assert(baseir && "no IrStruct for TypeInfo base class"); if (base->isClassDeclaration()) { @@ -59,7 +59,7 @@ void RTTIBuilder::push_typeinfo(Type* t) void RTTIBuilder::push_classinfo(ClassDeclaration* cd) { - inits.push_back(cd->ir.irStruct->getClassInfoSymbol()); + inits.push_back(cd->ir.irAggr->getClassInfoSymbol()); } void RTTIBuilder::push_string(const char* str) diff --git a/gen/structs.cpp b/gen/structs.cpp index 118e70d7de..190550369c 100644 --- a/gen/structs.cpp +++ b/gen/structs.cpp @@ -45,8 +45,8 @@ void DtoResolveStruct(StructDeclaration* sd) return; // create the IrAggr - IrAggr* irstruct = new IrAggr(sd); - sd->ir.irStruct = irstruct; + IrAggr* iraggr = new IrAggr(sd); + sd->ir.irAggr = iraggr; // Set up our field metadata. for (ArrayIter it(sd->fields); !it.done(); it.next()) @@ -61,10 +61,10 @@ void DtoResolveStruct(StructDeclaration* sd) if (emitGlobalData) { // emit the initZ symbol - LLGlobalVariable* initZ = irstruct->getInitSymbol(); + LLGlobalVariable* initZ = iraggr->getInitSymbol(); // set initZ initializer - initZ->setInitializer(irstruct->getDefaultInit()); + initZ->setInitializer(iraggr->getDefaultInit()); } // emit members diff --git a/gen/toir.cpp b/gen/toir.cpp index 323954610d..b623823818 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -134,7 +134,7 @@ LLConstant* VarExp::toConstElem(IRState* p) TypeStruct* ts = static_cast(sdecltype); ts->sym->codegen(Type::sir); - return ts->sym->ir.irStruct->getDefaultInit(); + return ts->sym->ir.irAggr->getDefaultInit(); } if (TypeInfoDeclaration* ti = var->isTypeInfoDeclaration()) @@ -2038,7 +2038,7 @@ DValue* NewExp::toElem(IRState* p) else { assert(ts->sym); ts->sym->codegen(Type::sir); - DtoAggrCopy(mem, ts->sym->ir.irStruct->getInitSymbol()); + DtoAggrCopy(mem, ts->sym->ir.irAggr->getInitSymbol()); } if (ts->sym->isNested() && ts->sym->vthis) DtoResolveNestedContext(loc, ts->sym, mem); @@ -2937,7 +2937,7 @@ DValue* StructLiteralExp::toElem(IRState* p) assert(ts->sym); ts->sym->codegen(Type::sir); - LLValue* initsym = ts->sym->ir.irStruct->getInitSymbol(); + LLValue* initsym = ts->sym->ir.irAggr->getInitSymbol(); initsym = DtoBitCast(initsym, DtoType(ts->pointerTo())); return new DVarValue(type, initsym); } @@ -3051,7 +3051,7 @@ LLConstant* StructLiteralExp::toConstElem(IRState* p) TypeStruct* ts = static_cast(sdecltype); ts->sym->codegen(Type::sir); - return ts->sym->ir.irStruct->getDefaultInit(); + return ts->sym->ir.irAggr->getDefaultInit(); } // make sure the struct is resolved @@ -3067,7 +3067,7 @@ LLConstant* StructLiteralExp::toConstElem(IRState* p) } } - return sd->ir.irStruct->createInitializerConstant(varInits); + return sd->ir.irAggr->createInitializerConstant(varInits); } llvm::Constant* ClassReferenceExp::toConstElem(IRState *p) @@ -3124,7 +3124,7 @@ llvm::Constant* ClassReferenceExp::toConstElem(IRState *p) assert(i == nexprs); } - llvm::Constant* constValue = origClass->ir.irStruct->createInitializerConstant(varInits); + llvm::Constant* constValue = origClass->ir.irAggr->createInitializerConstant(varInits); if (constValue->getType() != value->globalVar->getType()->getContainedType(0)) { diff --git a/gen/typinf.cpp b/gen/typinf.cpp index cbbb0ed88b..bcdab26462 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -604,7 +604,7 @@ void TypeInfoStructDeclaration::llvmDefine() } sd->codegen(Type::sir); - IrAggr* irstruct = sd->ir.irStruct; + IrAggr* iraggr = sd->ir.irAggr; RTTIBuilder b(Type::typeinfostruct); @@ -618,7 +618,7 @@ void TypeInfoStructDeclaration::llvmDefine() if (tc->isZeroInit(Loc())) initPtr = getNullValue(getVoidPtrType()); else - initPtr = irstruct->getInitSymbol(); + initPtr = iraggr->getInitSymbol(); b.push_void_array(getTypeStoreSize(tc->irtype->getLLType()), initPtr); // toX functions ground work @@ -737,7 +737,7 @@ void TypeInfoClassDeclaration::codegen(Ir*i) assert(tinfo->ty == Tclass); TypeClass *tc = static_cast(tinfo); tc->sym->codegen(Type::sir); // make sure class is resolved - irg->value = tc->sym->ir.irStruct->getClassInfoSymbol(); + irg->value = tc->sym->ir.irAggr->getClassInfoSymbol(); } void TypeInfoClassDeclaration::llvmDefine() diff --git a/ir/irclass.cpp b/ir/irclass.cpp index 755d5048b7..8f0094a1ae 100644 --- a/ir/irclass.cpp +++ b/ir/irclass.cpp @@ -394,7 +394,7 @@ LLConstant * IrAggr::getClassInfoInterfaces() IF_LOG Logger::println("Adding interface %s", it->base->toPrettyChars()); - IrAggr* irinter = it->base->ir.irStruct; + IrAggr* irinter = it->base->ir.irAggr; assert(irinter && "interface has null IrStruct"); IrTypeClass* itc = stripModifiers(irinter->type)->irtype->isClass(); assert(itc && "null interface IrTypeClass"); diff --git a/ir/irdsymbol.cpp b/ir/irdsymbol.cpp index 290cfcbceb..d16565e6f9 100644 --- a/ir/irdsymbol.cpp +++ b/ir/irdsymbol.cpp @@ -36,7 +36,7 @@ IrDsymbol::IrDsymbol(const IrDsymbol& s) assert(incr); DModule = s.DModule; irModule = s.irModule; - irStruct = s.irStruct; + irAggr = s.irAggr; irFunc = s.irFunc; resolved = s.resolved; declared = s.declared; @@ -56,7 +56,7 @@ void IrDsymbol::reset() { DModule = NULL; irModule = NULL; - irStruct = NULL; + irAggr = NULL; irFunc = NULL; resolved = declared = initialized = defined = false; irGlobal = NULL; @@ -66,7 +66,7 @@ void IrDsymbol::reset() bool IrDsymbol::isSet() { - return (irStruct || irFunc || irGlobal || irLocal || irField); + return (irAggr || irFunc || irGlobal || irLocal || irField); } IrVar* IrDsymbol::getIrVar() diff --git a/ir/irdsymbol.h b/ir/irdsymbol.h index 932ffdef7c..546b7891b7 100644 --- a/ir/irdsymbol.h +++ b/ir/irdsymbol.h @@ -52,7 +52,7 @@ struct IrDsymbol IrModule* irModule; - IrAggr* irStruct; + IrAggr* irAggr; IrFunction* irFunc; diff --git a/ir/irlandingpad.cpp b/ir/irlandingpad.cpp index 2d6adb0113..b3ae23b608 100644 --- a/ir/irlandingpad.cpp +++ b/ir/irlandingpad.cpp @@ -173,7 +173,7 @@ void IRLandingPad::constructLandingPad(llvm::BasicBlock* inBB) // create next block llvm::BasicBlock *next = llvm::BasicBlock::Create(gIR->context(), "eh.next", gIR->topfunc(), gIR->scopeend()); // get class info symbol - LLValue *classInfo = rit->catchType->ir.irStruct->getClassInfoSymbol(); + LLValue *classInfo = rit->catchType->ir.irAggr->getClassInfoSymbol(); // add that symbol as landing pad clause landingPad->addClause(classInfo); // call llvm.eh.typeid.for to get class info index in the exception table