5 use rustc_index::vec::IndexVec;
6 use rustc_middle::mir::StatementKind::*;
8 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
9 pub(crate) enum SsaKind {
14 pub(crate) fn analyze(fx: &FunctionCx<'_, '_, impl Module>) -> IndexVec<Local, SsaKind> {
20 let ty = fx.monomorphize(local_decl.ty);
21 if fx.clif_type(ty).is_some() || fx.clif_pair_type(ty).is_some() {
27 .collect::<IndexVec<Local, SsaKind>>();
29 for bb in fx.mir.basic_blocks().iter() {
30 for stmt in bb.statements.iter() {
32 Assign(place_and_rval) => match &place_and_rval.1 {
33 Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) => {
34 not_ssa(&mut flag_map, place.local)
42 match &bb.terminator().kind {
43 TerminatorKind::Call { destination, func, args, .. } => {
44 if let Some((dest_place, _dest_bb)) = destination {
45 if !crate::abi::can_return_to_ssa_var(fx, func, args) {
46 not_ssa(&mut flag_map, dest_place.local)
57 fn not_ssa(flag_map: &mut IndexVec<Local, SsaKind>, local: Local) {
58 flag_map[local] = SsaKind::NotSsa;