diff dmd/mtype.h @ 1146:1860414bf3b7

* 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.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Thu, 26 Mar 2009 20:45:53 +0100
parents b30fe7e1dbb9
children dbe4af57b240
line wrap: on
line diff
--- 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