MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / operands

Method operands

cranelift/codegen/meta/src/pulley.rs:50–88  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

48
49impl Inst<'_> {
50 fn operands(&self) -> impl Iterator<Item = Operand<'_>> + use<'_> {
51 self.fields
52 .iter()
53 .map(|(name, ty)| match (*name, *ty) {
54 ("operands", binop) => {
55 // Parse "BinaryOperands < A >"` as A/A/A
56 // Parse "BinaryOperands < A, B >"` as A/B/A
57 // Parse "BinaryOperands < A, B, C >"` as A/B/C
58 let mut parts = binop
59 .strip_prefix("BinaryOperands <")
60 .unwrap()
61 .strip_suffix(">")
62 .unwrap()
63 .trim()
64 .split(',')
65 .map(|x| x.trim());
66 let dst = parts.next().unwrap();
67 let src1 = parts.next().unwrap_or(dst);
68 let src2 = parts.next().unwrap_or(dst);
69 Operand::Binop { dst, src1, src2 }
70 }
71 (name, ty) if name.starts_with("dst") => Operand::Writable { name, ty },
72 (name, "UpperRegSet < XReg >") => Operand::Normal {
73 name,
74 ty: "UpperXRegSet",
75 },
76 (name, ty) => Operand::Normal { name, ty },
77 })
78 .chain(
79 if self.name.contains("Trap") || self.fields.iter().any(|(_, ty)| *ty == "AddrZ") {
80 Some(Operand::TrapCode {
81 name: "code",
82 ty: "TrapCode",
83 })
84 } else {
85 None
86 },
87 )
88 }
89
90 fn skip(&self) -> bool {
91 match self.name {

Callers 2

generate_rustFunction · 0.45
generate_isleFunction · 0.45

Calls 8

chainMethod · 0.80
splitMethod · 0.80
anyMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
unwrapMethod · 0.45
nextMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected