summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-entry-point-pass.h
blob: 98650cc734444020a50ff003a1b6052bec97fa07 (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
// ir-entry-point-pass.h
#pragma once

#include "slang-ir-insts.h"
#include "slang-ir.h"

namespace Slang
{

struct PerEntryPointPass
{
public:
    // We will process a whole module by visiting all
    // its global functions, looking for entry points.
    //
    void processModule(IRModule* module);

    struct EntryPointInfo
    {
        IRFunc* func = nullptr;
        IREntryPointDecoration* decoration = nullptr;
    };

protected:
    void processEntryPoint(IRFunc* entryPointFunc, IREntryPointDecoration* entryPointDecoration);

    virtual void processEntryPointImpl(EntryPointInfo const& info) = 0;

    // We'll hang on to the module we are processing,
    // so that we can refer to it when setting up `IRBuilder`s.
    //
    IRModule* m_module = nullptr;

    EntryPointInfo m_entryPoint;
};

} // namespace Slang