# HG changeset patch # User Tomas Lindquist Olsen # Date 1238096753 -3600 # Node ID 1860414bf3b7cdd6bfab30363b9fe4c575f7fba8 # Parent 40caa8207b3ee62481d1c4f77119e4431b7e132c * 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. diff -r 40caa8207b3e -r 1860414bf3b7 dmd/aggregate.h --- a/dmd/aggregate.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/aggregate.h Thu Mar 26 20:45:53 2009 +0100 @@ -98,10 +98,12 @@ 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 @@ // 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 @@ void toDt2(dt_t **pdt, ClassDeclaration *cd); Symbol *vtblsym; +#endif ClassDeclaration *isClassDeclaration() { return (ClassDeclaration *)this; } }; @@ -280,7 +284,9 @@ virtual int isCOMinterface(); void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD Symbol *toSymbol(); +#endif InterfaceDeclaration *isInterfaceDeclaration() { return this; } }; diff -r 40caa8207b3e -r 1860414bf3b7 dmd/attrib.c --- a/dmd/attrib.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/attrib.c Thu Mar 26 20:45:53 2009 +0100 @@ -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 @@ } } +#if IN_DMD int AttribDeclaration::cvMember(unsigned char *p) { int nwritten = 0; @@ -198,6 +203,7 @@ } return nwritten; } +#endif int AttribDeclaration::hasPointers() { diff -r 40caa8207b3e -r 1860414bf3b7 dmd/class.c --- a/dmd/class.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/class.c Thu Mar 26 20:45:53 2009 +0100 @@ -57,7 +57,9 @@ staticCtor = NULL; staticDtor = NULL; +#if IN_DMD vtblsym = NULL; +#endif vclassinfo = NULL; if (id) diff -r 40caa8207b3e -r 1860414bf3b7 dmd/declaration.c --- a/dmd/declaration.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/declaration.c Thu Mar 26 20:45:53 2009 +0100 @@ -255,7 +255,9 @@ this->sem = 0; this->inuse = 0; this->loc = loc; +#if IN_DMD this->sinit = NULL; +#endif } Dsymbol *TypedefDeclaration::syntaxCopy(Dsymbol *s) diff -r 40caa8207b3e -r 1860414bf3b7 dmd/declaration.h --- a/dmd/declaration.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/declaration.h Thu Mar 26 20:45:53 2009 +0100 @@ -191,13 +191,17 @@ 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 @@ void checkNestedReference(Scope *sc, Loc loc); Dsymbol *toAlias(); + void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD Symbol *toSymbol(); - void toObjFile(int multiobj); // compile to .obj file 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 @@ 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 @@ void emitComment(Scope *sc); +#if IN_DMD Symbol *toSymbol(); +#endif ClassInfoDeclaration* isClassInfoDeclaration() { return this; } }; @@ -318,7 +330,9 @@ void emitComment(Scope *sc); +#if IN_DMD Symbol *toSymbol(); +#endif }; struct TypeInfoDeclaration : VarDeclaration @@ -331,147 +345,199 @@ void emitComment(Scope *sc); + void toObjFile(int multiobj); // compile to .obj file +#if IN_DMD Symbol *toSymbol(); - void toObjFile(int multiobj); // compile to .obj file 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 @@ { 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 @@ // 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 @@ 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 @@ // true if overridden with the pragma(allow_inline); stmt bool allowInlining; +#endif }; struct FuncAliasDeclaration : FuncDeclaration @@ -676,7 +758,9 @@ FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } const char *kind(); +#if IN_DMD Symbol *toSymbol(); +#endif }; struct FuncLiteralDeclaration : FuncDeclaration diff -r 40caa8207b3e -r 1860414bf3b7 dmd/dsymbol.c --- a/dmd/dsymbol.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/dsymbol.c Thu Mar 26 20:45:53 2009 +0100 @@ -39,12 +39,16 @@ 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 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 dmd/dsymbol.h --- a/dmd/dsymbol.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/dsymbol.h Thu Mar 26 20:45:53 2009 +0100 @@ -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 NewDeclaration; struct VarDeclaration; struct AttribDeclaration; -struct Symbol; struct Package; struct Module; struct Import; @@ -72,6 +71,10 @@ 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 @@ 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 @@ 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 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 dmd/enum.c --- a/dmd/enum.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/enum.c Thu Mar 26 20:45:53 2009 +0100 @@ -27,7 +27,9 @@ maxval = 0; minval = 0; defaultval = 0; +#if IN_DMD sinit = NULL; +#endif isdeprecated = 0; } diff -r 40caa8207b3e -r 1860414bf3b7 dmd/enum.h --- a/dmd/enum.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/enum.h Thu Mar 26 20:45:53 2009 +0100 @@ -65,8 +65,10 @@ void toDebug(); int cvMember(unsigned char *p); +#if IN_DMD Symbol *sinit; Symbol *toInitializer(); +#endif }; diff -r 40caa8207b3e -r 1860414bf3b7 dmd/expression.c --- a/dmd/expression.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/expression.c Thu Mar 26 20:45:53 2009 +0100 @@ -3075,7 +3075,9 @@ { this->sd = sd; this->elements = elements; +#if IN_DMD this->sym = NULL; +#endif this->soffset = 0; this->fillHoles = 1; } diff -r 40caa8207b3e -r 1860414bf3b7 dmd/expression.h --- a/dmd/expression.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/expression.h Thu Mar 26 20:45:53 2009 +0100 @@ -42,29 +42,32 @@ 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 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ void scanForNestedRef(Scope *sc); elem *toElem(IRState *irs); +#if IN_DMD dt_t **toDt(dt_t **pdt); +#endif }; // Variable @@ -591,14 +625,17 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 dmd/func.c --- a/dmd/func.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/func.c Thu Mar 26 20:45:53 2009 +0100 @@ -76,11 +76,15 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 dmd/init.h --- a/dmd/init.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/init.h Thu Mar 26 20:45:53 2009 +0100 @@ -44,7 +44,9 @@ 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 @@ Expression *toExpression(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +#if IN_DMD dt_t *toDt(); +#endif virtual VoidInitializer *isVoidInitializer() { return this; } }; @@ -82,7 +86,9 @@ Expression *toExpression(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +#if IN_DMD dt_t *toDt(); +#endif StructInitializer *isStructInitializer() { return this; } }; @@ -104,8 +110,10 @@ 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 @@ Expression *toExpression(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +#if IN_DMD dt_t *toDt(); +#endif virtual ExpInitializer *isExpInitializer() { return this; } }; diff -r 40caa8207b3e -r 1860414bf3b7 dmd/inline.c --- a/dmd/inline.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/inline.c Thu Mar 26 20:45:53 2009 +0100 @@ -551,8 +551,10 @@ 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 @@ 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 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 dmd/module.c --- a/dmd/module.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/module.c Thu Mar 26 20:45:53 2009 +0100 @@ -97,6 +97,7 @@ semanticdone = 0; decldefs = NULL; vmoduleinfo = NULL; +#if IN_DMD massert = NULL; marray = NULL; sictor = NULL; @@ -104,6 +105,7 @@ sdtor = NULL; stest = NULL; sfilename = NULL; +#endif root = 0; importedFrom = NULL; srcfile = NULL; @@ -120,9 +122,11 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 dmd/module.h --- a/dmd/module.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/module.h Thu Mar 26 20:45:53 2009 +0100 @@ -32,6 +32,7 @@ typedef DValue elem; namespace llvm { class Module; } #else + #ifdef IN_GCC union tree_node; typedef union tree_node elem; #else @@ -147,7 +148,7 @@ 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 @@ elem *toEmodulename(); Symbol *toSymbol(); +#endif void genmoduleinfo(); // LDC diff -r 40caa8207b3e -r 1860414bf3b7 dmd/mtype.c --- a/dmd/mtype.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/mtype.c Thu Mar 26 20:45:53 2009 +0100 @@ -130,7 +130,9 @@ this->rto = NULL; this->arrayof = NULL; this->vtinfo = NULL; +#if IN_DMD this->ctype = NULL; +#endif } Type *Type::syntaxCopy() diff -r 40caa8207b3e -r 1860414bf3b7 dmd/mtype.h --- a/dmd/mtype.h Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/mtype.h Thu Mar 26 20:45:53 2009 +0100 @@ -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 @@ #if IN_GCC union tree_node; typedef union tree_node TYPE; typedef TYPE type; -#else +#endif + +#if IN_DMD typedef struct TYPE type; +struct Symbol; #endif -struct Symbol; enum TY { @@ -126,7 +130,9 @@ 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 @@ 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 @@ 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 @@ 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 @@ TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeAArray : TypeArray @@ -376,10 +394,12 @@ 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 @@ TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeReference : Type @@ -438,13 +460,18 @@ 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 @@ Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeQualified : Type @@ -543,17 +572,21 @@ 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 @@ TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); +#endif }; struct TypeTypedef : Type @@ -614,13 +649,17 @@ 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 @@ TypeInfoDeclaration *getTypeInfoDeclaration(); int hasPointers(); +#if IN_DMD type *toCtype(); Symbol *toSymbol(); +#endif }; struct TypeTuple : Type diff -r 40caa8207b3e -r 1860414bf3b7 dmd/struct.c --- a/dmd/struct.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/struct.c Thu Mar 26 20:45:53 2009 +0100 @@ -41,8 +41,10 @@ aggNew = NULL; aggDelete = NULL; +#if IN_DMD stag = NULL; sinit = NULL; +#endif scope = NULL; #if V2 dtor = NULL; diff -r 40caa8207b3e -r 1860414bf3b7 dmd/template.c --- a/dmd/template.c Thu Mar 26 18:46:21 2009 +0100 +++ b/dmd/template.c Thu Mar 26 20:45:53 2009 +0100 @@ -363,14 +363,18 @@ { // 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 -r 40caa8207b3e -r 1860414bf3b7 gen/tocsym.cpp --- a/gen/tocsym.cpp Thu Mar 26 18:46:21 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r 40caa8207b3e -r 1860414bf3b7 gen/todt.cpp --- a/gen/todt.cpp Thu Mar 26 18:46:21 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -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 -r 40caa8207b3e -r 1860414bf3b7 gen/toir.cpp --- a/gen/toir.cpp Thu Mar 26 18:46:21 2009 +0100 +++ b/gen/toir.cpp Thu Mar 26 20:45:53 2009 +0100 @@ -2618,164 +2618,7 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 gen/toobj.cpp --- a/gen/toobj.cpp Thu Mar 26 18:46:21 2009 +0100 +++ b/gen/toobj.cpp Thu Mar 26 20:45:53 2009 +0100 @@ -827,16 +827,6 @@ 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 -r 40caa8207b3e -r 1860414bf3b7 gen/typinf.cpp --- a/gen/typinf.cpp Thu Mar 26 18:46:21 2009 +0100 +++ b/gen/typinf.cpp Thu Mar 26 20:45:53 2009 +0100 @@ -352,11 +352,6 @@ /* ========================================================================= */ -void TypeInfoDeclaration::toDt(dt_t **pdt) -{ - assert(0 && "TypeInfoDeclaration::toDt"); -} - void TypeInfoDeclaration::llvmDeclare() { assert(0 && "TypeInfoDeclaration::llvmDeclare"); @@ -438,11 +433,6 @@ isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoTypedefDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoEnumDeclaration::llvmDeclare() @@ -516,11 +506,6 @@ 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 @@ LLVM_D_Define_TypeInfoBase(tc->next, this, Type::typeinfopointer); } -void TypeInfoPointerDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoArrayDeclaration::llvmDeclare() @@ -611,16 +591,11 @@ 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::llvmDefine() { - Logger::println("TypeInfoStaticArrayDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoStaticArrayDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; // init typeinfo class @@ -671,16 +646,11 @@ 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::llvmDefine() { - Logger::println("TypeInfoAssociativeArrayDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoAssociativeArrayDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; // init typeinfo class @@ -730,16 +700,11 @@ 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::llvmDefine() { - Logger::println("TypeInfoFunctionDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoFunctionDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; assert(tinfo->ty == Tfunction); @@ -759,16 +724,11 @@ 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::llvmDefine() { - Logger::println("TypeInfoDelegateDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoDelegateDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; assert(tinfo->ty == Tdelegate); @@ -788,11 +748,6 @@ 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 @@ isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoStructDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoClassDeclaration::llvmDeclare() @@ -1063,11 +1013,6 @@ isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoClassDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoInterfaceDeclaration::llvmDeclare() @@ -1121,11 +1066,6 @@ isaGlobalVar(ir.irGlobal->value)->setInitializer(tiInit); } -void TypeInfoInterfaceDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - /* ========================================================================= */ void TypeInfoTupleDeclaration::llvmDeclare() @@ -1208,18 +1148,13 @@ 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::llvmDefine() { - Logger::println("TypeInfoConstDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoConstDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; Type *tm = tinfo->mutableOf(); @@ -1236,18 +1171,11 @@ 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::llvmDefine() { - Logger::println("TypeInfoInvariantDeclaration::toDt() %s", toChars()); + Logger::println("TypeInfoInvariantDeclaration::llvmDefine() %s", toChars()); LOG_SCOPE; Type *tm = tinfo->mutableOf(); @@ -1264,9 +1192,4 @@ LLVM_D_Define_TypeInfoBase(tm, this, Type::typeinfoinvariant); } -void TypeInfoInvariantDeclaration::toDt(dt_t **pdt) -{ - assert(0); -} - #endif diff -r 40caa8207b3e -r 1860414bf3b7 ir/irdsymbol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ir/irdsymbol.cpp Thu Mar 26 20:45:53 2009 +0100 @@ -0,0 +1,70 @@ +#include "gen/llvm.h" +#include "ir/ir.h" +#include "ir/irdsymbol.h" +#include "ir/irvar.h" + +#include "gen/logger.h" + +std::set IrDsymbol::list; + +void IrDsymbol::resetAll() +{ + Logger::println("resetting %u Dsymbols", list.size()); + std::set::iterator it; + for(it = list.begin(); it != list.end(); ++it) + (*it)->reset(); +} + +IrDsymbol::IrDsymbol() +{ + bool incr = list.insert(this).second; + assert(incr); + reset(); +} + +IrDsymbol::IrDsymbol(const IrDsymbol& s) +{ + bool incr = list.insert(this).second; + assert(incr); + DModule = s.DModule; + irModule = s.irModule; + irStruct = s.irStruct; + irFunc = s.irFunc; + resolved = s.resolved; + declared = s.declared; + initialized = s.initialized; + defined = s.defined; + irGlobal = s.irGlobal; + irLocal = s.irLocal; + irField = s.irField; +} + +IrDsymbol::~IrDsymbol() +{ + list.erase(this); +} + +void IrDsymbol::reset() +{ + DModule = NULL; + irModule = NULL; + irStruct = NULL; + irFunc = NULL; + resolved = declared = initialized = defined = false; + irGlobal = NULL; + irLocal = NULL; + irField = NULL; +} + +bool IrDsymbol::isSet() +{ + return (irStruct || irFunc || irGlobal || irLocal || irField); +} + +IrVar* IrDsymbol::getIrVar() +{ + assert(irGlobal || irLocal || irField); + return irGlobal ? (IrVar*)irGlobal : irLocal ? (IrVar*)irLocal : (IrVar*)irField; +} + +llvm::Value*& IrDsymbol::getIrValue() { return getIrVar()->value; } diff -r 40caa8207b3e -r 1860414bf3b7 ir/irdsymbol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ir/irdsymbol.h Thu Mar 26 20:45:53 2009 +0100 @@ -0,0 +1,54 @@ +#ifndef LDC_IR_IRDSYMBOL_H +#define LDC_IR_IRDSYMBOL_H + +#include + +struct IrModule; +struct IrFunction; +struct IrStruct; +struct IrGlobal; +struct IrLocal; +struct IrField; +struct IrVar; +struct Dsymbol; + +namespace llvm { + struct Value; +} + +struct IrDsymbol +{ + static std::set list; + static void resetAll(); + + // overload all of these to make sure + // the static list is up to date + IrDsymbol(); + IrDsymbol(const IrDsymbol& s); + ~IrDsymbol(); + + void reset(); + + Module* DModule; + + bool resolved; + bool declared; + bool initialized; + bool defined; + + IrModule* irModule; + + IrStruct* irStruct; + + IrFunction* irFunc; + + IrGlobal* irGlobal; + IrLocal* irLocal; + IrField* irField; + IrVar* getIrVar(); + llvm::Value*& getIrValue(); + + bool isSet(); +}; + +#endif diff -r 40caa8207b3e -r 1860414bf3b7 ir/irsymbol.cpp --- a/ir/irsymbol.cpp Thu Mar 26 18:46:21 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -#include "gen/llvm.h" -#include "ir/ir.h" -#include "ir/irsymbol.h" -#include "ir/irvar.h" - -#include "gen/logger.h" - -std::set IrDsymbol::list; - -void IrDsymbol::resetAll() -{ - Logger::println("resetting %u Dsymbols", list.size()); - std::set::iterator it; - for(it = list.begin(); it != list.end(); ++it) - (*it)->reset(); -} - -IrDsymbol::IrDsymbol() -{ - bool incr = list.insert(this).second; - assert(incr); - reset(); -} - -IrDsymbol::IrDsymbol(const IrDsymbol& s) -{ - bool incr = list.insert(this).second; - assert(incr); - DModule = s.DModule; - irModule = s.irModule; - irStruct = s.irStruct; - irFunc = s.irFunc; - resolved = s.resolved; - declared = s.declared; - initialized = s.initialized; - defined = s.defined; - irGlobal = s.irGlobal; - irLocal = s.irLocal; - irField = s.irField; -} - -IrDsymbol::~IrDsymbol() -{ - list.erase(this); -} - -void IrDsymbol::reset() -{ - DModule = NULL; - irModule = NULL; - irStruct = NULL; - irFunc = NULL; - resolved = declared = initialized = defined = false; - irGlobal = NULL; - irLocal = NULL; - irField = NULL; -} - -bool IrDsymbol::isSet() -{ - return (irStruct || irFunc || irGlobal || irLocal || irField); -} - -IrVar* IrDsymbol::getIrVar() -{ - assert(irGlobal || irLocal || irField); - return irGlobal ? (IrVar*)irGlobal : irLocal ? (IrVar*)irLocal : (IrVar*)irField; -} - -llvm::Value*& IrDsymbol::getIrValue() { return getIrVar()->value; } diff -r 40caa8207b3e -r 1860414bf3b7 ir/irsymbol.h --- a/ir/irsymbol.h Thu Mar 26 18:46:21 2009 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -#ifndef LDC_IR_IRSYMBOL_H -#define LDC_IR_IRSYMBOL_H - -#include - -struct IrModule; -struct IrFunction; -struct IrStruct; -struct IrGlobal; -struct IrLocal; -struct IrField; -struct IrVar; -struct Dsymbol; - -namespace llvm { - struct Value; -} - -struct IrDsymbol -{ - static std::set list; - static void resetAll(); - - // overload all of these to make sure - // the static list is up to date - IrDsymbol(); - IrDsymbol(const IrDsymbol& s); - ~IrDsymbol(); - - void reset(); - - Module* DModule; - - bool resolved; - bool declared; - bool initialized; - bool defined; - - IrModule* irModule; - - IrStruct* irStruct; - - IrFunction* irFunc; - - IrGlobal* irGlobal; - IrLocal* irLocal; - IrField* irField; - IrVar* getIrVar(); - llvm::Value*& getIrValue(); - - bool isSet(); -}; - -#endif