rustc_trans: rename mircx: MirContext to fx: FunctionCx.
This commit is contained in:
parent
209abc71e5
commit
4e40a0d436
9 changed files with 58 additions and 58 deletions
|
@ -45,7 +45,7 @@
|
||||||
//!
|
//!
|
||||||
//! All private state used by the module is stored within either the
|
//! All private state used by the module is stored within either the
|
||||||
//! CrateDebugContext struct (owned by the CodegenCx) or the
|
//! CrateDebugContext struct (owned by the CodegenCx) or the
|
||||||
//! FunctionDebugContext (owned by the MirContext).
|
//! FunctionDebugContext (owned by the FunctionCx).
|
||||||
//!
|
//!
|
||||||
//! This file consists of three conceptual sections:
|
//! This file consists of three conceptual sections:
|
||||||
//! 1. The public interface of the module
|
//! 1. The public interface of the module
|
||||||
|
|
|
@ -20,18 +20,18 @@ use rustc::mir::traversal;
|
||||||
use rustc::ty;
|
use rustc::ty;
|
||||||
use rustc::ty::layout::LayoutOf;
|
use rustc::ty::layout::LayoutOf;
|
||||||
use type_of::LayoutLlvmExt;
|
use type_of::LayoutLlvmExt;
|
||||||
use super::MirContext;
|
use super::FunctionCx;
|
||||||
|
|
||||||
pub fn memory_locals<'a, 'tcx>(mircx: &MirContext<'a, 'tcx>) -> BitVector {
|
pub fn memory_locals<'a, 'tcx>(fx: &FunctionCx<'a, 'tcx>) -> BitVector {
|
||||||
let mir = mircx.mir;
|
let mir = fx.mir;
|
||||||
let mut analyzer = LocalAnalyzer::new(mircx);
|
let mut analyzer = LocalAnalyzer::new(fx);
|
||||||
|
|
||||||
analyzer.visit_mir(mir);
|
analyzer.visit_mir(mir);
|
||||||
|
|
||||||
for (index, ty) in mir.local_decls.iter().map(|l| l.ty).enumerate() {
|
for (index, ty) in mir.local_decls.iter().map(|l| l.ty).enumerate() {
|
||||||
let ty = mircx.monomorphize(&ty);
|
let ty = fx.monomorphize(&ty);
|
||||||
debug!("local {} has type {:?}", index, ty);
|
debug!("local {} has type {:?}", index, ty);
|
||||||
let layout = mircx.cx.layout_of(ty);
|
let layout = fx.cx.layout_of(ty);
|
||||||
if layout.is_llvm_immediate() {
|
if layout.is_llvm_immediate() {
|
||||||
// These sorts of types are immediates that we can store
|
// These sorts of types are immediates that we can store
|
||||||
// in an ValueRef without an alloca.
|
// in an ValueRef without an alloca.
|
||||||
|
@ -52,21 +52,21 @@ pub fn memory_locals<'a, 'tcx>(mircx: &MirContext<'a, 'tcx>) -> BitVector {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LocalAnalyzer<'mir, 'a: 'mir, 'tcx: 'a> {
|
struct LocalAnalyzer<'mir, 'a: 'mir, 'tcx: 'a> {
|
||||||
cx: &'mir MirContext<'a, 'tcx>,
|
fx: &'mir FunctionCx<'a, 'tcx>,
|
||||||
memory_locals: BitVector,
|
memory_locals: BitVector,
|
||||||
seen_assigned: BitVector
|
seen_assigned: BitVector
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'mir, 'a, 'tcx> LocalAnalyzer<'mir, 'a, 'tcx> {
|
impl<'mir, 'a, 'tcx> LocalAnalyzer<'mir, 'a, 'tcx> {
|
||||||
fn new(mircx: &'mir MirContext<'a, 'tcx>) -> LocalAnalyzer<'mir, 'a, 'tcx> {
|
fn new(fx: &'mir FunctionCx<'a, 'tcx>) -> LocalAnalyzer<'mir, 'a, 'tcx> {
|
||||||
let mut analyzer = LocalAnalyzer {
|
let mut analyzer = LocalAnalyzer {
|
||||||
cx: mircx,
|
fx,
|
||||||
memory_locals: BitVector::new(mircx.mir.local_decls.len()),
|
memory_locals: BitVector::new(fx.mir.local_decls.len()),
|
||||||
seen_assigned: BitVector::new(mircx.mir.local_decls.len())
|
seen_assigned: BitVector::new(fx.mir.local_decls.len())
|
||||||
};
|
};
|
||||||
|
|
||||||
// Arguments get assigned to by means of the function being called
|
// Arguments get assigned to by means of the function being called
|
||||||
for idx in 0..mircx.mir.arg_count {
|
for idx in 0..fx.mir.arg_count {
|
||||||
analyzer.seen_assigned.insert(idx + 1);
|
analyzer.seen_assigned.insert(idx + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ impl<'mir, 'a, 'tcx> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx> {
|
||||||
|
|
||||||
if let mir::Place::Local(index) = *place {
|
if let mir::Place::Local(index) = *place {
|
||||||
self.mark_assigned(index);
|
self.mark_assigned(index);
|
||||||
if !self.cx.rvalue_creates_operand(rvalue) {
|
if !self.fx.rvalue_creates_operand(rvalue) {
|
||||||
self.mark_as_memory(index);
|
self.mark_as_memory(index);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,7 +117,7 @@ impl<'mir, 'a, 'tcx> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx> {
|
||||||
}, ..
|
}, ..
|
||||||
}),
|
}),
|
||||||
ref args, ..
|
ref args, ..
|
||||||
} if Some(def_id) == self.cx.cx.tcx.lang_items().box_free_fn() => {
|
} if Some(def_id) == self.fx.cx.tcx.lang_items().box_free_fn() => {
|
||||||
// box_free(x) shares with `drop x` the property that it
|
// box_free(x) shares with `drop x` the property that it
|
||||||
// is not guaranteed to be statically dominated by the
|
// is not guaranteed to be statically dominated by the
|
||||||
// definition of x, so x must always be in an alloca.
|
// definition of x, so x must always be in an alloca.
|
||||||
|
@ -136,7 +136,7 @@ impl<'mir, 'a, 'tcx> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx> {
|
||||||
context: PlaceContext<'tcx>,
|
context: PlaceContext<'tcx>,
|
||||||
location: Location) {
|
location: Location) {
|
||||||
debug!("visit_place(place={:?}, context={:?})", place, context);
|
debug!("visit_place(place={:?}, context={:?})", place, context);
|
||||||
let cx = self.cx.cx;
|
let cx = self.fx.cx;
|
||||||
|
|
||||||
if let mir::Place::Projection(ref proj) = *place {
|
if let mir::Place::Projection(ref proj) = *place {
|
||||||
// Allow uses of projections that are ZSTs or from scalar fields.
|
// Allow uses of projections that are ZSTs or from scalar fields.
|
||||||
|
@ -145,12 +145,12 @@ impl<'mir, 'a, 'tcx> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx> {
|
||||||
_ => false
|
_ => false
|
||||||
};
|
};
|
||||||
if is_consume {
|
if is_consume {
|
||||||
let base_ty = proj.base.ty(self.cx.mir, cx.tcx);
|
let base_ty = proj.base.ty(self.fx.mir, cx.tcx);
|
||||||
let base_ty = self.cx.monomorphize(&base_ty);
|
let base_ty = self.fx.monomorphize(&base_ty);
|
||||||
|
|
||||||
// ZSTs don't require any actual memory access.
|
// ZSTs don't require any actual memory access.
|
||||||
let elem_ty = base_ty.projection_ty(cx.tcx, &proj.elem).to_ty(cx.tcx);
|
let elem_ty = base_ty.projection_ty(cx.tcx, &proj.elem).to_ty(cx.tcx);
|
||||||
let elem_ty = self.cx.monomorphize(&elem_ty);
|
let elem_ty = self.fx.monomorphize(&elem_ty);
|
||||||
if cx.layout_of(elem_ty).is_zst() {
|
if cx.layout_of(elem_ty).is_zst() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -200,11 +200,11 @@ impl<'mir, 'a, 'tcx> Visitor<'tcx> for LocalAnalyzer<'mir, 'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaceContext::Drop => {
|
PlaceContext::Drop => {
|
||||||
let ty = mir::Place::Local(index).ty(self.cx.mir, self.cx.cx.tcx);
|
let ty = mir::Place::Local(index).ty(self.fx.mir, self.fx.cx.tcx);
|
||||||
let ty = self.cx.monomorphize(&ty.to_ty(self.cx.cx.tcx));
|
let ty = self.fx.monomorphize(&ty.to_ty(self.fx.cx.tcx));
|
||||||
|
|
||||||
// Only need the place if we're actually dropping it.
|
// Only need the place if we're actually dropping it.
|
||||||
if self.cx.cx.type_needs_drop(ty) {
|
if self.fx.cx.type_needs_drop(ty) {
|
||||||
self.mark_as_memory(index);
|
self.mark_as_memory(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,13 +29,13 @@ use type_::Type;
|
||||||
use syntax::symbol::Symbol;
|
use syntax::symbol::Symbol;
|
||||||
use syntax_pos::Pos;
|
use syntax_pos::Pos;
|
||||||
|
|
||||||
use super::{MirContext, LocalRef};
|
use super::{FunctionCx, LocalRef};
|
||||||
use super::constant::Const;
|
use super::constant::Const;
|
||||||
use super::place::PlaceRef;
|
use super::place::PlaceRef;
|
||||||
use super::operand::OperandRef;
|
use super::operand::OperandRef;
|
||||||
use super::operand::OperandValue::{Pair, Ref, Immediate};
|
use super::operand::OperandValue::{Pair, Ref, Immediate};
|
||||||
|
|
||||||
impl<'a, 'tcx> MirContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
||||||
pub fn trans_block(&mut self, bb: mir::BasicBlock) {
|
pub fn trans_block(&mut self, bb: mir::BasicBlock) {
|
||||||
let mut bx = self.build_block(bb);
|
let mut bx = self.build_block(bb);
|
||||||
let data = &self.mir[bb];
|
let data = &self.mir[bb];
|
||||||
|
|
|
@ -43,7 +43,7 @@ use std::fmt;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::operand::{OperandRef, OperandValue};
|
use super::operand::{OperandRef, OperandValue};
|
||||||
use super::MirContext;
|
use super::FunctionCx;
|
||||||
|
|
||||||
/// A sized constant rvalue.
|
/// A sized constant rvalue.
|
||||||
/// The LLVM type might not be the same for a single Rust type,
|
/// The LLVM type might not be the same for a single Rust type,
|
||||||
|
@ -1118,7 +1118,7 @@ unsafe fn cast_const_int_to_float(cx: &CodegenCx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> MirContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
||||||
pub fn trans_constant(&mut self,
|
pub fn trans_constant(&mut self,
|
||||||
bx: &Builder<'a, 'tcx>,
|
bx: &Builder<'a, 'tcx>,
|
||||||
constant: &mir::Constant<'tcx>)
|
constant: &mir::Constant<'tcx>)
|
||||||
|
|
|
@ -41,7 +41,7 @@ use rustc::mir::traversal;
|
||||||
use self::operand::{OperandRef, OperandValue};
|
use self::operand::{OperandRef, OperandValue};
|
||||||
|
|
||||||
/// Master context for translating MIR.
|
/// Master context for translating MIR.
|
||||||
pub struct MirContext<'a, 'tcx:'a> {
|
pub struct FunctionCx<'a, 'tcx:'a> {
|
||||||
mir: &'a mir::Mir<'tcx>,
|
mir: &'a mir::Mir<'tcx>,
|
||||||
|
|
||||||
debug_context: debuginfo::FunctionDebugContext,
|
debug_context: debuginfo::FunctionDebugContext,
|
||||||
|
@ -102,7 +102,7 @@ pub struct MirContext<'a, 'tcx:'a> {
|
||||||
param_substs: &'tcx Substs<'tcx>,
|
param_substs: &'tcx Substs<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> MirContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
||||||
pub fn monomorphize<T>(&self, value: &T) -> T
|
pub fn monomorphize<T>(&self, value: &T) -> T
|
||||||
where T: TransNormalize<'tcx>
|
where T: TransNormalize<'tcx>
|
||||||
{
|
{
|
||||||
|
@ -224,7 +224,7 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||||
let scopes = debuginfo::create_mir_scopes(cx, mir, &debug_context);
|
let scopes = debuginfo::create_mir_scopes(cx, mir, &debug_context);
|
||||||
let (landing_pads, funclets) = create_funclets(&bx, &cleanup_kinds, &block_bxs);
|
let (landing_pads, funclets) = create_funclets(&bx, &cleanup_kinds, &block_bxs);
|
||||||
|
|
||||||
let mut mircx = MirContext {
|
let mut fx = FunctionCx {
|
||||||
mir,
|
mir,
|
||||||
llfn,
|
llfn,
|
||||||
fn_ty,
|
fn_ty,
|
||||||
|
@ -244,20 +244,20 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let memory_locals = analyze::memory_locals(&mircx);
|
let memory_locals = analyze::memory_locals(&fx);
|
||||||
|
|
||||||
// Allocate variable and temp allocas
|
// Allocate variable and temp allocas
|
||||||
mircx.locals = {
|
fx.locals = {
|
||||||
let args = arg_local_refs(&bx, &mircx, &mircx.scopes, &memory_locals);
|
let args = arg_local_refs(&bx, &fx, &fx.scopes, &memory_locals);
|
||||||
|
|
||||||
let mut allocate_local = |local| {
|
let mut allocate_local = |local| {
|
||||||
let decl = &mir.local_decls[local];
|
let decl = &mir.local_decls[local];
|
||||||
let layout = bx.cx.layout_of(mircx.monomorphize(&decl.ty));
|
let layout = bx.cx.layout_of(fx.monomorphize(&decl.ty));
|
||||||
assert!(!layout.ty.has_erasable_regions());
|
assert!(!layout.ty.has_erasable_regions());
|
||||||
|
|
||||||
if let Some(name) = decl.name {
|
if let Some(name) = decl.name {
|
||||||
// User variable
|
// User variable
|
||||||
let debug_scope = mircx.scopes[decl.source_info.scope];
|
let debug_scope = fx.scopes[decl.source_info.scope];
|
||||||
let dbg = debug_scope.is_valid() && bx.sess().opts.debuginfo == FullDebugInfo;
|
let dbg = debug_scope.is_valid() && bx.sess().opts.debuginfo == FullDebugInfo;
|
||||||
|
|
||||||
if !memory_locals.contains(local.index()) && !dbg {
|
if !memory_locals.contains(local.index()) && !dbg {
|
||||||
|
@ -268,15 +268,15 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||||
debug!("alloc: {:?} ({}) -> place", local, name);
|
debug!("alloc: {:?} ({}) -> place", local, name);
|
||||||
let place = PlaceRef::alloca(&bx, layout, &name.as_str());
|
let place = PlaceRef::alloca(&bx, layout, &name.as_str());
|
||||||
if dbg {
|
if dbg {
|
||||||
let (scope, span) = mircx.debug_loc(decl.source_info);
|
let (scope, span) = fx.debug_loc(decl.source_info);
|
||||||
declare_local(&bx, &mircx.debug_context, name, layout.ty, scope,
|
declare_local(&bx, &fx.debug_context, name, layout.ty, scope,
|
||||||
VariableAccess::DirectVariable { alloca: place.llval },
|
VariableAccess::DirectVariable { alloca: place.llval },
|
||||||
VariableKind::LocalVariable, span);
|
VariableKind::LocalVariable, span);
|
||||||
}
|
}
|
||||||
LocalRef::Place(place)
|
LocalRef::Place(place)
|
||||||
} else {
|
} else {
|
||||||
// Temporary or return place
|
// Temporary or return place
|
||||||
if local == mir::RETURN_PLACE && mircx.fn_ty.ret.is_indirect() {
|
if local == mir::RETURN_PLACE && fx.fn_ty.ret.is_indirect() {
|
||||||
debug!("alloc: {:?} (return place) -> place", local);
|
debug!("alloc: {:?} (return place) -> place", local);
|
||||||
let llretptr = llvm::get_param(llfn, 0);
|
let llretptr = llvm::get_param(llfn, 0);
|
||||||
LocalRef::Place(PlaceRef::new_sized(llretptr, layout, layout.align))
|
LocalRef::Place(PlaceRef::new_sized(llretptr, layout, layout.align))
|
||||||
|
@ -302,13 +302,13 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||||
|
|
||||||
// Branch to the START block, if it's not the entry block.
|
// Branch to the START block, if it's not the entry block.
|
||||||
if reentrant_start_block {
|
if reentrant_start_block {
|
||||||
bx.br(mircx.blocks[mir::START_BLOCK]);
|
bx.br(fx.blocks[mir::START_BLOCK]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Up until here, IR instructions for this function have explicitly not been annotated with
|
// Up until here, IR instructions for this function have explicitly not been annotated with
|
||||||
// source code location, so we don't step into call setup code. From here on, source location
|
// source code location, so we don't step into call setup code. From here on, source location
|
||||||
// emitting should be enabled.
|
// emitting should be enabled.
|
||||||
debuginfo::start_emitting_source_locations(&mircx.debug_context);
|
debuginfo::start_emitting_source_locations(&fx.debug_context);
|
||||||
|
|
||||||
let rpo = traversal::reverse_postorder(&mir);
|
let rpo = traversal::reverse_postorder(&mir);
|
||||||
let mut visited = BitVector::new(mir.basic_blocks().len());
|
let mut visited = BitVector::new(mir.basic_blocks().len());
|
||||||
|
@ -316,7 +316,7 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||||
// Translate the body of each block using reverse postorder
|
// Translate the body of each block using reverse postorder
|
||||||
for (bb, _) in rpo {
|
for (bb, _) in rpo {
|
||||||
visited.insert(bb.index());
|
visited.insert(bb.index());
|
||||||
mircx.trans_block(bb);
|
fx.trans_block(bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove blocks that haven't been visited, or have no
|
// Remove blocks that haven't been visited, or have no
|
||||||
|
@ -326,7 +326,7 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||||
if !visited.contains(bb.index()) {
|
if !visited.contains(bb.index()) {
|
||||||
debug!("trans_mir: block {:?} was not visited", bb);
|
debug!("trans_mir: block {:?} was not visited", bb);
|
||||||
unsafe {
|
unsafe {
|
||||||
llvm::LLVMDeleteBasicBlock(mircx.blocks[bb]);
|
llvm::LLVMDeleteBasicBlock(fx.blocks[bb]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,14 +356,14 @@ fn create_funclets<'a, 'tcx>(
|
||||||
/// argument's value. As arguments are places, these are always
|
/// argument's value. As arguments are places, these are always
|
||||||
/// indirect.
|
/// indirect.
|
||||||
fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
mircx: &MirContext<'a, 'tcx>,
|
fx: &FunctionCx<'a, 'tcx>,
|
||||||
scopes: &IndexVec<mir::VisibilityScope, debuginfo::MirDebugScope>,
|
scopes: &IndexVec<mir::VisibilityScope, debuginfo::MirDebugScope>,
|
||||||
memory_locals: &BitVector)
|
memory_locals: &BitVector)
|
||||||
-> Vec<LocalRef<'tcx>> {
|
-> Vec<LocalRef<'tcx>> {
|
||||||
let mir = mircx.mir;
|
let mir = fx.mir;
|
||||||
let tcx = bx.tcx();
|
let tcx = bx.tcx();
|
||||||
let mut idx = 0;
|
let mut idx = 0;
|
||||||
let mut llarg_idx = mircx.fn_ty.ret.is_indirect() as usize;
|
let mut llarg_idx = fx.fn_ty.ret.is_indirect() as usize;
|
||||||
|
|
||||||
// Get the argument scope, if it exists and if we need it.
|
// Get the argument scope, if it exists and if we need it.
|
||||||
let arg_scope = scopes[mir::ARGUMENT_VISIBILITY_SCOPE];
|
let arg_scope = scopes[mir::ARGUMENT_VISIBILITY_SCOPE];
|
||||||
|
@ -392,7 +392,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
// to reconstruct it into a tuple local variable, from multiple
|
// to reconstruct it into a tuple local variable, from multiple
|
||||||
// individual LLVM function arguments.
|
// individual LLVM function arguments.
|
||||||
|
|
||||||
let arg_ty = mircx.monomorphize(&arg_decl.ty);
|
let arg_ty = fx.monomorphize(&arg_decl.ty);
|
||||||
let tupled_arg_tys = match arg_ty.sty {
|
let tupled_arg_tys = match arg_ty.sty {
|
||||||
ty::TyTuple(ref tys, _) => tys,
|
ty::TyTuple(ref tys, _) => tys,
|
||||||
_ => bug!("spread argument isn't a tuple?!")
|
_ => bug!("spread argument isn't a tuple?!")
|
||||||
|
@ -400,7 +400,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
|
|
||||||
let place = PlaceRef::alloca(bx, bx.cx.layout_of(arg_ty), &name);
|
let place = PlaceRef::alloca(bx, bx.cx.layout_of(arg_ty), &name);
|
||||||
for i in 0..tupled_arg_tys.len() {
|
for i in 0..tupled_arg_tys.len() {
|
||||||
let arg = &mircx.fn_ty.args[idx];
|
let arg = &fx.fn_ty.args[idx];
|
||||||
idx += 1;
|
idx += 1;
|
||||||
arg.store_fn_arg(bx, &mut llarg_idx, place.project_field(bx, i));
|
arg.store_fn_arg(bx, &mut llarg_idx, place.project_field(bx, i));
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
};
|
};
|
||||||
declare_local(
|
declare_local(
|
||||||
bx,
|
bx,
|
||||||
&mircx.debug_context,
|
&fx.debug_context,
|
||||||
arg_decl.name.unwrap_or(keywords::Invalid.name()),
|
arg_decl.name.unwrap_or(keywords::Invalid.name()),
|
||||||
arg_ty, scope,
|
arg_ty, scope,
|
||||||
variable_access,
|
variable_access,
|
||||||
|
@ -425,7 +425,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
return LocalRef::Place(place);
|
return LocalRef::Place(place);
|
||||||
}
|
}
|
||||||
|
|
||||||
let arg = &mircx.fn_ty.args[idx];
|
let arg = &fx.fn_ty.args[idx];
|
||||||
idx += 1;
|
idx += 1;
|
||||||
if arg.pad.is_some() {
|
if arg.pad.is_some() {
|
||||||
llarg_idx += 1;
|
llarg_idx += 1;
|
||||||
|
@ -499,7 +499,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
|
|
||||||
declare_local(
|
declare_local(
|
||||||
bx,
|
bx,
|
||||||
&mircx.debug_context,
|
&fx.debug_context,
|
||||||
arg_decl.name.unwrap_or(keywords::Invalid.name()),
|
arg_decl.name.unwrap_or(keywords::Invalid.name()),
|
||||||
arg.layout.ty,
|
arg.layout.ty,
|
||||||
scope,
|
scope,
|
||||||
|
@ -568,7 +568,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||||
};
|
};
|
||||||
declare_local(
|
declare_local(
|
||||||
bx,
|
bx,
|
||||||
&mircx.debug_context,
|
&fx.debug_context,
|
||||||
decl.debug_name,
|
decl.debug_name,
|
||||||
ty,
|
ty,
|
||||||
scope,
|
scope,
|
||||||
|
|
|
@ -24,7 +24,7 @@ use type_::Type;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::{MirContext, LocalRef};
|
use super::{FunctionCx, LocalRef};
|
||||||
use super::place::PlaceRef;
|
use super::place::PlaceRef;
|
||||||
|
|
||||||
/// The representation of a Rust value. The enum variant is in fact
|
/// The representation of a Rust value. The enum variant is in fact
|
||||||
|
@ -241,7 +241,7 @@ impl<'a, 'tcx> OperandValue {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> MirContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
||||||
fn maybe_trans_consume_direct(&mut self,
|
fn maybe_trans_consume_direct(&mut self,
|
||||||
bx: &Builder<'a, 'tcx>,
|
bx: &Builder<'a, 'tcx>,
|
||||||
place: &mir::Place<'tcx>)
|
place: &mir::Place<'tcx>)
|
||||||
|
|
|
@ -25,7 +25,7 @@ use glue;
|
||||||
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::{MirContext, LocalRef};
|
use super::{FunctionCx, LocalRef};
|
||||||
use super::operand::{OperandRef, OperandValue};
|
use super::operand::{OperandRef, OperandValue};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
@ -399,7 +399,7 @@ impl<'a, 'tcx> PlaceRef<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'tcx> MirContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
||||||
pub fn trans_place(&mut self,
|
pub fn trans_place(&mut self,
|
||||||
bx: &Builder<'a, 'tcx>,
|
bx: &Builder<'a, 'tcx>,
|
||||||
place: &mir::Place<'tcx>)
|
place: &mir::Place<'tcx>)
|
||||||
|
|
|
@ -29,12 +29,12 @@ use type_::Type;
|
||||||
use type_of::LayoutLlvmExt;
|
use type_of::LayoutLlvmExt;
|
||||||
use value::Value;
|
use value::Value;
|
||||||
|
|
||||||
use super::{MirContext, LocalRef};
|
use super::{FunctionCx, LocalRef};
|
||||||
use super::constant::const_scalar_checked_binop;
|
use super::constant::const_scalar_checked_binop;
|
||||||
use super::operand::{OperandRef, OperandValue};
|
use super::operand::{OperandRef, OperandValue};
|
||||||
use super::place::PlaceRef;
|
use super::place::PlaceRef;
|
||||||
|
|
||||||
impl<'a, 'tcx> MirContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
||||||
pub fn trans_rvalue(&mut self,
|
pub fn trans_rvalue(&mut self,
|
||||||
bx: Builder<'a, 'tcx>,
|
bx: Builder<'a, 'tcx>,
|
||||||
dest: PlaceRef<'tcx>,
|
dest: PlaceRef<'tcx>,
|
||||||
|
|
|
@ -13,10 +13,10 @@ use rustc::mir;
|
||||||
use asm;
|
use asm;
|
||||||
use builder::Builder;
|
use builder::Builder;
|
||||||
|
|
||||||
use super::MirContext;
|
use super::FunctionCx;
|
||||||
use super::LocalRef;
|
use super::LocalRef;
|
||||||
|
|
||||||
impl<'a, 'tcx> MirContext<'a, 'tcx> {
|
impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
||||||
pub fn trans_statement(&mut self,
|
pub fn trans_statement(&mut self,
|
||||||
bx: Builder<'a, 'tcx>,
|
bx: Builder<'a, 'tcx>,
|
||||||
statement: &mir::Statement<'tcx>)
|
statement: &mir::Statement<'tcx>)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue