Lines Matching refs:dfg

24 fn replace_single_result_with_alias(dfg: &mut DataFlowGraph, inst: Inst, value: Value) {  in replace_single_result_with_alias()
26 let results = dfg.detach_results(inst); in replace_single_result_with_alias()
27 debug_assert!(results.len(&dfg.value_lists) == 1); in replace_single_result_with_alias()
28 let result = results.get(0, &dfg.value_lists).unwrap(); in replace_single_result_with_alias()
29 dfg.change_to_alias(result, value); in replace_single_result_with_alias()
32 dfg.replace(inst).nop(); in replace_single_result_with_alias()
144 fn get_div_info(inst: Inst, dfg: &DataFlowGraph) -> Option<DivRemByConstInfo> { in get_div_info()
145 if let InstructionData::BinaryImm64 { opcode, arg, imm } = dfg[inst] { in get_div_info()
153 return package_up_divrem_info(arg, dfg.value_type(arg), imm.into(), is_signed, is_rem); in get_div_info()
186 pos.func.dfg.replace(inst).iconst(I32, 0); in do_divrem_transformation()
188 replace_single_result_with_alias(&mut pos.func.dfg, inst, n1); in do_divrem_transformation()
202 pos.func.dfg.replace(inst).band_imm(n1, mask as i64); in do_divrem_transformation()
204 pos.func.dfg.replace(inst).ushr_imm(n1, k as i64); in do_divrem_transformation()
241 pos.func.dfg.replace(inst).isub(n1, tt); in do_divrem_transformation()
243 replace_single_result_with_alias(&mut pos.func.dfg, inst, qf); in do_divrem_transformation()
256 pos.func.dfg.replace(inst).iconst(I64, 0); in do_divrem_transformation()
258 replace_single_result_with_alias(&mut pos.func.dfg, inst, n1); in do_divrem_transformation()
272 pos.func.dfg.replace(inst).band_imm(n1, mask as i64); in do_divrem_transformation()
274 pos.func.dfg.replace(inst).ushr_imm(n1, k as i64); in do_divrem_transformation()
311 pos.func.dfg.replace(inst).isub(n1, tt); in do_divrem_transformation()
313 replace_single_result_with_alias(&mut pos.func.dfg, inst, qf); in do_divrem_transformation()
329 pos.func.dfg.replace(inst).iconst(I32, 0); in do_divrem_transformation()
331 replace_single_result_with_alias(&mut pos.func.dfg, inst, n1); in do_divrem_transformation()
350 pos.func.dfg.replace(inst).isub(n1, t4); in do_divrem_transformation()
355 pos.func.dfg.replace(inst).irsub_imm(t4, 0); in do_divrem_transformation()
357 replace_single_result_with_alias(&mut pos.func.dfg, inst, t4); in do_divrem_transformation()
385 pos.func.dfg.replace(inst).isub(n1, tt); in do_divrem_transformation()
387 replace_single_result_with_alias(&mut pos.func.dfg, inst, qf); in do_divrem_transformation()
404 pos.func.dfg.replace(inst).iconst(I64, 0); in do_divrem_transformation()
406 replace_single_result_with_alias(&mut pos.func.dfg, inst, n1); in do_divrem_transformation()
425 pos.func.dfg.replace(inst).isub(n1, t4); in do_divrem_transformation()
430 pos.func.dfg.replace(inst).irsub_imm(t4, 0); in do_divrem_transformation()
432 replace_single_result_with_alias(&mut pos.func.dfg, inst, t4); in do_divrem_transformation()
460 pos.func.dfg.replace(inst).isub(n1, tt); in do_divrem_transformation()
462 replace_single_result_with_alias(&mut pos.func.dfg, inst, qf); in do_divrem_transformation()
482 match pos.func.dfg[inst] { in branch_order()
504 let prev_inst_data = &pos.func.dfg[prev_inst]; in branch_order()
521 let args = pos.func.dfg.inst_args(prev_inst); in branch_order()
548 let args = pos.func.dfg.inst_args(prev_inst); in branch_order()
569 let cond_args = cond_inst_args.as_slice(&pos.func.dfg.value_lists).to_vec(); in branch_order()
570 let term_args = term_inst_args.as_slice(&pos.func.dfg.value_lists).to_vec(); in branch_order()
575 .dfg in branch_order()
579 .dfg in branch_order()
585 .dfg in branch_order()
589 .dfg in branch_order()
595 .dfg in branch_order()
598 pos.func.dfg.replace(cond_inst).br_icmp( in branch_order()
656 dfg::ValueDef,
684 fn resolve_imm64_value(dfg: &DataFlowGraph, value: Value) -> Option<immediates::Imm64> { in resolve_imm64_value()
685 if let ValueDef::Result(candidate_inst, _) = dfg.value_def(value) { in resolve_imm64_value()
689 } = dfg[candidate_inst] in resolve_imm64_value()
706 if let ValueDef::Result(arg_inst, _) = pos.func.dfg.value_def(arg) { in try_fold_extended_move()
711 } = &pos.func.dfg[arg_inst] in try_fold_extended_move()
717 let dest_ty = pos.func.dfg.ctrl_typevar(inst); in try_fold_extended_move()
718 if dest_ty != pos.func.dfg.ctrl_typevar(arg_inst) || !dest_ty.is_int() { in try_fold_extended_move()
737 pos.func.dfg.replace(inst).uextend(dest_ty, narrower_arg); in try_fold_extended_move()
739 pos.func.dfg.replace(inst).sextend(dest_ty, narrower_arg); in try_fold_extended_move()
757 match pos.func.dfg[inst] { in simplify()
759 if let Some(mut imm) = resolve_imm64_value(&pos.func.dfg, args[1]) { in simplify()
782 let ty = pos.func.dfg.ctrl_typevar(inst); in simplify()
785 .dfg in simplify()
792 } else if let Some(imm) = resolve_imm64_value(&pos.func.dfg, args[0]) { in simplify()
802 let ty = pos.func.dfg.ctrl_typevar(inst); in simplify()
805 .dfg in simplify()
814 if let Some(imm) = resolve_imm64_value(&pos.func.dfg, arg) { in simplify()
816 pos.func.dfg.replace(inst).adjust_sp_down_imm(imm); in simplify()
822 let ty = pos.func.dfg.ctrl_typevar(inst); in simplify()
833 if let ValueDef::Result(arg_inst, _) = pos.func.dfg.value_def(arg) { in simplify()
838 } = &pos.func.dfg[arg_inst] in simplify()
841 && ty == pos.func.dfg.ctrl_typevar(arg_inst) in simplify()
856 .dfg in simplify()
867 if pos.func.dfg.ctrl_typevar(inst).bytes() <= native_word_width in simplify()
892 replace_single_result_with_alias(&mut pos.func.dfg, inst, arg); in simplify()
896 pos.func.dfg.replace(inst).iconst(ty, 0); in simplify()
900 pos.func.dfg.replace(inst).iconst(ty, -1); in simplify()
908 if let Some(imm) = resolve_imm64_value(&pos.func.dfg, args[1]) { in simplify()
909 if pos.func.dfg.ctrl_typevar(inst).bytes() <= native_word_width { in simplify()
910 pos.func.dfg.replace(inst).icmp_imm(cond, args[0], imm); in simplify()
923 let args = pos.func.dfg.inst_args(inst); in simplify()
924 pos.func.dfg.value_def(args[0]) in simplify()
930 } = pos.func.dfg[def_inst] in simplify()
932 let args = pos.func.dfg.inst_args_mut(inst); in simplify()
942 let old_cond_type = pos.func.dfg.value_type(args[0]); in simplify()
950 if let ValueDef::Result(def_inst, _) = pos.func.dfg.value_def(args[0]) { in simplify()
951 let (cond_val, cond_type) = match pos.func.dfg[def_inst] { in simplify()
959 let arg_type = pos.func.dfg.value_type(arg); in simplify()
972 let const_data = pos.func.dfg.constants.get(constant_handle); in simplify()
984 let old_arg_type = pos.func.dfg.value_type(args[1]); in simplify()
991 pos.func.dfg.replace(inst).raw_bitcast(old_arg_type, ret); in simplify()
994 .dfg in simplify()
1022 } = pos.func.dfg[inst] in branch_opt()
1025 let args = pos.func.dfg.inst_args(inst); in branch_opt()
1030 if let ValueDef::Result(icmp_inst, _) = pos.func.dfg.value_def(first_arg) { in branch_opt()
1041 } = pos.func.dfg[icmp_inst] in branch_opt()
1075 info.args.as_mut_slice(&mut pos.func.dfg.value_lists)[0] = info.cmp_arg; in branch_opt()
1076 if let InstructionData::Branch { ref mut opcode, .. } = pos.func.dfg[info.br_inst] { in branch_opt()
1097 if let Some(divrem_info) = get_div_info(inst, &pos.func.dfg) { in do_preopt()