Skip to content

Commit 9bc4fbb

Browse files
Split out growth functionality into BitVector type
1 parent 1d64b24 commit 9bc4fbb

File tree

15 files changed

+116
-98
lines changed

15 files changed

+116
-98
lines changed

src/librustc/mir/traversal.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use rustc_data_structures::bitvec::BitVector;
11+
use rustc_data_structures::bitvec::BitArray;
1212

1313
use super::*;
1414

@@ -32,7 +32,7 @@ use super::*;
3232
#[derive(Clone)]
3333
pub struct Preorder<'a, 'tcx: 'a> {
3434
mir: &'a Mir<'tcx>,
35-
visited: BitVector<BasicBlock>,
35+
visited: BitArray<BasicBlock>,
3636
worklist: Vec<BasicBlock>,
3737
}
3838

@@ -42,7 +42,7 @@ impl<'a, 'tcx> Preorder<'a, 'tcx> {
4242

4343
Preorder {
4444
mir,
45-
visited: BitVector::new(mir.basic_blocks().len()),
45+
visited: BitArray::new(mir.basic_blocks().len()),
4646
worklist,
4747
}
4848
}
@@ -104,15 +104,15 @@ impl<'a, 'tcx> ExactSizeIterator for Preorder<'a, 'tcx> {}
104104
/// A Postorder traversal of this graph is `D B C A` or `D C B A`
105105
pub struct Postorder<'a, 'tcx: 'a> {
106106
mir: &'a Mir<'tcx>,
107-
visited: BitVector<BasicBlock>,
107+
visited: BitArray<BasicBlock>,
108108
visit_stack: Vec<(BasicBlock, Successors<'a>)>
109109
}
110110

111111
impl<'a, 'tcx> Postorder<'a, 'tcx> {
112112
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
113113
let mut po = Postorder {
114114
mir,
115-
visited: BitVector::new(mir.basic_blocks().len()),
115+
visited: BitArray::new(mir.basic_blocks().len()),
116116
visit_stack: Vec::new()
117117
};
118118

src/librustc/traits/select.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use middle::lang_items;
4545
use mir::interpret::{GlobalId};
4646

4747
use rustc_data_structures::sync::Lock;
48-
use rustc_data_structures::bitvec::BitVector;
48+
use rustc_data_structures::bitvec::BitArray;
4949
use std::iter;
5050
use std::cmp;
5151
use std::fmt;
@@ -3056,7 +3056,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
30563056
} else {
30573057
return Err(Unimplemented);
30583058
};
3059-
let mut ty_params = BitVector::new(substs_a.types().count());
3059+
let mut ty_params = BitArray::new(substs_a.types().count());
30603060
let mut found = false;
30613061
for ty in field.walk() {
30623062
if let ty::TyParam(p) = ty.sty {

src/librustc_codegen_llvm/debuginfo/create_scope_map.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use libc::c_uint;
2121

2222
use syntax_pos::Pos;
2323

24-
use rustc_data_structures::bitvec::BitVector;
24+
use rustc_data_structures::bitvec::BitArray;
2525
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
2626

2727
use syntax_pos::BytePos;
@@ -64,7 +64,7 @@ pub fn create_mir_scopes(
6464
};
6565

6666
// Find all the scopes with variables defined in them.
67-
let mut has_variables = BitVector::new(mir.source_scopes.len());
67+
let mut has_variables = BitArray::new(mir.source_scopes.len());
6868
for var in mir.vars_iter() {
6969
let decl = &mir.local_decls[var];
7070
has_variables.insert(decl.visibility_scope);
@@ -81,7 +81,7 @@ pub fn create_mir_scopes(
8181

8282
fn make_mir_scope(cx: &CodegenCx<'ll, '_>,
8383
mir: &Mir,
84-
has_variables: &BitVector<SourceScope>,
84+
has_variables: &BitArray<SourceScope>,
8585
debug_context: &FunctionDebugContextData<'ll>,
8686
scope: SourceScope,
8787
scopes: &mut IndexVec<SourceScope, MirDebugScope<'ll>>) {

src/librustc_codegen_llvm/mir/analyze.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! An analysis to determine which locals require allocas and
1212
//! which do not.
1313
14-
use rustc_data_structures::bitvec::BitVector;
14+
use rustc_data_structures::bitvec::BitArray;
1515
use rustc_data_structures::graph::dominators::Dominators;
1616
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
1717
use rustc::mir::{self, Location, TerminatorKind};
@@ -22,7 +22,7 @@ use rustc::ty::layout::LayoutOf;
2222
use type_of::LayoutLlvmExt;
2323
use super::FunctionCx;
2424

25-
pub fn non_ssa_locals(fx: &FunctionCx<'a, 'll, 'tcx>) -> BitVector<mir::Local> {
25+
pub fn non_ssa_locals(fx: &FunctionCx<'a, 'll, 'tcx>) -> BitArray<mir::Local> {
2626
let mir = fx.mir;
2727
let mut analyzer = LocalAnalyzer::new(fx);
2828

@@ -54,7 +54,7 @@ pub fn non_ssa_locals(fx: &FunctionCx<'a, 'll, 'tcx>) -> BitVector<mir::Local> {
5454
struct LocalAnalyzer<'mir, 'a: 'mir, 'll: 'a, 'tcx: 'll> {
5555
fx: &'mir FunctionCx<'a, 'll, 'tcx>,
5656
dominators: Dominators<mir::BasicBlock>,
57-
non_ssa_locals: BitVector<mir::Local>,
57+
non_ssa_locals: BitArray<mir::Local>,
5858
// The location of the first visited direct assignment to each
5959
// local, or an invalid location (out of bounds `block` index).
6060
first_assignment: IndexVec<mir::Local, Location>
@@ -67,7 +67,7 @@ impl LocalAnalyzer<'mir, 'a, 'll, 'tcx> {
6767
let mut analyzer = LocalAnalyzer {
6868
fx,
6969
dominators: fx.mir.dominators(),
70-
non_ssa_locals: BitVector::new(fx.mir.local_decls.len()),
70+
non_ssa_locals: BitArray::new(fx.mir.local_decls.len()),
7171
first_assignment: IndexVec::from_elem(invalid_location, &fx.mir.local_decls)
7272
};
7373

src/librustc_codegen_llvm/mir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use syntax::symbol::keywords;
3131

3232
use std::iter;
3333

34-
use rustc_data_structures::bitvec::BitVector;
34+
use rustc_data_structures::bitvec::BitArray;
3535
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
3636

3737
pub use self::constant::codegen_static_initializer;
@@ -323,7 +323,7 @@ pub fn codegen_mir(
323323
debuginfo::start_emitting_source_locations(&fx.debug_context);
324324

325325
let rpo = traversal::reverse_postorder(&mir);
326-
let mut visited = BitVector::new(mir.basic_blocks().len());
326+
let mut visited = BitArray::new(mir.basic_blocks().len());
327327

328328
// Codegen the body of each block using reverse postorder
329329
for (bb, _) in rpo {
@@ -417,7 +417,7 @@ fn arg_local_refs(
417417
bx: &Builder<'a, 'll, 'tcx>,
418418
fx: &FunctionCx<'a, 'll, 'tcx>,
419419
scopes: &IndexVec<mir::SourceScope, debuginfo::MirDebugScope<'ll>>,
420-
memory_locals: &BitVector<mir::Local>,
420+
memory_locals: &BitArray<mir::Local>,
421421
) -> Vec<LocalRef<'ll, 'tcx>> {
422422
let mir = fx.mir;
423423
let tcx = bx.tcx();

0 commit comments

Comments
 (0)