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

Method build

cranelift/codegen/meta/src/cdsl/instructions.rs:245–296  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

243 }
244
245 fn build(self) -> Instruction {
246 let operands_in = self.operands_in.unwrap_or_default();
247 let operands_out = self.operands_out.unwrap_or_default();
248
249 let mut value_opnums = Vec::new();
250 let mut imm_opnums = Vec::new();
251 for (i, op) in operands_in.iter().enumerate() {
252 if op.is_value() {
253 value_opnums.push(i);
254 } else if op.is_immediate_or_entityref() {
255 imm_opnums.push(i);
256 } else {
257 assert!(op.is_varargs());
258 }
259 }
260
261 let value_results = operands_out
262 .iter()
263 .enumerate()
264 .filter_map(|(i, op)| if op.is_value() { Some(i) } else { None })
265 .collect();
266
267 verify_format(&self.name, &operands_in, &self.format);
268
269 let polymorphic_info =
270 verify_polymorphic(&operands_in, &operands_out, &self.format, &value_opnums);
271
272 let camel_name = camel_case(&self.name);
273
274 Rc::new(InstructionContent {
275 name: self.name,
276 camel_name,
277 doc: self.doc,
278 operands_in,
279 operands_out,
280 format: self.format,
281 polymorphic_info,
282 value_opnums,
283 value_results,
284 imm_opnums,
285 is_terminator: self.is_terminator,
286 is_branch: self.is_branch,
287 is_call: self.is_call,
288 is_return: self.is_return,
289 can_load: self.can_load,
290 can_store: self.can_store,
291 can_trap: self.can_trap,
292 other_side_effects: self.other_side_effects,
293 side_effects_idempotent: self.side_effects_idempotent,
294 inst_builder_imm_method: self.inst_builder_imm_method,
295 })
296 }
297}
298
299/// Checks that the input operands actually match the given format.

Callers 1

pushMethod · 0.45

Calls 9

verify_formatFunction · 0.85
verify_polymorphicFunction · 0.85
camel_caseFunction · 0.85
is_valueMethod · 0.80
collectMethod · 0.80
newFunction · 0.50
iterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected