mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
parent
ff1c62365e
commit
ca92695a2c
@ -398,7 +398,7 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb:
|
||||
|
||||
fx.bcx
|
||||
.ins()
|
||||
.jump(*fx.ebb_map.get(&START_BLOCK).unwrap(), &[]);
|
||||
.jump(*fx.ebb_map.get(START_BLOCK).unwrap(), &[]);
|
||||
}
|
||||
|
||||
pub fn codegen_terminator_call<'tcx>(
|
||||
|
@ -1,4 +1,5 @@
|
||||
use rustc::ty::adjustment::PointerCast;
|
||||
use rustc_index::vec::IndexVec;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
@ -27,10 +28,7 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>(
|
||||
|
||||
// Predefine ebb's
|
||||
let start_ebb = bcx.create_ebb();
|
||||
let mut ebb_map: HashMap<BasicBlock, Ebb> = HashMap::new();
|
||||
for (bb, _bb_data) in mir.basic_blocks().iter_enumerated() {
|
||||
ebb_map.insert(bb, bcx.create_ebb());
|
||||
}
|
||||
let ebb_map: IndexVec<BasicBlock, Ebb> = (0..mir.basic_blocks().len()).map(|_| bcx.create_ebb()).collect();
|
||||
|
||||
// Make FunctionCx
|
||||
let pointer_type = cx.module.target_config().pointer_type();
|
||||
|
@ -1,5 +1,6 @@
|
||||
use rustc::ty::layout::{Integer, Primitive};
|
||||
use rustc_target::spec::{HasTargetSpec, Target};
|
||||
use rustc_index::vec::IndexVec;
|
||||
|
||||
use cranelift_codegen::ir::{InstructionData, Opcode, ValueDef};
|
||||
|
||||
@ -263,7 +264,7 @@ pub struct FunctionCx<'clif, 'tcx, B: Backend + 'static> {
|
||||
pub mir: &'tcx Body<'tcx>,
|
||||
|
||||
pub bcx: FunctionBuilder<'clif>,
|
||||
pub ebb_map: HashMap<BasicBlock, Ebb>,
|
||||
pub ebb_map: IndexVec<BasicBlock, Ebb>,
|
||||
pub local_map: HashMap<Local, CPlace<'tcx>>,
|
||||
|
||||
pub clif_comments: crate::pretty_clif::CommentWriter,
|
||||
@ -341,7 +342,7 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
|
||||
}
|
||||
|
||||
pub fn get_ebb(&self, bb: BasicBlock) -> Ebb {
|
||||
*self.ebb_map.get(&bb).unwrap()
|
||||
*self.ebb_map.get(bb).unwrap()
|
||||
}
|
||||
|
||||
pub fn get_local_place(&mut self, local: Local) -> CPlace<'tcx> {
|
||||
|
Loading…
Reference in New Issue
Block a user