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(format_field_name, rust_type, OperandKindFields::EntityRef).with_doc(doc)
6}
7
8pub(crate) struct EntityRefs {
9 pub(crate) ebb: OperandKind,
12
13 pub(crate) stack_slot: OperandKind,
15
16 pub(crate) global_value: OperandKind,
18
19 pub(crate) sig_ref: OperandKind,
22
23 pub(crate) func_ref: OperandKind,
26
27 pub(crate) jump_table: OperandKind,
29
30 pub(crate) heap: OperandKind,
32
33 pub(crate) table: OperandKind,
35
36 pub(crate) varargs: OperandKind,
38}
39
40impl EntityRefs {
41 pub fn new() -> Self {
42 Self {
43 ebb: new(
44 "destination",
45 "ir::Ebb",
46 "An extended basic block in the same function.",
47 ),
48 stack_slot: new("stack_slot", "ir::StackSlot", "A stack slot"),
49
50 global_value: new("global_value", "ir::GlobalValue", "A global value."),
51
52 sig_ref: new("sig_ref", "ir::SigRef", "A function signature."),
53
54 func_ref: new("func_ref", "ir::FuncRef", "An external function."),
55
56 jump_table: new("table", "ir::JumpTable", "A jump table."),
57
58 heap: new("heap", "ir::Heap", "A heap."),
59
60 table: new("table", "ir::Table", "A table."),
61
62 varargs: OperandKind::new("", "&[Value]", OperandKindFields::VariableArgs).with_doc(
63 r#"
64 A variable size list of `value` operands.
65
66 Use this to represent arguments passed to a function call, arguments
67 passed to an extended basic block, or a variable number of results
68 returned from an instruction.
69 "#,
70 ),
71 }
72 }
73}