MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / convert_basic_block

Function convert_basic_block

src/lower1/control_flow.rs:65–924  ·  view source on GitHub ↗

Convert a single MIR basic block into an OOMIR basic block.

(
    bb: BasicBlock,
    bb_data: &BasicBlockData<'tcx>,
    tcx: TyCtxt<'tcx>,
    instance: Instance<'tcx>,
    mir: &Body<'tcx>,
    return_oomir_type: &oomir::Type, // Pass function return type
 

Source from the content-addressed store, hash-verified

63 data_types: &mut HashMap<String, oomir::DataType>,
64 instructions: &mut Vec<oomir::Instruction>,
65 temp_prefix: &str,
66) -> oomir::Operand {
67 let location_ty = tcx.caller_location_ty();
68 let location_oomir_ty = super::types::ty_to_oomir_type(location_ty, tcx, data_types, instance);
69 let inherited_location =
70 instance
71 .def
72 .requires_caller_location(tcx)
73 .then(|| oomir::Operand::Variable {
74 name: oomir::CALLER_LOCATION_PARAM_NAME.to_string(),
75 ty: location_oomir_ty,
76 });
77
78 mir.caller_location_span(source_info, inherited_location, tcx, |span| {
79 let raw_location = super::operand::handle_const_value(
80 None,
81 tcx.span_as_caller_location(span),
82 &location_ty,
83 tcx,
84 data_types,
85 instance,
86 );
87 super::value_repr::adapt_operand_to_rust_type(
88 raw_location,
89 location_ty,
90 temp_prefix,
91 tcx,
92 instance,
93 data_types,
94 instructions,
95 )
96 })
97}
98
99fn emit_panic_lang_item<'tcx>(
100 lang_item: LangItem,
101 mut args: Vec<oomir::Operand>,
102 source_info: SourceInfo,
103 tcx: TyCtxt<'tcx>,
104 instance: Instance<'tcx>,
105 mir: &Body<'tcx>,
106 data_types: &mut HashMap<String, oomir::DataType>,
107 instructions: &mut Vec<oomir::Instruction>,
108 temp_prefix: &str,
109) {
110 let panic_def = tcx.require_lang_item(lang_item, source_info.span);
111 let panic_instance = Instance::mono(tcx, panic_def);
112 args.push(caller_location_operand(
113 source_info,
114 tcx,
115 instance,
116 mir,
117 data_types,
118 instructions,
119 temp_prefix,
120 ));
121 let target = super::naming::mono_fn_name_from_instance(tcx, panic_instance);
122 let params = args

Callers 1

mir_to_oomirFunction · 0.85

Calls 15

infer_string_valueFunction · 0.85
ConstantEnum · 0.85
convert_operandFunction · 0.85
mir_int_to_oomir_constFunction · 0.85
ty_to_oomir_typeFunction · 0.85
make_jvm_safeFunction · 0.85
fn_ptr_signature_from_tyFunction · 0.85

Tested by

no test coverage detected