summaryrefslogtreecommitdiff
path: root/source/slang/lower.h
blob: 919260af3ffb810217d702d7c95dae1673be8677 (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
39
40
41
// 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 ExtensionUsageTracker;

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

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

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