blob: d830a43f3ad4c2d981f68946696ddc707a8c7c05 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// slang-lower-to-ir.h
#ifndef SLANG_LOWER_TO_IR_H_INCLUDED
#define SLANG_LOWER_TO_IR_H_INCLUDED
// The lowering step translates from a (type-checked) AST into
// our intermediate representation, to facilitate further
// optimization and transformation.
#include "../core/slang-basic.h"
#include "slang-compiler.h"
#include "slang-ir.h"
namespace Slang
{
class EntryPoint;
class ProgramLayout;
class SpecializedComponentType;
class TranslationUnitRequest;
/// Generate an IR module to represent the code in the given `translationUnit`.
///
/// The generated module will include IR definitions for any functions/types
/// in `translationUnit`, but it is *not* guaranteed to contain any definitions
/// from modules that are `import`ed into `translationUnit`. The resulting IR
/// module must be linked against other IR modules that define any symbols
/// that are imported before code generation can be performed.
///
RefPtr<IRModule> generateIRForTranslationUnit(
ASTBuilder* astBuilder,
TranslationUnitRequest* translationUnit);
/// Generate an IR module to represent the specializations applied by `componentType`.
///
/// The generated IR will encode how `componentType` specializes global or
/// entry-point specialization parameters to concrete arguments (e.g., types).
///
/// The generated IR module is *not* guaranteed to contain anything more, such
/// as the actual definitions of functions or types being specialized. The
/// resulting IR module must be linked against other IR modules that define
/// those symbols before code generation can be performed.
///
RefPtr<IRModule> generateIRForSpecializedComponentType(
SpecializedComponentType* componentType,
DiagnosticSink* sink);
/// Generate an IR module to represent a user specified `TypeConformance` component type.
/// The generated IR will include an extern symbol representing the type conformance
/// (typically a `IRWitnessTable` or a `specialize(IRWitnessTable)` inst), with a `public`
/// decoration to keep the referenced witness table alive during linking.
RefPtr<IRModule> generateIRForTypeConformance(
TypeConformance* typeConformance,
Int conformanceIdOverride,
DiagnosticSink* sink);
} // namespace Slang
#endif
|