MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / build

Method build

crates/rustc_codegen_spirv/src/builder/builder_methods.rs:637–656  ·  view source on GitHub ↗
(cx: &'a Self::CodegenCx, llbb: Self::BasicBlock)

Source from the content-addressed store, hash-verified

635
636impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
637 fn build(cx: &'a Self::CodegenCx, llbb: Self::BasicBlock) -> Self {
638 let cursor = cx.builder.select_block_by_id(llbb);
639 // FIXME(eddyb) change `Self::Function` to be more like a function index.
640 let current_fn = {
641 let emit = cx.emit_with_cursor(cursor);
642 let selected_function = emit.selected_function().unwrap();
643 let selected_function = &emit.module_ref().functions[selected_function];
644 let def_inst = selected_function.def.as_ref().unwrap();
645 let def = def_inst.result_id.unwrap();
646 let ty = def_inst.operands[1].unwrap_id_ref();
647 def.with_type(ty)
648 };
649 Self {
650 cx,
651 cursor,
652 current_fn,
653 basic_block: llbb,
654 current_span: Default::default(),
655 }
656 }
657
658 fn cx(&self) -> &Self::CodegenCx {
659 self.cx

Callers

nothing calls this directly

Calls 4

select_block_by_idMethod · 0.80
emit_with_cursorMethod · 0.80
with_typeMethod · 0.80
as_refMethod · 0.45

Tested by

no test coverage detected