1 /**
2  * Compiler implementation of the
3  * $(LINK2 http://www.dlang.org, D programming language).
4  *
5  * Copyright:   Copyright (c) 1999-2016 by Digital Mars, All Rights Reserved
6  * Authors:     $(LINK2 http://www.digitalmars.com, Walter Bright)
7  * License:     $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source:      $(DMDSRC _gluelayer.d)
9  */
10 
11 module ddmd.gluelayer;
12 
13 import ddmd.dmodule;
14 import ddmd.dscope;
15 import ddmd.dsymbol;
16 import ddmd.lib;
17 import ddmd.mtype;
18 import ddmd.statement;
19 import ddmd.root.file;
20 
21 version (NoBackend)
22 {
23     struct Symbol;
24     struct code;
25     struct block;
26     struct Blockx;
27     struct elem;
28     struct TYPE;
29     alias type = TYPE;
30 
31     extern (C++)
32     {
33         // glue
34         void obj_write_deferred(Library library)        {}
35         void obj_start(char* srcfile)                   {}
36         void obj_end(Library library, File* objfile)    {}
37         void genObjFile(Module m, bool multiobj)        {}
38 
39         // msc
40         void backend_init() {}
41         void backend_term() {}
42 
43         // iasm
44         Statement asmSemantic(AsmStatement s, Scope* sc) { assert(0); }
45 
46         // toir
47         RET retStyle(TypeFunction tf)               { return RETregs; }
48         void toObjFile(Dsymbol ds, bool multiobj)   {}
49 
50         version (OSX)
51         {
52             void objc_initSymbols() {}
53         }
54     }
55 }
56 else
57 {
58     public import ddmd.backend.cc : block, Blockx, Symbol;
59     public import ddmd.backend.type : type;
60     public import ddmd.backend.el : elem;
61 
62     public alias code = ddmd.backend.type.code;
63 
64     extern (C++)
65     {
66         void obj_write_deferred(Library library);
67         void obj_start(char* srcfile);
68         void obj_end(Library library, File* objfile);
69         void genObjFile(Module m, bool multiobj);
70 
71         void backend_init();
72         void backend_term();
73 
74         Statement asmSemantic(AsmStatement s, Scope* sc);
75 
76         RET retStyle(TypeFunction tf);
77         void toObjFile(Dsymbol ds, bool multiobj);
78 
79         version (OSX)
80         {
81             void objc_initSymbols();
82         }
83     }
84 }