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) exception_table: OperandKind,
48
49 pub(crate) varargs: OperandKind,
51}
52
53impl EntityRefs {
54 pub fn new() -> Self {
55 Self {
56 block_call: new(
57 "destination",
58 "ir::BlockCall",
59 "a basic block in the same function, with its arguments provided.",
60 ),
61
62 block_then: new(
63 "block_then",
64 "ir::BlockCall",
65 "a basic block in the same function, with its arguments provided.",
66 ),
67
68 block_else: new(
69 "block_else",
70 "ir::BlockCall",
71 "a basic block in the same function, with its arguments provided.",
72 ),
73
74 stack_slot: new("stack_slot", "ir::StackSlot", "A stack slot"),
75
76 dynamic_stack_slot: new(
77 "dynamic_stack_slot",
78 "ir::DynamicStackSlot",
79 "A dynamic stack slot",
80 ),
81
82 global_value: new("global_value", "ir::GlobalValue", "A global value."),
83
84 sig_ref: new("sig_ref", "ir::SigRef", "A function signature."),
85
86 func_ref: new("func_ref", "ir::FuncRef", "An external function."),
87
88 jump_table: new("table", "ir::JumpTable", "A jump table."),
89
90 exception_table: new("exception", "ir::ExceptionTable", "An exception table."),
91
92 varargs: OperandKind::new(
93 "",
94 "&[Value]",
95 OperandKindFields::VariableArgs,
96 r#"
97 A variable size list of `value` operands.
98
99 Use this to represent arguments passed to a function call, arguments
100 passed to a basic block, or a variable number of results
101 returned from an instruction.
102 "#,
103 ),
104 }
105 }
106}