Renamed IrStruct to IrAggr, as it is also used for classes.

The class-specific parts should probably be factored out.
This commit is contained in:
David Nadlinger
2013-06-12 11:40:30 +02:00
parent 28f39cbdad
commit f2f3c751b3
13 changed files with 52 additions and 52 deletions

View File

@@ -25,7 +25,7 @@
#include "gen/structs.h"
#include "gen/tollvm.h"
#include "gen/utils.h"
#include "ir/irstruct.h"
#include "ir/iraggr.h"
#include "ir/irtypeclass.h"
//////////////////////////////////////////////////////////////////////////////////////////
@@ -55,10 +55,10 @@ void DtoResolveClass(ClassDeclaration* cd)
// make sure type exists
DtoType(cd->type);
// create IrStruct
// create IrAggr
assert(cd->ir.irStruct == NULL);
IrStruct* irstruct = new IrStruct(cd);
cd->ir.irStruct = irstruct;
IrAggr* irAggr = new IrAggr(cd);
cd->ir.irStruct = irAggr;
// make sure all fields really get their ir field
ArrayIter<VarDeclaration> it(cd->fields);
@@ -75,30 +75,30 @@ void DtoResolveClass(ClassDeclaration* cd)
bool needs_def = mustDefineSymbol(cd);
// emit the ClassZ symbol
LLGlobalVariable* ClassZ = irstruct->getClassInfoSymbol();
LLGlobalVariable* ClassZ = irAggr->getClassInfoSymbol();
// emit the interfaceInfosZ symbol if necessary
if (cd->vtblInterfaces && cd->vtblInterfaces->dim > 0)
irstruct->getInterfaceArraySymbol(); // initializer is applied when it's built
irAggr->getInterfaceArraySymbol(); // initializer is applied when it's built
// interface only emit typeinfo and classinfo
if (cd->isInterfaceDeclaration())
{
irstruct->initializeInterface();
irAggr->initializeInterface();
}
else
{
// emit the initZ symbol
LLGlobalVariable* initZ = irstruct->getInitSymbol();
LLGlobalVariable* initZ = irAggr->getInitSymbol();
// emit the vtblZ symbol
LLGlobalVariable* vtblZ = irstruct->getVtblSymbol();
LLGlobalVariable* vtblZ = irAggr->getVtblSymbol();
// perform definition
if (needs_def)
{
// set symbol initializers
initZ->setInitializer(irstruct->getDefaultInit());
vtblZ->setInitializer(irstruct->getVtblInit());
initZ->setInitializer(irAggr->getDefaultInit());
vtblZ->setInitializer(irAggr->getVtblInit());
}
}
@@ -121,7 +121,7 @@ void DtoResolveClass(ClassDeclaration* cd)
DtoTypeInfoOf(cd->type);
// define classinfo
ClassZ->setInitializer(irstruct->getClassInfoInit());
ClassZ->setInitializer(irAggr->getClassInfoInit());
}
}
@@ -689,7 +689,7 @@ LLConstant* DtoDefineClassInfo(ClassDeclaration* cd)
assert(cd->type->ty == Tclass);
TypeClass* cdty = static_cast<TypeClass*>(cd->type);
IrStruct* ir = cd->ir.irStruct;
IrAggr* ir = cd->ir.irStruct;
assert(ir);
ClassDeclaration* cinfo = ClassDeclaration::classinfo;

View File

@@ -105,7 +105,7 @@ llvm::Instruction* IRState::topallocapoint()
return functions.back()->allocapoint;
}
IrStruct* IRState::topstruct()
IrAggr* IRState::topstruct()
{
assert(!structs.empty() && "Struct vector is empty!");
return structs.back();

View File

@@ -18,7 +18,7 @@
#include "aggregate.h"
#include "root.h"
#include "ir/irfunction.h"
#include "ir/irstruct.h"
#include "ir/iraggr.h"
#include "ir/irvar.h"
#include <deque>
#include <list>
@@ -146,9 +146,9 @@ struct IRState
llvm::Instruction* topallocapoint();
// structs
typedef std::vector<IrStruct*> StructVector;
typedef std::vector<IrAggr*> StructVector;
StructVector structs;
IrStruct* topstruct();
IrAggr* topstruct();
// D main function
bool emitMain;

View File

@@ -16,7 +16,7 @@
#include "gen/llvm.h"
#include "gen/llvmhelpers.h"
#include "gen/tollvm.h"
#include "ir/irstruct.h"
#include "ir/iraggr.h"
RTTIBuilder::RTTIBuilder(AggregateDeclaration* base_class)
{

View File

@@ -27,7 +27,7 @@ struct ClassDeclaration;
struct Dsymbol;
struct FuncDeclaration;
struct IrGlobal;
struct IrStruct;
struct IrAggr;
struct Type;
struct TypeClass;
namespace llvm { class StructType; }
@@ -36,7 +36,7 @@ struct RTTIBuilder
{
AggregateDeclaration* base;
TypeClass* basetype;
IrStruct* baseir;
IrAggr* baseir;
// 10 is enough for any D1 TypeInfo
// 14 is enough for any D1 ClassInfo

View File

@@ -21,7 +21,7 @@
#include "gen/structs.h"
#include "gen/tollvm.h"
#include "gen/utils.h"
#include "ir/irstruct.h"
#include "ir/iraggr.h"
#include "ir/irtypestruct.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/ManagedStatic.h"
@@ -45,8 +45,8 @@ void DtoResolveStruct(StructDeclaration* sd)
if (sd->sizeok != 1)
return;
// create the IrStruct
IrStruct* irstruct = new IrStruct(sd);
// create the IrAggr
IrAggr* irstruct = new IrAggr(sd);
sd->ir.irStruct = irstruct;
// Set up our field metadata.

View File

@@ -280,7 +280,7 @@ static llvm::DIType dwarfCompositeType(Type* type)
if (sd->sizeok == 0)
return llvm::DICompositeType(NULL);
IrStruct* ir = sd->ir.irStruct;
IrAggr* ir = sd->ir.irStruct;
assert(ir);
if (static_cast<llvm::MDNode*>(ir->diCompositeType) != 0)
return ir->diCompositeType;

View File

@@ -607,7 +607,7 @@ void TypeInfoStructDeclaration::llvmDefine()
}
sd->codegen(Type::sir);
IrStruct* irstruct = sd->ir.irStruct;
IrAggr* irstruct = sd->ir.irStruct;
RTTIBuilder b(Type::typeinfostruct);