rapx/analysis/core/alias_analysis/default/
block.rs1use super::assign::*;
2use crate::analysis::graphs::scc::SccInfo;
3use rustc_data_structures::fx::FxHashSet;
4use rustc_middle::mir::Terminator;
5
6#[derive(Debug, Clone)]
8pub struct Block<'tcx> {
9 pub index: usize,
10 pub is_cleanup: bool,
11 pub next: FxHashSet<usize>,
12 pub assignments: Vec<Assignment<'tcx>>,
13 pub const_value: Vec<ConstValue>,
14 pub assigned_locals: FxHashSet<usize>,
15 pub terminator: Term<'tcx>,
16 pub scc: SccInfo,
20}
21
22#[derive(Debug, Clone)]
23pub enum Term<'tcx> {
24 Call(Terminator<'tcx>),
25 Drop(Terminator<'tcx>),
26 Switch(Terminator<'tcx>),
27 None,
28}
29
30#[derive(Debug, Clone)]
31pub struct ConstValue {
32 pub def_id: usize,
33 pub value: usize,
34}
35
36impl ConstValue {
37 pub fn new(def_id: usize, value: usize) -> Self {
38 ConstValue { def_id, value }
39 }
40}
41
42impl<'tcx> Block<'tcx> {
43 pub fn new(index: usize, is_cleanup: bool) -> Block<'tcx> {
44 Block {
45 index,
46 is_cleanup,
47 next: FxHashSet::<usize>::default(),
48 assignments: Vec::<Assignment<'tcx>>::new(),
49 const_value: Vec::<ConstValue>::new(),
50 assigned_locals: FxHashSet::<usize>::default(),
51 terminator: Term::None,
52 scc: SccInfo::new(index),
53 }
54 }
55
56 pub fn add_next(&mut self, index: usize) {
57 self.next.insert(index);
58 }
59}