Remove VarDeclaration::aggrIndex

This commit is contained in:
Alexey Prokhin 2014-09-22 15:20:13 +04:00
parent a0b9f95869
commit caa2f15c8a
8 changed files with 22 additions and 25 deletions

View file

@ -946,8 +946,6 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
edtor = NULL; edtor = NULL;
range = NULL; range = NULL;
#if IN_LLVM #if IN_LLVM
aggrIndex = 0;
nakedUse = false; nakedUse = false;
#endif #endif
} }

View file

@ -348,10 +348,6 @@ public:
void accept(Visitor *v) { v->visit(this); } void accept(Visitor *v) { v->visit(this); }
#if IN_LLVM #if IN_LLVM
/// Index into parent aggregate.
/// Set during type generation.
unsigned aggrIndex;
/// This var is used by a naked function. /// This var is used by a naked function.
bool nakedUse; bool nakedUse;

View file

@ -60,11 +60,11 @@ void DtoResolveClass(ClassDeclaration* cd)
I != E; ++I) I != E; ++I)
{ {
VarDeclaration* vd = *I; VarDeclaration* vd = *I;
IF_LOG {
if (!isIrFieldCreated(vd)) if (isIrFieldCreated(vd))
getIrField(vd, true); Logger::println("class field already exists");
else }
IF_LOG Logger::println("class field already exists!!!"); getIrField(vd, true);
} }
// emit the interfaceInfosZ symbol if necessary // emit the interfaceInfosZ symbol if necessary

View file

@ -61,7 +61,10 @@ void DtoResolveStruct(StructDeclaration* sd, Loc& callerLoc)
I != E; ++I) I != E; ++I)
{ {
VarDeclaration *vd = *I; VarDeclaration *vd = *I;
assert(!isIrFieldCreated(vd)); IF_LOG {
if (isIrFieldCreated(vd))
Logger::println("struct field already exists");
}
getIrField(vd, true); getIrField(vd, true);
} }
} }

View file

@ -177,8 +177,8 @@ void IrTypeClass::addBaseClassData(
// advance offset to right past this field // advance offset to right past this field
offset = vd->offset + vd->type->size(); offset = vd->offset + vd->type->size();
// create ir field // set the field index
vd->aggrIndex = static_cast<unsigned>(field_index); getIrField(vd, true)->setAggrIndex(static_cast<unsigned>(field_index));
++field_index; ++field_index;
} }

View file

@ -241,7 +241,8 @@ IrTypeStruct* IrTypeStruct::get(StructDeclaration* sd)
offset = vd->offset + vd->type->size(); offset = vd->offset + vd->type->size();
// set the field index // set the field index
vd->aggrIndex = (unsigned)field_index++; getIrField(vd, true)->setAggrIndex(static_cast<unsigned>(field_index));
++field_index;
} }
// tail padding? // tail padding?

View file

@ -19,16 +19,14 @@
IrField::IrField(VarDeclaration* v) : IrVar(v) IrField::IrField(VarDeclaration* v) : IrVar(v)
{ {
if (v->aggrIndex) index = 0;
{ unionOffset = V->offset;
index = v->aggrIndex; }
unionOffset = 0;
} void IrField::setAggrIndex(unsigned aggrIndex)
else {
{ index = aggrIndex;
index = 0; unionOffset = 0;
unionOffset = v->offset;
}
} }
extern LLConstant* get_default_initializer(VarDeclaration* vd, Initializer* init); extern LLConstant* get_default_initializer(VarDeclaration* vd, Initializer* init);

View file

@ -80,6 +80,7 @@ struct IrParameter : IrLocal
struct IrField : IrVar struct IrField : IrVar
{ {
IrField(VarDeclaration* v); IrField(VarDeclaration* v);
void setAggrIndex(unsigned aggrIndex);
unsigned index; unsigned index;
unsigned unionOffset; unsigned unionOffset;