Created
July 12, 2016 23:48
-
-
Save scottcarr/8ecf9f7ad2d865eb26cb9e7695a1fc9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | |
// file at the top-level directory of this distribution and at | |
// http://rust-lang.org/COPYRIGHT. | |
// | |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
// option. This file may not be copied, modified, or distributed | |
// except according to those terms. | |
use rustc::ty::TyCtxt; | |
use rustc::mir::repr::*; | |
use rustc::mir::transform::{MirPass, MirSource, Pass}; | |
use rustc::mir::visit::{Visitor, LvalueContext}; | |
use std::collections::{HashMap, HashSet}; | |
use rustc_data_structures::tuple_slice::TupleSlice; | |
pub struct BadPass; | |
impl Pass for BadPass {} | |
impl<'tcx> MirPass<'tcx> for BadPass { | |
fn run_pass<'a>(&mut self, | |
tcx: TyCtxt<'a, 'tcx, 'tcx>, | |
src: MirSource, | |
mir: &mut Mir<'tcx>) { | |
} | |
} | |
#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)] | |
struct UseDefLocation { | |
basic_block: BasicBlock, | |
inner_location: InnerLocation, | |
} | |
impl UseDefLocation { | |
fn print(&self, mir: &Mir) { | |
let ref bb = mir[self.basic_block]; | |
match self.inner_location { | |
InnerLocation::StatementIndex(idx) => { | |
debug!("{:?}", bb.statements[idx]); | |
}, | |
InnerLocation::Terminator => { | |
debug!("{:?}", bb.terminator); | |
} | |
} | |
} | |
} | |
#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)] | |
enum InnerLocation { | |
StatementIndex(usize), | |
Terminator, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment