To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

liveness.rs 19.2 KB
Newer Older
qinsoon's avatar
qinsoon committed
1
use compiler::machine_code::CompiledFunction;
2
use ast::ir::*;
qinsoon's avatar
qinsoon committed
3
use compiler::backend;
4
use utils::LinkedHashSet;
5

qinsoon's avatar
qinsoon committed
6
7
use std::collections::{HashMap, HashSet};

8
9
10
use compiler::backend::reg_alloc::graph_coloring::petgraph;
use compiler::backend::reg_alloc::graph_coloring::petgraph::Graph;
use compiler::backend::reg_alloc::graph_coloring::petgraph::graph::NodeIndex;
qinsoon's avatar
qinsoon committed
11

12
13
14
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct GraphNode {
    temp: MuID,
qinsoon's avatar
qinsoon committed
15
    color: Option<MuID>,
16
17
    group: backend::RegGroup,
    spill_cost: f32
qinsoon's avatar
qinsoon committed
18
}
19

qinsoon's avatar
qinsoon committed
20
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
21
pub struct Move{pub from: NodeIndex, pub to: NodeIndex}
22
23

pub struct InterferenceGraph {
24
25
    graph: Graph<GraphNode, (), petgraph::Undirected>,
    nodes: HashMap<MuID, NodeIndex>,
qinsoon's avatar
qinsoon committed
26
    moves: HashSet<Move>,
27
28
29
30
}

impl InterferenceGraph {
    fn new() -> InterferenceGraph {
qinsoon's avatar
qinsoon committed
31
        InterferenceGraph {
32
            graph: Graph::new_undirected(),
qinsoon's avatar
qinsoon committed
33
34
35
36
37
            nodes: HashMap::new(),
            moves: HashSet::new()
        }
    }
    
38
    fn new_node(&mut self, reg_id: MuID, context: &FunctionContext) -> NodeIndex {
qinsoon's avatar
qinsoon committed
39
40
41
        let entry = context.get_value(reg_id).unwrap();
        
        if !self.nodes.contains_key(&reg_id) {
42
            let node = GraphNode {
43
                temp: reg_id,
44
45
                color: None,
                group: backend::RegGroup::get(entry.ty()),
46
                spill_cost: 0.0f32
qinsoon's avatar
qinsoon committed
47
            };
48
49
50
51
52

            let index = self.graph.add_node(node);

            self.nodes.insert(reg_id, index);
        }
53
        
54
55
        let node_index = *self.nodes.get(&reg_id).unwrap();
        let node_mut = self.graph.node_weight_mut(node_index).unwrap();
56
57
        
        // increase node spill cost
58
        node_mut.spill_cost += 1.0f32;
59
        
60
        node_index
qinsoon's avatar
qinsoon committed
61
62
    }
    
63
    pub fn get_node(&self, reg: MuID) -> NodeIndex {
qinsoon's avatar
qinsoon committed
64
        match self.nodes.get(&reg) {
qinsoon's avatar
qinsoon committed
65
            Some(index) => *index,
qinsoon's avatar
qinsoon committed
66
            None => panic!("do not have a node for {}", reg)
qinsoon's avatar
qinsoon committed
67
68
69
        }
    }
    
70
71
72
73
74
75
76
77
    pub fn temps(&self) -> Vec<MuID>{
        let mut ret = vec![];
        for reg in self.nodes.keys() {
            ret.push(*reg);
        }
        ret
    }
    
78
    pub fn nodes(&self) -> Vec<NodeIndex> {
qinsoon's avatar
qinsoon committed
79
        let mut ret = vec![];
80
81
        for index in self.nodes.values() {
            ret.push(*index);
qinsoon's avatar
qinsoon committed
82
83
84
85
86
87
88
89
90
91
92
93
        }
        ret
    }
    
    pub fn moves(&self) -> &HashSet<Move> {
        &self.moves
    }
    
    pub fn n_nodes(&self) -> usize {
        self.nodes.len()
    }
    
94
    fn add_move(&mut self, src: NodeIndex, dst: NodeIndex) {
qinsoon's avatar
qinsoon committed
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
        let src = {
            let temp_src = self.get_temp_of(src);
            if temp_src < MACHINE_ID_END {
                let alias = backend::get_color_for_precolored(self.get_temp_of(src));
                self.get_node(alias)
            } else {
                src
            }
        };


        let dst = {
            let temp_dst = self.get_temp_of(dst);
            if temp_dst < MACHINE_ID_END {
                let alias = backend::get_color_for_precolored(self.get_temp_of(dst));
                self.get_node(alias)
            } else {
                dst
            }
        };

qinsoon's avatar
qinsoon committed
116
        self.moves.insert(Move{from: src, to: dst});
117
118
    }
    
119
120
    pub fn add_interference_edge(&mut self, from: NodeIndex, to: NodeIndex) {
        self.graph.update_edge(from, to, ());
qinsoon's avatar
qinsoon committed
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

        // if one of the node is machine register, we also add
        // interference edge to its alias
        // e.g. if we have %a, %edi interferenced,
        // we also add %a, %rdi interference

        let from_tmp = self.graph.node_weight(from).unwrap().temp;
        let to_tmp   = self.graph.node_weight(to).unwrap().temp;

        if from_tmp < MACHINE_ID_END || to_tmp < MACHINE_ID_END {
            let from_tmp = if from_tmp < MACHINE_ID_END {
                backend::get_color_for_precolored(from_tmp)
            } else {
                from_tmp
            };

            let to_tmp = if to_tmp < MACHINE_ID_END {
                backend::get_color_for_precolored(to_tmp)
            } else {
                to_tmp
            };

            let from_tmp_node = self.get_node(from_tmp);
            let to_tmp_node   = self.get_node(to_tmp);
            self.graph.update_edge(from_tmp_node, to_tmp_node, ());
        }
qinsoon's avatar
qinsoon committed
147
148
    }

149
    pub fn is_interferenced_with(&self, node1: NodeIndex, node2: NodeIndex) -> bool {
150
151
152
        let edge = self.graph.find_edge(node1, node2);

        edge.is_some()
qinsoon's avatar
qinsoon committed
153
154
    }
    
155
156
    pub fn color_node(&mut self, node: NodeIndex, color: MuID) {
        self.graph.node_weight_mut(node).unwrap().color = Some(color);
qinsoon's avatar
qinsoon committed
157
158
    }
    
159
160
    pub fn is_colored(&self, node: NodeIndex) -> bool {
        self.graph.node_weight(node).unwrap().color.is_some()
qinsoon's avatar
qinsoon committed
161
162
    }
    
163
164
    pub fn get_color_of(&self, node: NodeIndex) -> Option<MuID> {
        self.graph.node_weight(node).unwrap().color
165
166
    }
    
167
168
    pub fn get_group_of(&self, node: NodeIndex) -> backend::RegGroup {
        self.graph.node_weight(node).unwrap().group
qinsoon's avatar
qinsoon committed
169
170
    }
    
171
172
    pub fn get_temp_of(&self, node: NodeIndex) -> MuID {
        self.graph.node_weight(node).unwrap().temp
173
174
    }
    
175
176
    pub fn get_spill_cost(&self, node: NodeIndex) -> f32 {
        self.graph.node_weight(node).unwrap().spill_cost
177
178
    }
    
179
    fn is_same_node(&self, node1: NodeIndex, node2: NodeIndex) -> bool {
qinsoon's avatar
qinsoon committed
180
        node1 == node2
qinsoon's avatar
qinsoon committed
181
    }
182
183
184
185
186
187
188

    fn is_same_group(&self, node1: NodeIndex, node2: NodeIndex) -> bool {
        let node1 = self.graph.node_weight(node1).unwrap();
        let node2 = self.graph.node_weight(node2).unwrap();

        node1.group == node2.group
    }
qinsoon's avatar
qinsoon committed
189
    
190
191
    pub fn is_adj(&self, from: NodeIndex, to: NodeIndex) -> bool {
        self.is_interferenced_with(from, to)
qinsoon's avatar
qinsoon committed
192
193
    }
    
194
195
    pub fn outedges_of(&self, node: NodeIndex) -> Vec<NodeIndex> {
        self.graph.neighbors(node).collect()
196
197
    }
    
198
199
    pub fn outdegree_of(&self, node: NodeIndex) -> usize {
        self.outedges_of(node).len()
qinsoon's avatar
qinsoon committed
200
201
    }
    
202
203
    pub fn indegree_of(&self, node: NodeIndex) -> usize {
        self.outdegree_of(node)
qinsoon's avatar
qinsoon committed
204
205
    }
    
206
    pub fn degree_of(&self, node: NodeIndex) -> usize {
qinsoon's avatar
fix    
qinsoon committed
207
        self.outdegree_of(node)
qinsoon's avatar
qinsoon committed
208
209
    }
    
qinsoon's avatar
qinsoon committed
210
    pub fn print(&self, context: &FunctionContext) {
211
212
213
        use compiler::backend::reg_alloc::graph_coloring::petgraph::dot::Dot;
        use compiler::backend::reg_alloc::graph_coloring::petgraph::dot::Config;

qinsoon's avatar
qinsoon committed
214
215
        debug!("");
        debug!("Interference Graph");
216

qinsoon's avatar
qinsoon committed
217
        debug!("nodes:");
qinsoon's avatar
qinsoon committed
218
        for id in self.nodes.keys() {
qinsoon's avatar
qinsoon committed
219
            let val = context.get_value(*id).unwrap().value();
qinsoon's avatar
qinsoon committed
220
            debug!("Reg {} -> {:?}", val, self.nodes.get(&id).unwrap());
qinsoon's avatar
qinsoon committed
221
222
        }

qinsoon's avatar
qinsoon committed
223
        debug!("moves:");
224
        for mov in self.moves.iter() {
qinsoon's avatar
qinsoon committed
225
            debug!("Move {:?} -> {:?}", mov.from, mov.to);
226
        }
qinsoon's avatar
qinsoon committed
227

228
        debug!("graph:");
229
        debug!("\n\n{:?}\n", Dot::with_config(&self.graph, &[Config::EdgeNoLabel]));
qinsoon's avatar
qinsoon committed
230
        debug!("");
231
    }
qinsoon's avatar
qinsoon committed
232
233
}

234
235
236
fn build_live_set (cf: &mut CompiledFunction) {
    info!("start building live set");

qinsoon's avatar
qinsoon committed
237
    let n_insts = cf.mc().number_of_insts();
238
239
240
241

    let mut livein  : Vec<LinkedHashSet<MuID>> = vec![LinkedHashSet::new(); n_insts];
    let mut liveout : Vec<LinkedHashSet<MuID>> = vec![LinkedHashSet::new(); n_insts];

242
    let mut is_changed = true;
243

244
245
246
    while is_changed {
        // reset
        is_changed = false;
247

248
        for n in 0..n_insts {
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
            let in_set_old = livein[n].clone();
            let out_set_old = liveout[n].clone();

            // in[n] <- use[n] + (out[n] - def[n]);
            {
                let ref mut inset = livein[n];

                inset.clear();

                // (1) in[n] = use[n]
                inset.add_from_vec(cf.mc().get_inst_reg_uses(n));
                // (2) + out[n]
                inset.add_all(liveout[n].clone());
                // (3) - def[n]
                for def in cf.mc().get_inst_reg_defines(n) {
                    inset.remove(&def);
                }
266
            }
267

268
            // out[n] <- union(in[s] for every successor s of n)
269
270
271
272
273
274
275
            {
                let ref mut outset = liveout[n];
                outset.clear();

                for s in cf.mc().get_succs(n) {
                    outset.add_all(livein[*s].clone());
                }
276
            }
277
278
279
280

            // is in/out changed in this iteration?
            let n_changed = !in_set_old.equals(&livein[n]) || !out_set_old.equals(&liveout[n]);

281
282
283
            is_changed = is_changed || n_changed;
        }
    }
284

qinsoon's avatar
qinsoon committed
285
    for block in cf.mc().get_all_blocks().to_vec() {
286
        let start_inst = cf.mc().get_block_range(&block).unwrap().start;
287
        cf.mc_mut().set_ir_block_livein(&block, livein[start_inst].clone().to_vec());
288
289

        let end_inst = cf.mc().get_block_range(&block).unwrap().end;
290
        cf.mc_mut().set_ir_block_liveout(&block, liveout[end_inst].clone().to_vec());
291
    }
292
293
}

294
// from Tailoring Graph-coloring Register Allocation For Runtime Compilation, Figure 4
295
pub fn build_chaitin_briggs (cf: &mut CompiledFunction, func: &MuFunctionVersion) -> InterferenceGraph {
296
    build_live_set(cf);
297
    
298
299
300
    let mut ig = InterferenceGraph::new();
    
    // precolor machine register nodes
301
    for reg in backend::all_regs().values() {
302
303
        let reg_id = reg.extract_ssa_id().unwrap();
        let node = ig.new_node(reg_id, &func.context);
qinsoon's avatar
qinsoon committed
304

qinsoon's avatar
qinsoon committed
305
        let precolor = backend::get_color_for_precolored(reg_id);
qinsoon's avatar
qinsoon committed
306
307

        ig.color_node(node, precolor);
308
309
310
    }
    
    // Initialize and creates nodes for all the involved temps/regs
qinsoon's avatar
qinsoon committed
311
312
    for i in 0..cf.mc().number_of_insts() {
        for reg_id in cf.mc().get_inst_reg_defines(i) {
313
314
315
            ig.new_node(reg_id, &func.context);
        }
        
qinsoon's avatar
qinsoon committed
316
        for reg_id in cf.mc().get_inst_reg_uses(i) {
317
318
319
320
            ig.new_node(reg_id, &func.context);
        }
    }
    
qinsoon's avatar
qinsoon committed
321
    for block in cf.mc().get_all_blocks() {
322
        // Current_Live(B) = LiveOut(B)
qinsoon's avatar
qinsoon committed
323
        let mut current_live = LinkedHashSet::from_vec(match cf.mc().get_ir_block_liveout(&block) {
324
325
326
            Some(liveout) => liveout.to_vec(),
            None => panic!("cannot find liveout for block {}", block)
        });
qinsoon's avatar
qinsoon committed
327
328
329
330
331
332
        if cfg!(debug_assertions) {
            trace!("Block{}: live out", block);
            for ele in current_live.iter() {
                trace!("{}", func.context.get_temp_display(*ele));
            }
        }
333
        
qinsoon's avatar
qinsoon committed
334
        let range = cf.mc().get_block_range(&block);
335
        if range.is_none() {
qinsoon's avatar
qinsoon committed
336
            warn!("Block{}: has no range (no instructions?)", block);
337
338
            continue;
        }
qinsoon's avatar
qinsoon committed
339
        trace!("Block{}: range = {:?}", block, range.as_ref().unwrap());
340
341
342
        
        // for every inst I in reverse order
        for i in range.unwrap().rev() {
qinsoon's avatar
qinsoon committed
343
344
345
346
347
348
349
            if cfg!(debug_assertions) {
                trace!("Block{}: Inst{}: start. current_live:", block, i);
                for ele in current_live.iter() {
                    trace!("{}", func.context.get_temp_display(*ele));
                }
            }

350
            let src : Option<MuID> = {
qinsoon's avatar
qinsoon committed
351
352
353
                if cf.mc().is_move(i) {
                    let src = cf.mc().get_inst_reg_uses(i);
                    let dst = cf.mc().get_inst_reg_defines(i);
354
                    
qinsoon's avatar
qinsoon committed
355
356
357
                    // src:  reg/imm/mem
                    // dest: reg/mem
                    // we dont care if src/dest is mem
qinsoon's avatar
qinsoon committed
358
                    if cf.mc().is_using_mem_op(i) {
359
                        None
qinsoon's avatar
qinsoon committed
360
361
362
363
                    } else {
                        if src.len() == 1 {
                            let node1 = ig.get_node(src[0]);
                            let node2 = ig.get_node(dst[0]);
qinsoon's avatar
qinsoon committed
364
365
366
                            trace!("add move between {} and {}",
                                   func.context.get_temp_display(src[0]),
                                   func.context.get_temp_display(dst[0]));
qinsoon's avatar
qinsoon committed
367
368
369
370
371
372
                            ig.add_move(node1, node2);
                            
                            Some(src[0])
                        } else {
                            None
                        }
373
374
375
376
377
                    }
                } else {
                    None
                }
            };
qinsoon's avatar
qinsoon committed
378
            trace!("Block{}: Inst{}: src={:?}", block, i, src);
379
380
            
            // for every definition D in I
qinsoon's avatar
qinsoon committed
381
            for d in cf.mc().get_inst_reg_defines(i) {
qinsoon's avatar
qinsoon committed
382
                trace!("Block{}: Inst{}: for definition {}", block, i, func.context.get_temp_display(d));
383
384
385
                // add an interference from D to every element E in Current_Live - {D}
                // creating nodes if necessary
                for e in current_live.iter() {
qinsoon's avatar
qinsoon committed
386
387
388
                    trace!("Block{}: Inst{}: for each live {}",
                           block, i,
                           func.context.get_temp_display(*e));
389
                    if src.is_none() || (src.is_some() && *e != src.unwrap()) {
qinsoon's avatar
qinsoon committed
390
                        let from = ig.get_node(d);
391
392
                        let to = ig.get_node(*e);
                        
qinsoon's avatar
qinsoon committed
393
                        if !ig.is_same_node(from, to) &&ig.is_same_group(from, to) && !ig.is_adj(from, to) {
394
                            if !ig.is_colored(from) {
qinsoon's avatar
qinsoon committed
395
396
397
398
                                trace!("Block{}: Inst{}: add interference between {} and {}",
                                       block, i,
                                       func.context.get_temp_display(d),
                                       func.context.get_temp_display(*e));
399
400
401
                                ig.add_interference_edge(from, to);
                            }
                            if !ig.is_colored(to) {
qinsoon's avatar
qinsoon committed
402
403
404
405
                                trace!("Block{}: Inst{}: add interference between {} and {}",
                                       block, i,
                                       func.context.get_temp_display(*e),
                                       func.context.get_temp_display(d));
406
407
408
409
410
411
412
413
                                ig.add_interference_edge(to, from);
                            }
                        }
                    }
                }
            }
            
            // for every definition D in I
qinsoon's avatar
qinsoon committed
414
            for d in cf.mc().get_inst_reg_defines(i) {
qinsoon's avatar
qinsoon committed
415
416
417
                trace!("Block{}: Inst{}: remove define {} from current_live",
                       block, i,
                       func.context.get_temp_display(d));
418
                // remove D from Current_Live
qinsoon's avatar
qinsoon committed
419
                current_live.remove(&d);
420
421
422
            }
            
            // for every use U in I
qinsoon's avatar
qinsoon committed
423
            for u in cf.mc().get_inst_reg_uses(i) {
qinsoon's avatar
qinsoon committed
424
425
426
                trace!("Block{}: Inst{}: add use {} to current_live",
                       block, i,
                       func.context.get_temp_display(u));
427
                // add U to Current_live
qinsoon's avatar
qinsoon committed
428
                current_live.insert(u);
429
            }
qinsoon's avatar
qinsoon committed
430
431
432
433
434
435
436

            if cfg!(debug_assertions) {
                trace!("Block{}: Inst{}: done. current_live:", block, i);
                for ele in current_live.iter() {
                    trace!("{}", func.context.get_temp_display(*ele));
                }
            }
437
438
439
440
441
442
        }
    }
    
    ig
}

443
// from tony's code src/RegAlloc/Liveness.java
444
// this function is no longer used
qinsoon's avatar
qinsoon committed
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
//#[allow(dead_code)]
//pub fn build (cf: &CompiledFunction, func: &MuFunctionVersion) -> InterferenceGraph {
//    let mut ig = InterferenceGraph::new();
//
//    // precolor machine register nodes
//    for reg in backend::all_regs().values() {
//        let reg_id = reg.extract_ssa_id().unwrap();
//        let node = ig.new_node(reg_id, &func.context);
//        ig.color_node(node, reg_id);
//    }
//
//    // Liveness Analysis
//    let n_insts = cf.mc().number_of_insts();
//    let mut live_in : Vec<Vec<MuID>> = vec![vec![]; n_insts];
//    let mut live_out : Vec<Vec<MuID>> = vec![vec![]; n_insts];
//    let mut work_list : LinkedList<usize> = LinkedList::new();
//
//    // Initialize 'in' sets for each node in the flow graph
//    // and creates nodes for all the involved temps/regs
//    for i in 0..n_insts {
//        let ref mut in_set = live_in[i];
//
//        for reg_id in cf.mc().get_inst_reg_defines(i) {
//            ig.new_node(reg_id, &func.context);
//        }
//
//        for reg_id in cf.mc().get_inst_reg_uses(i) {
//            ig.new_node(reg_id, &func.context);
//
//            in_set.push(reg_id);
//        }
//
//        work_list.push_front(i);
//    }
//
//    // all nodes has been added, we init graph (create adjacency matrix)
//    ig.init_graph();
//
//    // compute liveIn and liveOut iteratively
//    trace!("build live outs");
//    while !work_list.is_empty() {
//        let n = work_list.pop_front().unwrap();
//        trace!("build liveout for #{}", n);
//        let ref mut out_set = live_out[n];
//
//        // out = union(in[succ]) for all succs
//        for succ in cf.mc().get_succs(n) {
//            trace!("add successor's livein {:?} to #{}", &live_in[*succ], n);
//            vec_utils::add_all(out_set, &live_in[*succ]);
//        }
//
//        // in = use(i.e. live_in) + (out - def)
//        let mut diff = out_set.clone();
//        for def in cf.mc().get_inst_reg_defines(n) {
//            vec_utils::remove_value(&mut diff, def);
//            trace!("removing def: {}", def);
//            trace!("diff = {:?}", diff);
//        }
//        trace!("out - def = {:?}", diff);
//
//        if !diff.is_empty() {
//            let ref mut in_set = live_in[n];
//            trace!("in = (use) {:?}", in_set);
//
//            if vec_utils::add_all(in_set, &diff) {
//                for p in cf.mc().get_preds(n) {
//                    work_list.push_front(*p);
//                }
//            }
//        }
//        trace!("in = use + (out - def) = {:?}", live_in[n]);
//    }
//
//    // debug live-outs
//    if cfg!(debug_assertions) {
//        trace!("check live-outs");
//        for n in 0..n_insts {
//            let ref mut live = live_out[n];
//            trace!("#{}\t{:?}", n, live);
//        }
//    }
//
//    // build interference graph
//    for n in 0..n_insts {
//        let ref mut live = live_out[n];
//
//        let src : Option<MuID> = {
//            if cf.mc().is_move(n) {
//                let src = cf.mc().get_inst_reg_uses(n);
//                let dst = cf.mc().get_inst_reg_defines(n);
//
//                // src may be an immediate number
//                // but dest is definitly a register
//                debug_assert!(dst.len() == 1);
//
//                if src.len() == 1 {
//                    let node1 = ig.get_node(src[0]);
//                    let node2 = ig.get_node(dst[0]);
//                    ig.add_move(node1, node2);
//
//                    Some(src[0])
//                } else {
//                    None
//                }
//            } else {
//                None
//            }
//        };
//
//        for d in cf.mc().get_inst_reg_defines(n) {
//            for t in live.iter() {
//                if src.is_none() || (src.is_some() && *t != src.unwrap()) {
//                    let from = ig.get_node(d);
//                    let to = ig.get_node(*t);
//
//                    if !ig.is_same_node(from, to) && !ig.is_adj(from, to) {
//                        if !ig.is_colored(from) {
//                            ig.add_interference_edge(from, to);
//                        }
//                        if !ig.is_colored(to) {
//                            ig.add_interference_edge(to, from);
//                        }
//                    }
//                }
//            }
//        }
//
//        for d in cf.mc().get_inst_reg_defines(n) {
//            vec_utils::remove_value(live, d);
//        }
//
//        for u in cf.mc().get_inst_reg_uses(n) {
//            live.push(u);
//        }
//    }
//
//    ig
//}