1/**
2 * Declarations for back-end functions that the front-end invokes.
3 *
4 * This 'glues' either the DMC or GCC back-end to the front-end.
5 *
6 * Copyright:   Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved
7 * Authors:     $(LINK2 https://www.digitalmars.com, Walter Bright)
8 * License:     $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
9 * Source:      $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/gluelayer.d, _gluelayer.d)
10 * Documentation:  https://dlang.org/phobos/dmd_gluelayer.html
11 * Coverage:    https://codecov.io/gh/dlang/dmd/src/master/src/dmd/gluelayer.d
12 */
13
14module dmd.gluelayer;
15
16import dmd.dmodule;
17import dmd.dscope;
18import dmd.dsymbol;
19import dmd.mtype;
20import dmd.statement;
21import dmd.root.file;
22
23version (NoBackend)
24{
25    struct Symbol;
26    struct code;
27    struct block;
28    struct Blockx;
29    struct elem;
30    struct TYPE;
31    alias type = TYPE;
32
33    extern (C++)
34    {
35        // iasm
36        Statement asmSemantic(AsmStatement s, Scope* sc)
37        {
38            sc.func.hasReturnExp = 8;
39            return null;
40        }
41
42        // toir
43        void toObjFile(Dsymbol ds, bool multiobj)   {}
44
45        extern(C++) abstract class ObjcGlue
46        {
47            static void initialize() {}
48        }
49    }
50}
51else version (MARS)
52{
53    public import dmd.backend.cc : block, Blockx, Symbol;
54    public import dmd.backend.type : type;
55    public import dmd.backend.el : elem;
56    public import dmd.backend.code_x86 : code;
57
58    extern (C++)
59    {
60        Statement asmSemantic(AsmStatement s, Scope* sc);
61
62        void toObjFile(Dsymbol ds, bool multiobj);
63
64        extern(C++) abstract class ObjcGlue
65        {
66            static void initialize();
67        }
68    }
69}
70else version (IN_GCC)
71{
72    extern (C++) union tree_node;
73
74    alias Symbol = tree_node;
75    alias code = tree_node;
76    alias type = tree_node;
77
78    extern (C++)
79    {
80        Statement asmSemantic(AsmStatement s, Scope* sc);
81        void toObjFile(Dsymbol ds, bool multiobj);
82    }
83
84    // stubs
85    extern(C++) abstract class ObjcGlue
86    {
87        static void initialize() {}
88    }
89}
90else
91    static assert(false, "Unsupported compiler backend");
92