mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-21 14:13:20 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user