1
Fork 0

parameterize BitVector and BitMatrix by their index types

This commit is contained in:
Niko Matsakis 2018-07-22 19:23:39 +03:00
parent a54401ebcc
commit 145155dc96
16 changed files with 119 additions and 96 deletions

View file

@ -268,7 +268,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
let debug_scope = fx.scopes[decl.visibility_scope];
let dbg = debug_scope.is_valid() && bx.sess().opts.debuginfo == FullDebugInfo;
if !memory_locals.contains(local.index()) && !dbg {
if !memory_locals.contains(local) && !dbg {
debug!("alloc: {:?} ({}) -> operand", local, name);
return LocalRef::new_operand(bx.cx, layout);
}
@ -291,7 +291,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
debug!("alloc: {:?} (return place) -> place", local);
let llretptr = llvm::get_param(llfn, 0);
LocalRef::Place(PlaceRef::new_sized(llretptr, layout, layout.align))
} else if memory_locals.contains(local.index()) {
} else if memory_locals.contains(local) {
debug!("alloc: {:?} -> place", local);
LocalRef::Place(PlaceRef::alloca(&bx, layout, &format!("{:?}", local)))
} else {
@ -415,7 +415,7 @@ fn create_funclets<'a, 'tcx>(
fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
fx: &FunctionCx<'a, 'tcx>,
scopes: &IndexVec<mir::SourceScope, debuginfo::MirDebugScope>,
memory_locals: &BitVector)
memory_locals: &BitVector<mir::Local>)
-> Vec<LocalRef<'tcx>> {
let mir = fx.mir;
let tcx = bx.tcx();
@ -487,7 +487,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
llarg_idx += 1;
}
if arg_scope.is_none() && !memory_locals.contains(local.index()) {
if arg_scope.is_none() && !memory_locals.contains(local) {
// We don't have to cast or keep the argument in the alloca.
// FIXME(eddyb): We should figure out how to use llvm.dbg.value instead
// of putting everything in allocas just so we can use llvm.dbg.declare.