3 use rustc::mir::StatementKind::*;
4 use rustc_index::vec::IndexVec;
6 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
12 pub fn analyze(fx: &FunctionCx<'_, '_, impl Backend>) -> IndexVec<Local, SsaKind> {
13 let mut flag_map = fx.mir.local_decls.iter().map(|local_decl| {
14 if fx.clif_type(local_decl.ty).is_some() {
19 }).collect::<IndexVec<Local, SsaKind>>();
21 for bb in fx.mir.basic_blocks().iter() {
22 for stmt in bb.statements.iter() {
24 Assign(place_and_rval) => match &place_and_rval.1 {
25 Rvalue::Ref(_, _, place) => {
26 analyze_non_ssa_place(&mut flag_map, place);
38 fn analyze_non_ssa_place(flag_map: &mut IndexVec<Local, SsaKind>, place: &Place) {
40 PlaceBase::Local(local) => not_ssa(flag_map, local),
45 fn not_ssa(flag_map: &mut IndexVec<Local, SsaKind>, local: Local) {
46 flag_map[local] = SsaKind::NotSsa;