summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-lower-cuda-builtin-types.h
blob: c7a3280ae68aaad426d3aed3a600896596ae64d0 (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
#ifndef SLANG_IR_LOWER_BUILTIN_TYPES_H
#define SLANG_IR_LOWER_BUILTIN_TYPES_H

#include "slang-ir-clone.h"
#include "slang-ir-insts.h"
#include "slang-ir-layout.h"
#include "slang-ir-util.h"
#include "slang-ir.h"

namespace Slang
{
struct LoweredBuiltinTypeInfo
{
    IRType* originalType;
    IRType* loweredType;
    IRType* loweredInnerArrayType =
        nullptr; // For matrix/array types that are lowered into a struct type, this is the inner
                 // array type of the data field.
    IRStructKey* loweredInnerStructKey =
        nullptr; // For matrix/array types that are lowered into a struct type, this is the struct
                 // key of the data field.
    IRFunc* convertOriginalToLowered = nullptr;
    IRFunc* convertLoweredToOriginal = nullptr;
};

struct BuiltinTypeLoweringEnv
{
    Dictionary<IRType*, LoweredBuiltinTypeInfo> loweredTypes;
};

LoweredBuiltinTypeInfo lowerMatrixType(
    IRBuilder* builder,
    IRMatrixType* matrixType,
    String nameSuffix = "");

LoweredBuiltinTypeInfo lowerVectorType(
    IRBuilder* builder,
    IRVectorType* vectorType,
    String nameSuffix = "");

LoweredBuiltinTypeInfo lowerStructType(
    BuiltinTypeLoweringEnv* env,
    IRBuilder* builder,
    IRStructType* structType,
    String nameSuffix = "");

LoweredBuiltinTypeInfo lowerType(
    BuiltinTypeLoweringEnv* env,
    IRBuilder* builder,
    IRType* type,
    String nameSuffix = "");

} // namespace Slang

#endif // SLANG_IR_LOWER_BUILTIN_TYPES_H