summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-insts-enum.h
blob: 061b1c18eeeb925499d629eb7c9dad4b4abfa3c5 (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
#pragma once

#include <cstdint>

namespace Slang
{

/* Bit usage of IROp is as follows

           MainOp | Other
Bit range: 0-10   | Remaining bits

For doing range checks (for example for doing isa tests), the value is masked by kIROpMask_OpMask,
such that the Other bits don't interfere. The other bits can be used for storage for anything that
needs to identify as a different 'op' or 'type'. It is currently used currently for storing the
TextureFlavor of a IRResourceTypeBase derived types for example.

TODO: We should eliminate the use of the "other" bits so that the entire value/state
of an instruction is manifest in its opcode, operands, and children.
*/
enum IROp : int32_t
{

#if 0 // FIDDLE TEMPLATE:
% require("source/slang/slang-ir.h.lua").instEnums()
#else // FIDDLE OUTPUT:
#define FIDDLE_GENERATED_OUTPUT_ID 0
#include "slang-ir-insts-enum.h.fiddle"
#endif // FIDDLE END

    /// The total number of valid opcodes
    kIROpCount,

    /// An invalid opcode used to represent a missing or unknown opcode value.
    kIROp_Invalid = kIROpCount,
};
} // namespace Slang