open_vaf/analysis/data_flow/framework/graph.rs
1// * ******************************************************************************************
2// * Copyright (c) 2019 Pascal Kuthe. This file is part of the OpenVAF project.
3// * It is subject to the license terms in the LICENSE file found in the top-level directory
4// * of this distribution and at https://gitlab.com/DSPOM/OpenVAF/blob/master/LICENSE.
5// * No part of OpenVAF, including this file, may be copied, modified, propagated, or
6// * distributed except according to the terms contained in the LICENSE file.
7// * *******************************************************************************************
8
9use crate::cfg::{BasicBlockId, ControlFlowGraph};
10use crate::data_structures::BitSet;
11use index_vec::*;
12
13pub struct Graph<SetType: Idx + From<usize>> {
14 pub in_sets: IndexVec<BasicBlockId, BitSet<SetType>>,
15 pub out_sets: IndexVec<BasicBlockId, BitSet<SetType>>,
16}
17
18impl<SetType: Idx + From<usize>> Graph<SetType> {
19 pub fn new(max_id: SetType, cfg: &ControlFlowGraph) -> Self {
20 let in_sets = index_vec![BitSet::new_empty(max_id);cfg.blocks.len()];
21 Self {
22 out_sets: in_sets.clone(),
23 in_sets,
24 }
25 }
26}
27//TODO print