Skip to content

Commit c73f351

Browse files
committedMay 16, 2016
Revised mir-dataflow.
Incorporates many fixes contributed by arielb1. ---- revise borrowck::mir::dataflow code to allow varying domain for bitvectors. This particular code implements the `BitDenotation` trait for three analyses: * `MovingOutStatements`, which, like `borrowck::move_data`, maps each bit-index to a move instruction, and a 1 means "the effect of this move reaches this point" (and the assigned l-value, if a scoped declaration, is still in scope). * `MaybeInitializedLvals`, which maps each bit-index to an l-value. A 1 means "there exists a control flow path to this point that initializes the associated l-value." * `MaybeUninitializedLvals`, which maps each bit-index to an l-value A 1 means "there exists a control flow path to this point that de-initializes the associated l-value." ---- Revised `graphviz` dataflow-rendering support in `borrowck::mir`. One big difference is that this code is now parameterized over the `BitDenotation`, so that it can be used to render dataflow results independent of how the dataflow bitvectors are interpreted; see where reference to `MoveOut` is replaced by the type parameter `D`. ---- Factor out routine to query subattributes in `#[rustc_mir(..)]`. (Later commits build upon this for some unit testing and instrumentation.) ---- thread through a tcx so that I can query types of lvalues as part of analysis. ---- Revised `BitDenotation::Ctxt`, allowing variation beyond `MoveData`. The main motivation is to ease threading through a `TyCtxt`. (In hindsight it might have been better to instead attach the `TyCtxt` to each of the different dataflow implementations, but that would require e.g. switching away from having a `Default` impl, so I am leaving that experiment for another time.)
1 parent 6c72c5f commit c73f351

File tree

7 files changed

+1368
-720
lines changed

7 files changed

+1368
-720
lines changed
 

‎src/librustc/mir/repr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ pub struct UpvarDecl {
226226
/// list of the `Mir`.
227227
///
228228
/// (We use a `u32` internally just to save memory.)
229-
#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
229+
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord,
230+
RustcEncodable, RustcDecodable)]
230231
pub struct BasicBlock(u32);
231232

232233
impl BasicBlock {

‎src/librustc/mir/transform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use ty::TyCtxt;
1818
use syntax::ast::NodeId;
1919

2020
/// Where a specific Mir comes from.
21-
#[derive(Copy, Clone)]
21+
#[derive(Debug, Copy, Clone)]
2222
pub enum MirSource {
2323
/// Functions and methods.
2424
Fn(NodeId),

0 commit comments

Comments
 (0)