Skip to main content

yulang_monomorphize/
output.rs

1use yulang_runtime_ir::{FinalizedModule as Module, RuntimeType};
2
3use crate::{GraphSolution, MonomorphizeInstanceCacheProfile};
4
5#[derive(Debug, Clone, PartialEq, Eq)]
6pub struct MonomorphizeOutput {
7    pub module: Module,
8    pub report: MonomorphizeReport,
9}
10
11#[derive(Debug, Default, Clone, PartialEq, Eq)]
12pub struct MonomorphizeReport {
13    pub root_graph_inputs: Vec<RootGraphInput>,
14    pub root_graph_solutions: Vec<RootGraphSolution>,
15    pub cache_profile: MonomorphizeInstanceCacheProfile,
16}
17
18#[derive(Debug, Clone, PartialEq, Eq)]
19pub struct RootGraphInput {
20    pub root: RootGraphRoot,
21    pub known_type: Option<RuntimeType>,
22}
23
24#[derive(Debug, Clone, PartialEq, Eq)]
25pub enum RootGraphRoot {
26    Expr(usize),
27    Binding(yulang_typed_ir::Path),
28}
29
30#[derive(Debug, Clone, PartialEq, Eq)]
31pub struct RootGraphSolution {
32    pub root: RootGraphRoot,
33    pub occurrence: usize,
34    pub binding: yulang_typed_ir::Path,
35    pub alias: yulang_typed_ir::Path,
36    pub callee_type: RuntimeType,
37    pub result_type: RuntimeType,
38    pub graph: GraphSolution,
39    pub type_substitutions: Vec<yulang_typed_ir::TypeSubstitution>,
40}