cranelift_codegen_meta/shared/
entities.rs1use crate::cdsl::operands::{OperandKind, OperandKindFields};
2
3fn new(format_field_name: &'static str, rust_type: &'static str, doc: &'static str) -> OperandKind {
5 OperandKind::new(
6 format_field_name,
7 rust_type,
8 OperandKindFields::EntityRef,
9 doc,
10 )
11}
12
13pub(crate) struct EntityRefs {
14 pub(crate) block_call: OperandKind,
17
18 pub(crate) block_then: OperandKind,
21
22 pub(crate) block_else: OperandKind,
25
26 pub(crate) stack_slot: OperandKind,
28
29 pub(crate) dynamic_stack_slot: OperandKind,
31
32 pub(crate) global_value: OperandKind,
34
35 pub(crate) sig_ref: OperandKind,
38
39 pub(crate) func_ref: OperandKind,
42
43 pub(crate) jump_table: OperandKind,
45
46 pub(crate) varargs: OperandKind,
48}
49
50impl EntityRefs {
51 pub fn new() -> Self {
52 Self {
53 block_call: new(
54 "destination",
55 "ir::BlockCall",
56 "a basic block in the same function, with its arguments provided.",
57 ),
58
59 block_then: new(
60 "block_then",
61 "ir::BlockCall",
62 "a basic block in the same function, with its arguments provided.",
63 ),
64
65 block_else: new(
66 "block_else",
67 "ir::BlockCall",
68 "a basic block in the same function, with its arguments provided.",
69 ),
70
71 stack_slot: new("stack_slot", "ir::StackSlot", "A stack slot"),
72
73 dynamic_stack_slot: new(
74 "dynamic_stack_slot",
75 "ir::DynamicStackSlot",
76 "A dynamic stack slot",
77 ),
78
79 global_value: new("global_value", "ir::GlobalValue", "A global value."),
80
81 sig_ref: new("sig_ref", "ir::SigRef", "A function signature."),
82
83 func_ref: new("func_ref", "ir::FuncRef", "An external function."),
84
85 jump_table: new("table", "ir::JumpTable", "A jump table."),
86
87 varargs: OperandKind::new(
88 "",
89 "&[Value]",
90 OperandKindFields::VariableArgs,
91 r#"
92 A variable size list of `value` operands.
93
94 Use this to represent arguments passed to a function call, arguments
95 passed to a basic block, or a variable number of results
96 returned from an instruction.
97 "#,
98 ),
99 }
100 }
101}