Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use BitVector for global sets of AttrId #52799

Merged
merged 2 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/librustc/mir/traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::bitvec::BitArray;

use super::*;

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

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

Preorder {
mir,
visited: BitVector::new(mir.basic_blocks().len()),
visited: BitArray::new(mir.basic_blocks().len()),
worklist,
}
}
Expand Down Expand Up @@ -104,15 +104,15 @@ impl<'a, 'tcx> ExactSizeIterator for Preorder<'a, 'tcx> {}
/// A Postorder traversal of this graph is `D B C A` or `D C B A`
pub struct Postorder<'a, 'tcx: 'a> {
mir: &'a Mir<'tcx>,
visited: BitVector<BasicBlock>,
visited: BitArray<BasicBlock>,
visit_stack: Vec<(BasicBlock, Successors<'a>)>
}

impl<'a, 'tcx> Postorder<'a, 'tcx> {
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
let mut po = Postorder {
mir,
visited: BitVector::new(mir.basic_blocks().len()),
visited: BitArray::new(mir.basic_blocks().len()),
visit_stack: Vec::new()
};

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use middle::lang_items;
use mir::interpret::{GlobalId};

use rustc_data_structures::sync::Lock;
use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::bitvec::BitArray;
use std::iter;
use std::cmp;
use std::fmt;
Expand Down Expand Up @@ -3056,7 +3056,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
} else {
return Err(Unimplemented);
};
let mut ty_params = BitVector::new(substs_a.types().count());
let mut ty_params = BitArray::new(substs_a.types().count());
let mut found = false;
for ty in field.walk() {
if let ty::TyParam(p) = ty.sty {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use libc::c_uint;

use syntax_pos::Pos;

use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::bitvec::BitArray;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};

use syntax_pos::BytePos;
Expand Down Expand Up @@ -64,7 +64,7 @@ pub fn create_mir_scopes(
};

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

fn make_mir_scope(cx: &CodegenCx<'ll, '_>,
mir: &Mir,
has_variables: &BitVector<SourceScope>,
has_variables: &BitArray<SourceScope>,
debug_context: &FunctionDebugContextData<'ll>,
scope: SourceScope,
scopes: &mut IndexVec<SourceScope, MirDebugScope<'ll>>) {
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_codegen_llvm/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! An analysis to determine which locals require allocas and
//! which do not.

use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::bitvec::BitArray;
use rustc_data_structures::graph::dominators::Dominators;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use rustc::mir::{self, Location, TerminatorKind};
Expand All @@ -22,7 +22,7 @@ use rustc::ty::layout::LayoutOf;
use type_of::LayoutLlvmExt;
use super::FunctionCx;

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

Expand Down Expand Up @@ -54,7 +54,7 @@ pub fn non_ssa_locals(fx: &FunctionCx<'a, 'll, 'tcx>) -> BitVector<mir::Local> {
struct LocalAnalyzer<'mir, 'a: 'mir, 'll: 'a, 'tcx: 'll> {
fx: &'mir FunctionCx<'a, 'll, 'tcx>,
dominators: Dominators<mir::BasicBlock>,
non_ssa_locals: BitVector<mir::Local>,
non_ssa_locals: BitArray<mir::Local>,
// The location of the first visited direct assignment to each
// local, or an invalid location (out of bounds `block` index).
first_assignment: IndexVec<mir::Local, Location>
Expand All @@ -67,7 +67,7 @@ impl LocalAnalyzer<'mir, 'a, 'll, 'tcx> {
let mut analyzer = LocalAnalyzer {
fx,
dominators: fx.mir.dominators(),
non_ssa_locals: BitVector::new(fx.mir.local_decls.len()),
non_ssa_locals: BitArray::new(fx.mir.local_decls.len()),
first_assignment: IndexVec::from_elem(invalid_location, &fx.mir.local_decls)
};

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use syntax::symbol::keywords;

use std::iter;

use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::bitvec::BitArray;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};

pub use self::constant::codegen_static_initializer;
Expand Down Expand Up @@ -323,7 +323,7 @@ pub fn codegen_mir(
debuginfo::start_emitting_source_locations(&fx.debug_context);

let rpo = traversal::reverse_postorder(&mir);
let mut visited = BitVector::new(mir.basic_blocks().len());
let mut visited = BitArray::new(mir.basic_blocks().len());

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