diff dmd/declaration.h @ 1147:dbe4af57b240

Changed use of toObjFile to a new codegen method. More versioning of DMD specific codegen code.
author Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
date Fri, 27 Mar 2009 17:54:27 +0100
parents 1860414bf3b7
children 3d1b16dabd25
line wrap: on
line diff
--- a/dmd/declaration.h	Thu Mar 26 20:45:53 2009 +0100
+++ b/dmd/declaration.h	Fri Mar 27 17:54:27 2009 +0100
@@ -138,8 +138,10 @@
 
     Declaration *isDeclaration() { return this; }
 
-    // llvm
-    virtual void toObjFile(int unused = 0);           // compile to .obj file
+#if IN_LLVM
+    /// Codegen traversal
+    virtual void codegen(Ir* ir);
+#endif
 };
 
 /**************************************************************/
@@ -159,8 +161,10 @@
 
     TupleDeclaration *isTupleDeclaration() { return this; }
 
-    // LDC we need this
-    void toObjFile(int multiobj);           // compile to .obj file
+#if IN_LLVM
+    /// Codegen traversal
+    void codegen(Ir* ir);
+#endif
 };
 
 /**************************************************************/
@@ -190,8 +194,8 @@
 
     void toDocBuffer(OutBuffer *buf);
 
+#if IN_DMD
     void toObjFile(int multiobj);			// compile to .obj file
-#if IN_DMD
     void toDebug();
     int cvMember(unsigned char *p);
 #endif
@@ -202,6 +206,11 @@
     Symbol *sinit;
     Symbol *toInitializer();
 #endif
+
+#if IN_LLVM
+    /// Codegen traversal
+    void codegen(Ir* ir);
+#endif
 };
 
 /**************************************************************/
@@ -268,8 +277,8 @@
     void checkNestedReference(Scope *sc, Loc loc);
     Dsymbol *toAlias();
 
+#if IN_DMD
     void toObjFile(int multiobj);			// compile to .obj file
-#if IN_DMD
     Symbol *toSymbol();
     int cvMember(unsigned char *p);
 #endif
@@ -278,6 +287,9 @@
     VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; }
 
 #if IN_LLVM
+    /// Codegen traversal
+    void codegen(Ir* ir);
+
     // LDC
     AnonDeclaration* anonDecl;
     unsigned offset2;
@@ -345,8 +357,8 @@
 
     void emitComment(Scope *sc);
 
+#if IN_DMD
     void toObjFile(int multiobj);			// compile to .obj file
-#if IN_DMD
     Symbol *toSymbol();
     virtual void toDt(dt_t **pdt);
 #endif
@@ -354,7 +366,8 @@
     virtual TypeInfoDeclaration* isTypeInfoDeclaration() { return this; }
 
 #if IN_LLVM
-    // LDC
+    /// Codegen traversal
+    void codegen(Ir* ir);
     virtual void llvmDeclare();
     virtual void llvmDefine();
 #endif
@@ -369,7 +382,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -384,7 +396,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -399,7 +410,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -414,7 +424,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -429,7 +438,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -444,7 +452,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -459,7 +466,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -474,7 +480,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -489,7 +494,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -504,7 +508,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -519,7 +522,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -534,7 +536,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -550,7 +551,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -565,7 +565,6 @@
 #endif
 
 #if IN_LLVM
-    // LDC
     void llvmDeclare();
     void llvmDefine();
 #endif
@@ -716,9 +715,7 @@
 #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
 
@@ -727,6 +724,9 @@
 #if IN_LLVM
     // LDC stuff
 
+    /// Codegen traversal
+    void codegen(Ir* ir);
+
     // vars declared in this function that nested funcs reference
     // is this is not empty, nestedFrameRef is set and these VarDecls
     // probably have nestedref set too, see VarDeclaration::checkNestedReference