rspirv/sr/
module.rs

1use crate::{
2    sr::constants::Constant,
3    sr::instructions,
4    sr::ops::{self, Op},
5    sr::storage::*,
6    sr::types::Type,
7};
8
9#[derive(Debug)]
10pub struct EntryPoint {
11    pub execution_model: spirv::ExecutionModel,
12    pub function: Token<Function>,
13    pub name: String,
14    //pub interface: Vec<spirv::Word>,
15}
16
17#[derive(Debug)]
18pub struct Block {
19    pub arguments: Vec<Token<Type>>,
20    pub ops: Vec<Token<Op>>,
21    pub terminator: ops::Terminator,
22}
23
24/// Jump destination parameters.
25#[derive(Clone, Debug, PartialEq, Eq)]
26pub struct Jump {
27    /// The block to jump to.
28    pub block: Token<Block>,
29    /// The argument values corresponding to the block arguments.
30    pub arguments: Vec<Token<Op>>,
31}
32
33pub struct Function {
34    pub control: spirv::FunctionControl,
35    /// Function result type.
36    pub result: Token<Type>,
37    /// Function parameters.
38    pub parameters: Vec<Token<Type>>,
39    /// All blocks in this function.
40    pub blocks: Storage<Block>,
41    /// The first block of this function.
42    pub start_block: Token<Block>,
43}
44
45pub struct Module {
46    /// Version of the specification.
47    pub version: spirv::Word,
48    /// All OpCapability instructions.
49    pub capabilities: Vec<spirv::Capability>,
50    /// All OpExtension instructions.
51    pub extensions: Vec<String>,
52    /// All OpExtInstImport instructions.
53    pub ext_inst_imports: Vec<String>,
54    /// The OpMemoryModel instruction.
55    pub memory_model: instructions::MemoryModel,
56    /// All entry point declarations.
57    pub entry_points: Vec<EntryPoint>,
58
59    /// All types
60    pub types: Storage<Type>,
61    /// All constants.
62    pub constants: Storage<Constant>,
63
64    /// All operations.
65    pub ops: Storage<Op>,
66
67    /// All functions.
68    pub functions: Vec<Function>,
69}