From c42c90ea80dc643795de1a3e04f7c821ca42212f Mon Sep 17 00:00:00 2001 From: Tomas Lindquist Olsen Date: Thu, 26 Mar 2009 20:45:53 +0100 Subject: [PATCH] * Moved ir/irsymbol.cpp/h into ir/irdsymbol.cpp/h. * Added #if IN_DMD versioning around DMD backend specific code in the D1 frontend, D2 is currently broken. * All part of a greater cleanup scheme. --- dmd/aggregate.h | 6 + dmd/attrib.c | 8 +- dmd/class.c | 2 + dmd/declaration.c | 2 + dmd/declaration.h | 88 +++++++++++- dmd/dsymbol.c | 8 ++ dmd/dsymbol.h | 15 ++- dmd/enum.c | 2 + dmd/enum.h | 2 + dmd/expression.c | 2 + dmd/expression.h | 73 +++++++--- dmd/func.c | 4 + dmd/init.h | 10 ++ dmd/inline.c | 6 + dmd/module.c | 4 + dmd/module.h | 4 +- dmd/mtype.c | 2 + dmd/mtype.h | 49 ++++++- dmd/struct.c | 2 + dmd/template.c | 8 +- gen/tocsym.cpp | 208 ----------------------------- gen/todt.cpp | 140 ------------------- gen/toir.cpp | 159 +--------------------- gen/toobj.cpp | 10 -- gen/typinf.cpp | 101 ++------------ ir/{irsymbol.cpp => irdsymbol.cpp} | 2 +- ir/{irsymbol.h => irdsymbol.h} | 4 +- 27 files changed, 283 insertions(+), 638 deletions(-) delete mode 100644 gen/tocsym.cpp delete mode 100644 gen/todt.cpp rename ir/{irsymbol.cpp => irdsymbol.cpp} (98%) rename ir/{irsymbol.h => irdsymbol.h} (93%) diff --git a/dmd/aggregate.h b/dmd/aggregate.h index cdb326ee..8e38ce5d 100644 --- a/dmd/aggregate.h +++ b/dmd/aggregate.h @@ -98,10 +98,12 @@ struct AggregateDeclaration : ScopeDsymbol enum PROT prot(); +#if IN_DMD // Back end Symbol *stag; // tag symbol for debug data Symbol *sinit; Symbol *toInitializer(); +#endif AggregateDeclaration *isAggregateDeclaration() { return this; } }; @@ -250,6 +252,7 @@ struct ClassDeclaration : AggregateDeclaration // Back end void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD void toDebug(); unsigned baseVtblOffset(BaseClass *bc); Symbol *toSymbol(); @@ -258,6 +261,7 @@ struct ClassDeclaration : AggregateDeclaration void toDt2(dt_t **pdt, ClassDeclaration *cd); Symbol *vtblsym; +#endif ClassDeclaration *isClassDeclaration() { return (ClassDeclaration *)this; } }; @@ -280,7 +284,9 @@ struct InterfaceDeclaration : ClassDeclaration virtual int isCOMinterface(); void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD Symbol *toSymbol(); +#endif InterfaceDeclaration *isInterfaceDeclaration() { return this; } }; diff --git a/dmd/attrib.c b/dmd/attrib.c index dfae5698..08f9c375 100644 --- a/dmd/attrib.c +++ b/dmd/attrib.c @@ -27,19 +27,23 @@ #include "parse.h" #include "template.h" +#if IN_LLVM #include "../gen/enums.h" - #include "llvm/Support/CommandLine.h" static llvm::cl::opt ignoreUnsupportedPragmas("ignore", llvm::cl::desc("Ignore unsupported pragmas"), llvm::cl::ZeroOrMore); +#endif extern void obj_includelib(const char *name); + +#if IN_DMD void obj_startaddress(Symbol *s); +#endif /********************************* AttribDeclaration ****************************/ @@ -180,6 +184,7 @@ void AttribDeclaration::toObjFile(int multiobj) } } +#if IN_DMD int AttribDeclaration::cvMember(unsigned char *p) { int nwritten = 0; @@ -198,6 +203,7 @@ int AttribDeclaration::cvMember(unsigned char *p) } return nwritten; } +#endif int AttribDeclaration::hasPointers() { diff --git a/dmd/class.c b/dmd/class.c index 8cb9e3d3..5bb66eaa 100644 --- a/dmd/class.c +++ b/dmd/class.c @@ -57,7 +57,9 @@ ClassDeclaration::ClassDeclaration(Loc loc, Identifier *id, BaseClasses *basecla staticCtor = NULL; staticDtor = NULL; +#if IN_DMD vtblsym = NULL; +#endif vclassinfo = NULL; if (id) diff --git a/dmd/declaration.c b/dmd/declaration.c index c3ceb32f..b5682b3c 100644 --- a/dmd/declaration.c +++ b/dmd/declaration.c @@ -255,7 +255,9 @@ TypedefDeclaration::TypedefDeclaration(Loc loc, Identifier *id, Type *basetype, this->sem = 0; this->inuse = 0; this->loc = loc; +#if IN_DMD this->sinit = NULL; +#endif } Dsymbol *TypedefDeclaration::syntaxCopy(Dsymbol *s) diff --git a/dmd/declaration.h b/dmd/declaration.h index f819858f..0c278e47 100644 --- a/dmd/declaration.h +++ b/dmd/declaration.h @@ -191,13 +191,17 @@ struct TypedefDeclaration : Declaration void toDocBuffer(OutBuffer *buf); void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD void toDebug(); int cvMember(unsigned char *p); +#endif TypedefDeclaration *isTypedefDeclaration() { return this; } +#if IN_DMD Symbol *sinit; Symbol *toInitializer(); +#endif }; /**************************************************************/ @@ -264,17 +268,21 @@ struct VarDeclaration : Declaration void checkNestedReference(Scope *sc, Loc loc); Dsymbol *toAlias(); - Symbol *toSymbol(); void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD + Symbol *toSymbol(); int cvMember(unsigned char *p); +#endif // Eliminate need for dynamic_cast VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } +#if IN_LLVM // LDC AnonDeclaration* anonDecl; unsigned offset2; bool nakedUse; +#endif }; /**************************************************************/ @@ -287,7 +295,9 @@ struct StaticStructInitDeclaration : Declaration StaticStructInitDeclaration(Loc loc, StructDeclaration *dsym); +#if IN_DMD Symbol *toSymbol(); +#endif // Eliminate need for dynamic_cast StaticStructInitDeclaration *isStaticStructInitDeclaration() { return (StaticStructInitDeclaration *)this; } @@ -303,7 +313,9 @@ struct ClassInfoDeclaration : VarDeclaration void emitComment(Scope *sc); +#if IN_DMD Symbol *toSymbol(); +#endif ClassInfoDeclaration* isClassInfoDeclaration() { return this; } }; @@ -318,7 +330,9 @@ struct ModuleInfoDeclaration : VarDeclaration void emitComment(Scope *sc); +#if IN_DMD Symbol *toSymbol(); +#endif }; struct TypeInfoDeclaration : VarDeclaration @@ -331,147 +345,199 @@ struct TypeInfoDeclaration : VarDeclaration void emitComment(Scope *sc); - Symbol *toSymbol(); void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD + Symbol *toSymbol(); virtual void toDt(dt_t **pdt); +#endif virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; } +#if IN_LLVM // LDC virtual void llvmDeclare(); virtual void llvmDefine(); +#endif }; struct TypeInfoStructDeclaration : TypeInfoDeclaration { TypeInfoStructDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoClassDeclaration : TypeInfoDeclaration { TypeInfoClassDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration { TypeInfoInterfaceDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoTypedefDeclaration : TypeInfoDeclaration { TypeInfoTypedefDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoPointerDeclaration : TypeInfoDeclaration { TypeInfoPointerDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoArrayDeclaration : TypeInfoDeclaration { TypeInfoArrayDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration { TypeInfoStaticArrayDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration { TypeInfoAssociativeArrayDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoEnumDeclaration : TypeInfoDeclaration { TypeInfoEnumDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoFunctionDeclaration : TypeInfoDeclaration { TypeInfoFunctionDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoDelegateDeclaration : TypeInfoDeclaration { TypeInfoDelegateDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoTupleDeclaration : TypeInfoDeclaration { TypeInfoTupleDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; #if DMDV2 @@ -479,22 +545,30 @@ struct TypeInfoConstDeclaration : TypeInfoDeclaration { TypeInfoConstDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; struct TypeInfoInvariantDeclaration : TypeInfoDeclaration { TypeInfoInvariantDeclaration(Type *tinfo); +#if IN_DMD void toDt(dt_t **pdt); +#endif +#if IN_LLVM // LDC void llvmDeclare(); void llvmDefine(); +#endif }; #endif @@ -578,7 +652,9 @@ struct FuncDeclaration : Declaration // Support for NRVO (named return value optimization) int nrvo_can; // !=0 means we can do it VarDeclaration *nrvo_var; // variable to replace with shidden +#if IN_DMD Symbol *shidden; // hidden pointer passed to function +#endif #if DMDV2 enum BUILTIN builtin; // set if this is a known, builtin @@ -637,13 +713,18 @@ struct FuncDeclaration : Declaration static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, const char *name); static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, Identifier *id); +#if IN_DMD Symbol *toSymbol(); Symbol *toThunkSymbol(int offset); // thunk version +#endif void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD int cvMember(unsigned char *p); +#endif FuncDeclaration *isFuncDeclaration() { return this; } +#if IN_LLVM // LDC stuff // vars declared in this function that nested funcs reference @@ -666,6 +747,7 @@ struct FuncDeclaration : Declaration // true if overridden with the pragma(allow_inline); stmt bool allowInlining; +#endif }; struct FuncAliasDeclaration : FuncDeclaration @@ -676,7 +758,9 @@ struct FuncAliasDeclaration : FuncDeclaration FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } const char *kind(); +#if IN_DMD Symbol *toSymbol(); +#endif }; struct FuncLiteralDeclaration : FuncDeclaration diff --git a/dmd/dsymbol.c b/dmd/dsymbol.c index b5101d6b..864644da 100644 --- a/dmd/dsymbol.c +++ b/dmd/dsymbol.c @@ -39,12 +39,16 @@ Dsymbol::Dsymbol() this->ident = NULL; this->c_ident = NULL; this->parent = NULL; +#if IN_DMD this->csym = NULL; this->isym = NULL; +#endif this->loc = 0; this->comment = NULL; +#if IN_LLVM this->llvmInternal = LLVMnone; +#endif } Dsymbol::Dsymbol(Identifier *ident) @@ -53,12 +57,16 @@ Dsymbol::Dsymbol(Identifier *ident) this->ident = ident; this->c_ident = NULL; this->parent = NULL; +#if IN_DMD this->csym = NULL; this->isym = NULL; +#endif this->loc = 0; this->comment = NULL; +#if IN_LLVM this->llvmInternal = LLVMnone; +#endif } int Dsymbol::equals(Object *o) diff --git a/dmd/dsymbol.h b/dmd/dsymbol.h index 0bed9182..6c8e6beb 100644 --- a/dmd/dsymbol.h +++ b/dmd/dsymbol.h @@ -22,7 +22,7 @@ #include "arraytypes.h" // llvm -#include "../ir/irsymbol.h" +#include "../ir/irdsymbol.h" struct Identifier; struct Scope; @@ -49,7 +49,6 @@ struct UnitTestDeclaration; struct NewDeclaration; struct VarDeclaration; struct AttribDeclaration; -struct Symbol; struct Package; struct Module; struct Import; @@ -72,6 +71,10 @@ struct HdrGenState; struct TypeInfoDeclaration; struct ClassInfoDeclaration; +#if IN_DMD +struct Symbol; +#endif + #if IN_GCC union tree_node; typedef union tree_node TYPE; @@ -104,8 +107,10 @@ struct Dsymbol : Object Identifier *ident; Identifier *c_ident; Dsymbol *parent; +#if IN_DMD Symbol *csym; // symbol for code generator Symbol *isym; // import version of csym +#endif unsigned char *comment; // documentation comment for this Dsymbol Loc loc; // where defined @@ -171,16 +176,20 @@ struct Dsymbol : Object virtual void emitComment(Scope *sc); void emitDitto(Scope *sc); +#if IN_DMD // Backend virtual Symbol *toSymbol(); // to backend symbol +#endif virtual void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD virtual int cvMember(unsigned char *p); // emit cv debug info for member Symbol *toImport(); // to backend import symbol static Symbol *toImport(Symbol *s); // to backend import symbol Symbol *toSymbolX(const char *prefix, int sclass, TYPE *t, const char *suffix); // helper +#endif // Eliminate need for dynamic_cast virtual Package *isPackage() { return NULL; } @@ -222,10 +231,12 @@ struct Dsymbol : Object virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return NULL; } virtual ClassInfoDeclaration* isClassInfoDeclaration() { return NULL; } +#if IN_LLVM // llvm stuff int llvmInternal; IrDsymbol ir; +#endif }; // Dsymbol that generates a scope diff --git a/dmd/enum.c b/dmd/enum.c index 20c16bf5..c413aa1b 100644 --- a/dmd/enum.c +++ b/dmd/enum.c @@ -27,7 +27,9 @@ EnumDeclaration::EnumDeclaration(Loc loc, Identifier *id, Type *memtype) maxval = 0; minval = 0; defaultval = 0; +#if IN_DMD sinit = NULL; +#endif isdeprecated = 0; } diff --git a/dmd/enum.h b/dmd/enum.h index 7b343f91..ebe29f63 100644 --- a/dmd/enum.h +++ b/dmd/enum.h @@ -65,8 +65,10 @@ struct EnumDeclaration : ScopeDsymbol void toDebug(); int cvMember(unsigned char *p); +#if IN_DMD Symbol *sinit; Symbol *toInitializer(); +#endif }; diff --git a/dmd/expression.c b/dmd/expression.c index 62acf04b..c5735c69 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -3075,7 +3075,9 @@ StructLiteralExp::StructLiteralExp(Loc loc, StructDeclaration *sd, Expressions * { this->sd = sd; this->elements = elements; +#if IN_DMD this->sym = NULL; +#endif this->soffset = 0; this->fillHoles = 1; } diff --git a/dmd/expression.h b/dmd/expression.h index 1fe1f3f9..077381c3 100644 --- a/dmd/expression.h +++ b/dmd/expression.h @@ -42,29 +42,32 @@ struct ClassDeclaration; struct HdrGenState; struct BinExp; struct InterState; -struct Symbol; // back end symbol struct OverloadSet; -namespace llvm -{ - class Constant; - class ConstantInt; -} enum TOK; // Back end struct IRState; + +#if IN_DMD struct dt_t; +struct elem; +struct Symbol; // back end symbol +#endif + +#ifdef IN_GCC +union tree_node; typedef union tree_node elem; +#endif #if IN_LLVM struct DValue; typedef DValue elem; -#else -#ifdef IN_GCC -union tree_node; typedef union tree_node elem; -#else -struct elem; -#endif + +namespace llvm +{ + class Constant; + class ConstantInt; +} #endif void initPrecedence(); @@ -159,9 +162,12 @@ struct Expression : Object // Back end virtual elem *toElem(IRState *irs); +#if IN_DMD virtual dt_t **toDt(dt_t **pdt); +#elif IN_LLVM // LDC virtual llvm::Constant *toConstElem(IRState *irs); +#endif }; struct IntegerExp : Expression @@ -186,9 +192,12 @@ struct IntegerExp : Expression void toMangleBuffer(OutBuffer *buf); Expression *toLvalue(Scope *sc, Expression *e); elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM // LDC virtual llvm::Constant *toConstElem(IRState *irs); +#endif }; struct RealExp : Expression @@ -211,9 +220,12 @@ struct RealExp : Expression void toCBuffer(OutBuffer *buf, HdrGenState *hgs); void toMangleBuffer(OutBuffer *buf); elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM // LDC virtual llvm::Constant *toConstElem(IRState *irs); +#endif }; struct ComplexExp : Expression @@ -239,9 +251,12 @@ struct ComplexExp : Expression OutBuffer hexp; #endif elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM // LDC virtual llvm::Constant *toConstElem(IRState *irs); +#endif }; struct IdentifierExp : Expression @@ -318,9 +333,12 @@ struct NullExp : Expression Expression *castTo(Scope *sc, Type *t); Expression *interpret(InterState *istate); elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM // LDC virtual llvm::Constant *toConstElem(IRState *irs); +#endif }; struct StringExp : Expression @@ -348,9 +366,12 @@ struct StringExp : Expression void toCBuffer(OutBuffer *buf, HdrGenState *hgs); void toMangleBuffer(OutBuffer *buf); elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM // LDC virtual llvm::Constant *toConstElem(IRState *irs); +#endif }; // Tuple @@ -397,13 +418,16 @@ struct ArrayLiteralExp : Expression Expression *interpret(InterState *istate); MATCH implicitConvTo(Type *t); Expression *castTo(Scope *sc, Type *t); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM + // LDC + virtual llvm::Constant *toConstElem(IRState *irs); +#endif int inlineCost(InlineCostState *ics); Expression *doInline(InlineDoState *ids); Expression *inlineScan(InlineScanState *iss); - // LDC - virtual llvm::Constant *toConstElem(IRState *irs); }; struct AssocArrayLiteralExp : Expression @@ -429,8 +453,10 @@ struct AssocArrayLiteralExp : Expression int inlineCost(InlineCostState *ics); Expression *doInline(InlineDoState *ids); Expression *inlineScan(InlineScanState *iss); +#if IN_LLVM // LDC virtual llvm::Constant *toConstElem(IRState *irs); +#endif }; struct StructLiteralExp : Expression @@ -439,7 +465,9 @@ struct StructLiteralExp : Expression Expressions *elements; // parallels sd->fields[] with // NULL entries for fields to skip +#if IN_DMD Symbol *sym; // back end symbol to initialize with literal +#endif size_t soffset; // offset from start of s int fillHoles; // fill alignment 'holes' with zero @@ -456,14 +484,18 @@ struct StructLiteralExp : Expression void scanForNestedRef(Scope *sc); Expression *optimize(int result); Expression *interpret(InterState *istate); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM + // LDC + virtual llvm::Constant *toConstElem(IRState *irs); +#endif Expression *toLvalue(Scope *sc, Expression *e); int inlineCost(InlineCostState *ics); Expression *doInline(InlineDoState *ids); Expression *inlineScan(InlineScanState *iss); - // LDC - virtual llvm::Constant *toConstElem(IRState *irs); + }; struct TypeDotIdExp : Expression @@ -570,7 +602,9 @@ struct SymOffExp : Expression void scanForNestedRef(Scope *sc); elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#endif }; // Variable @@ -591,14 +625,17 @@ struct VarExp : Expression Expression *toLvalue(Scope *sc, Expression *e); Expression *modifiableLvalue(Scope *sc, Expression *e); elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#elif IN_LLVM + // LDC + virtual llvm::Constant *toConstElem(IRState *irs); +#endif void scanForNestedRef(Scope *sc); int inlineCost(InlineCostState *ics); Expression *doInline(InlineDoState *ids); //Expression *inlineScan(InlineScanState *iss); - // LDC - virtual llvm::Constant *toConstElem(IRState *irs); }; #if DMDV2 diff --git a/dmd/func.c b/dmd/func.c index 75d668c5..f7afe37c 100644 --- a/dmd/func.c +++ b/dmd/func.c @@ -76,11 +76,15 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC s hasReturnExp = 0; nrvo_can = 1; nrvo_var = NULL; +#if IN_DMD shidden = NULL; +#endif +#if IN_LLVM // LDC isArrayOp = false; allowInlining = false; +#endif } Dsymbol *FuncDeclaration::syntaxCopy(Dsymbol *s) diff --git a/dmd/init.h b/dmd/init.h index 77a6b573..d7a4bcf0 100644 --- a/dmd/init.h +++ b/dmd/init.h @@ -44,7 +44,9 @@ struct Initializer : Object static Initializers *arraySyntaxCopy(Initializers *ai); +#if IN_DMD virtual dt_t *toDt(); +#endif virtual VoidInitializer *isVoidInitializer() { return NULL; } virtual StructInitializer *isStructInitializer() { return NULL; } @@ -62,7 +64,9 @@ struct VoidInitializer : Initializer Expression *toExpression(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +#if IN_DMD dt_t *toDt(); +#endif virtual VoidInitializer *isVoidInitializer() { return this; } }; @@ -82,7 +86,9 @@ struct StructInitializer : Initializer Expression *toExpression(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +#if IN_DMD dt_t *toDt(); +#endif StructInitializer *isStructInitializer() { return this; } }; @@ -104,8 +110,10 @@ struct ArrayInitializer : Initializer Initializer *toAssocArrayInitializer(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +#if IN_DMD dt_t *toDt(); dt_t *toDtBit(); // for bit arrays +#endif ArrayInitializer *isArrayInitializer() { return this; } }; @@ -121,7 +129,9 @@ struct ExpInitializer : Initializer Expression *toExpression(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +#if IN_DMD dt_t *toDt(); +#endif virtual ExpInitializer *isExpInitializer() { return this; } }; diff --git a/dmd/inline.c b/dmd/inline.c index 9b290921..b6f1a1bb 100644 --- a/dmd/inline.c +++ b/dmd/inline.c @@ -551,8 +551,10 @@ Expression *DeclarationExp::doInline(InlineDoState *ids) vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init); *vto = *vd; vto->parent = ids->parent; +#if IN_DMD vto->csym = NULL; vto->isym = NULL; +#endif ids->from.push(vd); ids->to.push(vto); @@ -645,8 +647,10 @@ Expression *IndexExp::doInline(InlineDoState *ids) vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init); *vto = *vd; vto->parent = ids->parent; +#if IN_DMD vto->csym = NULL; vto->isym = NULL; +#endif ids->from.push(vd); ids->to.push(vto); @@ -682,8 +686,10 @@ Expression *SliceExp::doInline(InlineDoState *ids) vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init); *vto = *vd; vto->parent = ids->parent; +#if IN_DMD vto->csym = NULL; vto->isym = NULL; +#endif ids->from.push(vd); ids->to.push(vto); diff --git a/dmd/module.c b/dmd/module.c index 9eb696fb..6500b3e8 100644 --- a/dmd/module.c +++ b/dmd/module.c @@ -97,6 +97,7 @@ Module::Module(char *filename, Identifier *ident, int doDocComment, int doHdrGen semanticdone = 0; decldefs = NULL; vmoduleinfo = NULL; +#if IN_DMD massert = NULL; marray = NULL; sictor = NULL; @@ -104,6 +105,7 @@ Module::Module(char *filename, Identifier *ident, int doDocComment, int doHdrGen sdtor = NULL; stest = NULL; sfilename = NULL; +#endif root = 0; importedFrom = NULL; srcfile = NULL; @@ -120,9 +122,11 @@ Module::Module(char *filename, Identifier *ident, int doDocComment, int doHdrGen macrotable = NULL; escapetable = NULL; +#if IN_DMD doppelganger = 0; cov = NULL; covb = NULL; +#endif srcfilename = FileName::defaultExt(filename, global.mars_ext); if (!srcfilename->equalsExt(global.mars_ext) && diff --git a/dmd/module.h b/dmd/module.h index 0f04d5a2..8308d64c 100644 --- a/dmd/module.h +++ b/dmd/module.h @@ -32,6 +32,7 @@ struct DValue; typedef DValue elem; namespace llvm { class Module; } #else + #ifdef IN_GCC union tree_node; typedef union tree_node elem; #else @@ -147,7 +148,7 @@ struct Module : Package int imports(Module *m); // Back end - +#if IN_DMD int doppelganger; // sub-module Symbol *cov; // private uint[] __coverage; unsigned *covb; // bit array of valid code line numbers @@ -171,6 +172,7 @@ struct Module : Package elem *toEmodulename(); Symbol *toSymbol(); +#endif void genmoduleinfo(); // LDC diff --git a/dmd/mtype.c b/dmd/mtype.c index 0fd7ec72..8dc4d937 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -130,7 +130,9 @@ Type::Type(TY ty, Type *next) this->rto = NULL; this->arrayof = NULL; this->vtinfo = NULL; +#if IN_DMD this->ctype = NULL; +#endif } Type *Type::syntaxCopy() diff --git a/dmd/mtype.h b/dmd/mtype.h index 0bfc9642..06a2ebeb 100644 --- a/dmd/mtype.h +++ b/dmd/mtype.h @@ -21,10 +21,12 @@ #include "arraytypes.h" #include "expression.h" +#if IN_LLVM // llvm #include "../ir/irtype.h" #include "../ir/irfuncty.h" namespace llvm { class Type; } +#endif struct Scope; struct Identifier; @@ -48,10 +50,12 @@ struct Argument; #if IN_GCC union tree_node; typedef union tree_node TYPE; typedef TYPE type; -#else -typedef struct TYPE type; #endif + +#if IN_DMD +typedef struct TYPE type; struct Symbol; +#endif enum TY { @@ -126,7 +130,9 @@ struct Type : Object Type *arrayof; // array of this type TypeInfoDeclaration *vtinfo; // TypeInfo object for this Type +#if IN_DMD type *ctype; // for back end +#endif #define tvoid basic[Tvoid] #define tint8 basic[Tint8] @@ -236,7 +242,9 @@ struct Type : Object virtual unsigned memalign(unsigned salign); virtual Expression *defaultInit(Loc loc = 0); virtual int isZeroInit(); // if initializer is 0 +#if IN_DMD virtual dt_t **toDt(dt_t **pdt); +#endif Identifier *getTypeInfoIdent(int internal); virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); @@ -253,17 +261,21 @@ struct Type : Object static void error(Loc loc, const char *format, ...); static void warning(Loc loc, const char *format, ...); +#if IN_DMD // For backend virtual unsigned totym(); virtual type *toCtype(); virtual type *toCParamtype(); virtual Symbol *toSymbol(); +#endif // For eliminating dynamic_cast virtual TypeBasic *isTypeBasic(); +#if IN_LLVM // LDC IrType ir; +#endif }; struct TypeBasic : Type @@ -322,15 +334,19 @@ struct TypeSArray : TypeArray unsigned memalign(unsigned salign); MATCH implicitConvTo(Type *to); Expression *defaultInit(Loc loc); +#if IN_DMD dt_t **toDt(dt_t **pdt); dt_t **toDtElem(dt_t **pdt, Expression *e); +#endif MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); TypeInfoDeclaration *getTypeInfoDeclaration(); Expression *toExpression(); int hasPointers(); +#if IN_DMD type *toCtype(); type *toCParamtype(); +#endif }; // Dynamic array, no dimension @@ -353,7 +369,9 @@ struct TypeDArray : TypeArray TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeAArray : TypeArray @@ -376,10 +394,12 @@ struct TypeAArray : TypeArray TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD // Back end Symbol *aaGetSymbol(const char *func, int flags); type *toCtype(); +#endif }; struct TypePointer : Type @@ -398,7 +418,9 @@ struct TypePointer : Type TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeReference : Type @@ -438,13 +460,18 @@ struct TypeFunction : Type Type *reliesOnTident(); int callMatch(Expressions *toargs); +#if IN_DMD type *toCtype(); +#endif + enum RET retStyle(); +#if IN_DMD unsigned totym(); - +#elif IN_LLVM // LDC IrFuncTy fty; +#endif }; struct TypeDelegate : Type @@ -462,7 +489,9 @@ struct TypeDelegate : Type Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeQualified : Type @@ -543,17 +572,21 @@ struct TypeStruct : Type Expression *defaultInit(Loc loc); int isZeroInit(); int checkBoolean(); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#endif MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); - +#elif IN_LLVM // LDC // cache the hasUnalignedFields check // 0 = not checked, 1 = aligned, 2 = unaligned int unaligned; +#endif }; struct TypeEnum : Type @@ -583,7 +616,9 @@ struct TypeEnum : Type TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeTypedef : Type @@ -614,13 +649,17 @@ struct TypeTypedef : Type MATCH implicitConvTo(Type *to); Expression *defaultInit(Loc loc); int isZeroInit(); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#endif MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); type *toCParamtype(); +#endif }; struct TypeClass : Type @@ -647,9 +686,11 @@ struct TypeClass : Type TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); Symbol *toSymbol(); +#endif }; struct TypeTuple : Type diff --git a/dmd/struct.c b/dmd/struct.c index dfd5175c..721fc57e 100644 --- a/dmd/struct.c +++ b/dmd/struct.c @@ -41,8 +41,10 @@ AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id) aggNew = NULL; aggDelete = NULL; +#if IN_DMD stag = NULL; sinit = NULL; +#endif scope = NULL; #if V2 dtor = NULL; diff --git a/dmd/template.c b/dmd/template.c index 80492c59..33716ba3 100644 --- a/dmd/template.c +++ b/dmd/template.c @@ -363,14 +363,18 @@ void TemplateDeclaration::semantic(Scope *sc) { // Generate this function as it may be used // when template is instantiated in other modules - sc->module->toModuleArray(); + + // FIXME: LDC + //sc->module->toModuleArray(); } if (/*global.params.useAssert &&*/ sc->module) { // Generate this function as it may be used // when template is instantiated in other modules - sc->module->toModuleAssert(); + + // FIXME: LDC + //sc->module->toModuleAssert(); } /* Remember Scope for later instantiations, but make diff --git a/gen/tocsym.cpp b/gen/tocsym.cpp deleted file mode 100644 index 8a12d782..00000000 --- a/gen/tocsym.cpp +++ /dev/null @@ -1,208 +0,0 @@ - -// Copyright (c) 1999-2005 by Digital Mars -// All Rights Reserved -// written by Walter Bright -// www.digitalmars.com -// License for redistribution is by either the Artistic License -// in artistic.txt, or the GNU General Public License in gnu.txt. -// See the included readme.txt for details. - -// stubbed out for dmdfe. Original is in dmd/tocsym.c - -#include - -#include "mars.h" -#include "module.h" -#include "mtype.h" -#include "declaration.h" -#include "statement.h" -#include "enum.h" -#include "aggregate.h" -#include "init.h" -#include "attrib.h" -#include "lexer.h" - - -Symbol *StaticStructInitDeclaration::toSymbol() -{ - return 0; -} - -/************************************* - * Helper - */ - -Symbol *Dsymbol::toSymbolX(const char *prefix, int sclass, TYPE *t, const char *suffix) -{ - return 0; -} - -/************************************* - */ - -Symbol *Dsymbol::toSymbol() -{ - return 0; -} - -/********************************* - * Generate import symbol from symbol. - */ - -Symbol *Dsymbol::toImport() -{ - return 0; -} - -/************************************* - */ - -Symbol *Dsymbol::toImport(Symbol *sym) -{ - return 0; -} - -/************************************* - */ - -Symbol *VarDeclaration::toSymbol() -{ - return 0; -} - -/************************************* - */ - -Symbol *ClassInfoDeclaration::toSymbol() -{ - return 0; -} - -/************************************* - */ - -Symbol *ModuleInfoDeclaration::toSymbol() -{ - return 0; -} - -/************************************* - */ - -Symbol *TypeInfoDeclaration::toSymbol() -{ - return 0; -} - -/************************************* - */ - -Symbol *FuncDeclaration::toSymbol() -{ - - return 0; -} - -/************************************* - */ - -Symbol *FuncDeclaration::toThunkSymbol(int offset) -{ - return 0; -} - -/************************************* - */ - -Symbol *FuncAliasDeclaration::toSymbol() -{ - - return 0; -} - - -/**************************************** - * Create a static symbol we can hang DT initializers onto. - */ - -Symbol *static_sym() -{ - return 0; -} - -/************************************* - * Create the "ClassInfo" symbol - */ - -Symbol *ClassDeclaration::toSymbol() -{ - return 0; -} - -/************************************* - * Create the "InterfaceInfo" symbol - */ - -Symbol *InterfaceDeclaration::toSymbol() -{ - return 0; -} - -/************************************* - * Create the "ModuleInfo" symbol - */ - -Symbol *Module::toSymbol() -{ - return 0; -} - -/************************************* - * This is accessible via the ClassData, but since it is frequently - * needed directly (like for rtti comparisons), make it directly accessible. - */ - -Symbol *ClassDeclaration::toVtblSymbol() -{ - return 0; -} - -/********************************** - * Create the static initializer for the struct/class. - */ - -Symbol *AggregateDeclaration::toInitializer() -{ - return 0; -} - - -/****************************************** - */ - -Symbol *Module::toModuleAssert() -{ - return 0; -} - -/****************************************** - */ - -Symbol *Module::toModuleArray() -{ - return 0; -} - -/******************************************** - * Determine the right symbol to look up - * an associative array element. - * Input: - * flags 0 don't add value signature - * 1 add value signature - */ - -Symbol *TypeAArray::aaGetSymbol(const char *func, int flags) -{ - return 0; -} - diff --git a/gen/todt.cpp b/gen/todt.cpp deleted file mode 100644 index 285db856..00000000 --- a/gen/todt.cpp +++ /dev/null @@ -1,140 +0,0 @@ - -// Copyright (c) 1999-2005 by Digital Mars -// All Rights Reserved -// written by Walter Bright -// www.digitalmars.com -// License for redistribution is by either the Artistic License -// in artistic.txt, or the GNU General Public License in gnu.txt. -// See the included readme.txt for details. - -// stubbed out for dmdfe. Original is in dmd/todt.c - -#include "lexer.h" -#include "mtype.h" -#include "expression.h" -#include "init.h" -#include "enum.h" -#include "aggregate.h" -#include "declaration.h" - -struct dt_t {}; - -dt_t *Initializer::toDt() -{ - return 0; -} - - -dt_t *StructInitializer::toDt() -{ - return 0; -} - - -dt_t *ArrayInitializer::toDt() -{ - return 0; -} - - -dt_t *ArrayInitializer::toDtBit() -{ - return 0; -} - - -dt_t *ExpInitializer::toDt() -{ - return 0; -} - -dt_t *VoidInitializer::toDt() -{ - return 0; -} - -/* ================================================================ */ - -dt_t **Expression::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **IntegerExp::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **RealExp::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **ComplexExp::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **NullExp::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **StringExp::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **SymOffExp::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **VarExp::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **ArrayLiteralExp::toDt(dt_t **pdt) -{ - return 0; -} -dt_t **StructLiteralExp::toDt(dt_t **pdt) -{ - return 0; -} - -void ClassDeclaration::toDt(dt_t **pdt) -{ -} - -void ClassDeclaration::toDt2(dt_t **pdt, ClassDeclaration *cd) -{ -} - -void StructDeclaration::toDt(dt_t **pdt) -{ -} - -dt_t **Type::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **TypeSArray::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **TypeStruct::toDt(dt_t **pdt) -{ - return 0; -} - -dt_t **TypeTypedef::toDt(dt_t **pdt) -{ - return 0; -} - - - diff --git a/gen/toir.cpp b/gen/toir.cpp index fb6a373a..e6f9ac24 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2618,164 +2618,7 @@ CONSTSTUB(SliceExp); CONSTSTUB(IndexExp); CONSTSTUB(AssocArrayLiteralExp); -unsigned Type::totym() { return 0; } - -type * Type::toCtype() -{ - assert(0); - return 0; -} - -type * Type::toCParamtype() -{ - assert(0); - return 0; -} -Symbol * Type::toSymbol() -{ - assert(0); - return 0; -} - -type * -TypeTypedef::toCtype() -{ - assert(0); - return 0; -} - -type * -TypeTypedef::toCParamtype() -{ - assert(0); - return 0; -} - -void -TypedefDeclaration::toDebug() -{ - assert(0); -} - - -type * -TypeEnum::toCtype() -{ - assert(0); - return 0; -} - -type * -TypeStruct::toCtype() -{ - assert(0); - return 0; -} - -void -StructDeclaration::toDebug() -{ - assert(0); -} - -Symbol * TypeClass::toSymbol() -{ - assert(0); - return 0; -} - -unsigned TypeFunction::totym() -{ - assert(0); - return 0; -} - -type * TypeFunction::toCtype() -{ - assert(0); - return 0; -} - -type * TypeSArray::toCtype() -{ - assert(0); - return 0; -} - -type *TypeSArray::toCParamtype() -{ - assert(0); - return 0; -} - -type * TypeDArray::toCtype() -{ - assert(0); - return 0; -} - -type * TypeAArray::toCtype() -{ - assert(0); - return 0; -} - -type * TypePointer::toCtype() -{ - assert(0); - return 0; -} - -type * TypeDelegate::toCtype() -{ - assert(0); - return 0; -} - -type * TypeClass::toCtype() -{ - assert(0); - return 0; -} - -void ClassDeclaration::toDebug() -{ - assert(0); -} - -////////////////////////////////////////////////////////////////////////////// - -void -EnumDeclaration::toDebug() -{ - assert(0); -} - -int Dsymbol::cvMember(unsigned char*) -{ - assert(0); - return 0; -} -int EnumDeclaration::cvMember(unsigned char*) -{ - assert(0); - return 0; -} -int FuncDeclaration::cvMember(unsigned char*) -{ - assert(0); - return 0; -} -int VarDeclaration::cvMember(unsigned char*) -{ - assert(0); - return 0; -} -int TypedefDeclaration::cvMember(unsigned char*) -{ - assert(0); - return 0; -} +////////////////////////////////////////////////////////////////////////////////////////// void obj_includelib(const char* lib) { diff --git a/gen/toobj.cpp b/gen/toobj.cpp index ce80178d..97e615d3 100644 --- a/gen/toobj.cpp +++ b/gen/toobj.cpp @@ -827,16 +827,6 @@ void ClassDeclaration::toObjFile(int multiobj) gIR->resolveList.push_back(this); } -/****************************************** - * Get offset of base class's vtbl[] initializer from start of csym. - * Returns ~0 if not this csym. - */ - -unsigned ClassDeclaration::baseVtblOffset(BaseClass *bc) -{ - return ~0; -} - /* ================================================================== */ void TupleDeclaration::toObjFile(int multiobj) diff --git a/gen/typinf.cpp b/gen/typinf.cpp index 41707cea..a6dfb508 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -352,11 +352,6 @@ void DtoDefineTypeInfo(TypeInfoDeclaration* tid) /* ========================================================================= */ -void TypeInfoDeclaration::toDt(dt_t **pdt) -{ - assert(0 && "TypeInfoDeclaration::toDt"); -} - void TypeInfoDeclaration::llvmDeclare() { assert(0 && "TypeInfoDeclaration::llvmDeclare"); @@ -438,11 +433,6 @@ void TypeInfoTypedefDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoTypedefDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoEnumDeclaration::llvmDeclare() @@ -516,11 +506,6 @@ void TypeInfoEnumDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoEnumDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ static void LLVM_D_Declare_TypeInfoBase(TypeInfoDeclaration* tid, ClassDeclaration* cd) @@ -582,11 +567,6 @@ void TypeInfoPointerDeclaration::llvmDefine() LLVM_D_Define_TypeInfoBase(tc->next, this, Type::typeinfopointer); } -void TypeInfoPointerDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoArrayDeclaration::llvmDeclare() @@ -611,16 +591,11 @@ void TypeInfoArrayDeclaration::llvmDefine() LLVM_D_Define_TypeInfoBase(tc->next, this, Type::typeinfoarray); } -void TypeInfoArrayDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoStaticArrayDeclaration::llvmDeclare() { - Logger::println("TypeInfoStaticArrayDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoStaticArrayDeclaration::llvmDeclare() %s", toChars()); LOG_SCOPE; // init typeinfo class @@ -633,7 +608,7 @@ void TypeInfoStaticArrayDeclaration::llvmDeclare() void TypeInfoStaticArrayDeclaration::llvmDefine() { - Logger::println("TypeInfoStaticArrayDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoStaticArrayDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; // init typeinfo class @@ -671,16 +646,11 @@ void TypeInfoStaticArrayDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoStaticArrayDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoAssociativeArrayDeclaration::llvmDeclare() { - Logger::println("TypeInfoAssociativeArrayDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoAssociativeArrayDeclaration::llvmDeclare() %s", toChars()); LOG_SCOPE; // init typeinfo class @@ -693,7 +663,7 @@ void TypeInfoAssociativeArrayDeclaration::llvmDeclare() void TypeInfoAssociativeArrayDeclaration::llvmDefine() { - Logger::println("TypeInfoAssociativeArrayDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoAssociativeArrayDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; // init typeinfo class @@ -730,16 +700,11 @@ void TypeInfoAssociativeArrayDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoAssociativeArrayDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoFunctionDeclaration::llvmDeclare() { - Logger::println("TypeInfoFunctionDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoFunctionDeclaration::llvmDeclare() %s", toChars()); LOG_SCOPE; assert(tinfo->ty == Tfunction); @@ -750,7 +715,7 @@ void TypeInfoFunctionDeclaration::llvmDeclare() void TypeInfoFunctionDeclaration::llvmDefine() { - Logger::println("TypeInfoFunctionDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoFunctionDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; assert(tinfo->ty == Tfunction); @@ -759,16 +724,11 @@ void TypeInfoFunctionDeclaration::llvmDefine() LLVM_D_Define_TypeInfoBase(tc->next, this, Type::typeinfofunction); } -void TypeInfoFunctionDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoDelegateDeclaration::llvmDeclare() { - Logger::println("TypeInfoDelegateDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoDelegateDeclaration::llvmDeclare() %s", toChars()); LOG_SCOPE; assert(tinfo->ty == Tdelegate); @@ -779,7 +739,7 @@ void TypeInfoDelegateDeclaration::llvmDeclare() void TypeInfoDelegateDeclaration::llvmDefine() { - Logger::println("TypeInfoDelegateDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoDelegateDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; assert(tinfo->ty == Tdelegate); @@ -788,11 +748,6 @@ void TypeInfoDelegateDeclaration::llvmDefine() LLVM_D_Define_TypeInfoBase(tc->nextOf()->nextOf(), this, Type::typeinfodelegate); } -void TypeInfoDelegateDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoStructDeclaration::llvmDeclare() @@ -1007,11 +962,6 @@ void TypeInfoStructDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoStructDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoClassDeclaration::llvmDeclare() @@ -1063,11 +1013,6 @@ void TypeInfoClassDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoClassDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoInterfaceDeclaration::llvmDeclare() @@ -1121,11 +1066,6 @@ void TypeInfoInterfaceDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoInterfaceDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoTupleDeclaration::llvmDeclare() @@ -1208,18 +1148,13 @@ void TypeInfoTupleDeclaration::llvmDefine() isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoTupleDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ #if DMDV2 void TypeInfoConstDeclaration::llvmDeclare() { - Logger::println("TypeInfoConstDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoConstDeclaration::llvmDeclare() %s", toChars()); LOG_SCOPE; LLVM_D_Declare_TypeInfoBase(this, Type::typeinfoconst); @@ -1227,7 +1162,7 @@ void TypeInfoConstDeclaration::llvmDeclare() void TypeInfoConstDeclaration::llvmDefine() { - Logger::println("TypeInfoConstDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoConstDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; Type *tm = tinfo->mutableOf(); @@ -1236,18 +1171,11 @@ void TypeInfoConstDeclaration::llvmDefine() LLVM_D_Define_TypeInfoBase(tm, this, Type::typeinfoconst); } -void TypeInfoConstDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - -/////////////////////////////////////////////////////////// - /* ========================================================================= */ void TypeInfoInvariantDeclaration::llvmDeclare() { - Logger::println("TypeInfoInvariantDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoInvariantDeclaration::llvmDeclare() %s", toChars()); LOG_SCOPE; LLVM_D_Declare_TypeInfoBase(this, Type::typeinfoinvariant); @@ -1255,7 +1183,7 @@ void TypeInfoInvariantDeclaration::llvmDeclare() void TypeInfoInvariantDeclaration::llvmDefine() { - Logger::println("TypeInfoInvariantDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoInvariantDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; Type *tm = tinfo->mutableOf(); @@ -1264,9 +1192,4 @@ void TypeInfoInvariantDeclaration::llvmDefine() LLVM_D_Define_TypeInfoBase(tm, this, Type::typeinfoinvariant); } -void TypeInfoInvariantDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - #endif diff --git a/ir/irsymbol.cpp b/ir/irdsymbol.cpp similarity index 98% rename from ir/irsymbol.cpp rename to ir/irdsymbol.cpp index dd4ebebe..e54bf4f2 100644 --- a/ir/irsymbol.cpp +++ b/ir/irdsymbol.cpp @@ -1,6 +1,6 @@ #include "gen/llvm.h" #include "ir/ir.h" -#include "ir/irsymbol.h" +#include "ir/irdsymbol.h" #include "ir/irvar.h" #include "gen/logger.h" diff --git a/ir/irsymbol.h b/ir/irdsymbol.h similarity index 93% rename from ir/irsymbol.h rename to ir/irdsymbol.h index 586b4c10..574dcc5a 100644 --- a/ir/irsymbol.h +++ b/ir/irdsymbol.h @@ -1,5 +1,5 @@ -#ifndef LDC_IR_IRSYMBOL_H -#define LDC_IR_IRSYMBOL_H +#ifndef LDC_IR_IRDSYMBOL_H +#define LDC_IR_IRDSYMBOL_H #include