summaryrefslogtreecommitdiff
path: root/source/slang/lower.h
blob: c690ea025f4617b983b5a024ad7ddf505917bd83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// lower.h
#ifndef SLANG_LOWER_H_INCLUDED
#define SLANG_LOWER_H_INCLUDED

// The "lowering" step takes an input AST written in the complete Slang
// language and turns it into a more minimal format (still using the
// same AST) suitable for emission into lower-level languages.

#include "../core/basic.h"

#include "compiler.h"
#include "syntax.h"

namespace Slang
{
    class EntryPointRequest;
    class ProgramLayout;
    class TranslationUnitRequest;

    struct LoweredEntryPoint
    {
        // The actual lowered entry point
        RefPtr<FunctionSyntaxNode>  entryPoint;

        // The generated program AST that
        // contains the entry point and any
        // other declarations it uses
        RefPtr<ProgramSyntaxNode>   program;
    };

    // Emit code for a single entry point, based on
    // the input translation unit.
    LoweredEntryPoint lowerEntryPoint(
        EntryPointRequest*  entryPoint,
        ProgramLayout*      programLayout,
        CodeGenTarget       target);
}
#endif