diff --git a/Cargo.lock b/Cargo.lock index 9a940e3d0430..efe7f3792d34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,22 +32,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cranelift-bforest" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ - "cranelift-entity 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", ] [[package]] name = "cranelift-codegen" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-bforest 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-codegen-meta 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-codegen-shared 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-entity 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-bforest 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen-meta 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen-shared 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", "gimli 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -57,29 +57,29 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ - "cranelift-codegen-shared 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-entity 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen-shared 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", ] [[package]] name = "cranelift-codegen-shared" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" [[package]] name = "cranelift-entity" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" [[package]] name = "cranelift-frontend" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ - "cranelift-codegen 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -87,44 +87,44 @@ dependencies = [ [[package]] name = "cranelift-module" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ - "cranelift-codegen 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-entity 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-native" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ - "cranelift-codegen 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", "raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-object" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ - "cranelift-codegen 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-module 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-module 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", "object 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cranelift-simplejit" -version = "0.56.0" -source = "git+https://github.com/bytecodealliance/cranelift/#c73c3e8441efcb6324f18a22679e43e4bbd174cc" +version = "0.58.0" +source = "git+https://github.com/bytecodealliance/cranelift/#280fd1e13b5cdad9d9d308b78bb94b0476f2d9f0" dependencies = [ - "cranelift-codegen 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-module 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-native 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-module 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-native 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -282,11 +282,11 @@ version = "0.1.0" dependencies = [ "ar 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cranelift-codegen 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-frontend 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-module 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-object 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", - "cranelift-simplejit 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-frontend 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-module 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-object 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", + "cranelift-simplejit 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)", "gimli 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -407,16 +407,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -"checksum cranelift-bforest 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-codegen 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-codegen-meta 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-codegen-shared 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-entity 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-frontend 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-module 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-native 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-object 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" -"checksum cranelift-simplejit 0.56.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-bforest 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-codegen 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-codegen-meta 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-codegen-shared 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-entity 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-frontend 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-module 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-native 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-object 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" +"checksum cranelift-simplejit 0.58.0 (git+https://github.com/bytecodealliance/cranelift/)" = "" "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" "checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" "checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" diff --git a/src/abi/mod.rs b/src/abi/mod.rs index 6d254abb2bf9..568165bc61d8 100644 --- a/src/abi/mod.rs +++ b/src/abi/mod.rs @@ -288,13 +288,13 @@ fn local_place<'tcx>( fx.local_map[&local] } -pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb: Ebb) { +pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_block: Block) { let ssa_analyzed = crate::analyze::analyze(fx); #[cfg(debug_assertions)] self::comments::add_args_header_comment(fx); - self::returning::codegen_return_param(fx, &ssa_analyzed, start_ebb); + self::returning::codegen_return_param(fx, &ssa_analyzed, start_block); // None means pass_mode == NoPass enum ArgKind<'tcx> { @@ -322,13 +322,13 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb: let mut params = Vec::new(); for (i, arg_ty) in tupled_arg_tys.types().enumerate() { - let param = cvalue_for_param(fx, start_ebb, Some(local), Some(i), arg_ty); + let param = cvalue_for_param(fx, start_block, Some(local), Some(i), arg_ty); params.push(param); } (local, ArgKind::Spread(params), arg_ty) } else { - let param = cvalue_for_param(fx, start_ebb, Some(local), None, arg_ty); + let param = cvalue_for_param(fx, start_block, Some(local), None, arg_ty); (local, ArgKind::Normal(param), arg_ty) } }) @@ -337,10 +337,10 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb: assert!(fx.caller_location.is_none()); if fx.instance.def.requires_caller_location(fx.tcx) { // Store caller location for `#[track_caller]`. - fx.caller_location = Some(cvalue_for_param(fx, start_ebb, None, None, fx.tcx.caller_location_ty()).unwrap()); + fx.caller_location = Some(cvalue_for_param(fx, start_block, None, None, fx.tcx.caller_location_ty()).unwrap()); } - fx.bcx.switch_to_block(start_ebb); + fx.bcx.switch_to_block(start_block); fx.bcx.ins().nop(); #[cfg(debug_assertions)] @@ -416,7 +416,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.block_map.get(START_BLOCK).unwrap(), &[]); } pub fn codegen_terminator_call<'tcx>( @@ -458,8 +458,8 @@ pub fn codegen_terminator_call<'tcx>( InstanceDef::DropGlue(_, None) => { // empty drop glue - a nop. let (_, dest) = destination.expect("Non terminating drop_in_place_real???"); - let ret_ebb = fx.get_ebb(dest); - fx.bcx.ins().jump(ret_ebb, &[]); + let ret_block = fx.get_block(dest); + fx.bcx.ins().jump(ret_block, &[]); return; } _ => {} @@ -498,8 +498,8 @@ pub fn codegen_terminator_call<'tcx>( ); if let Some((_, dest)) = destination { - let ret_ebb = fx.get_ebb(dest); - fx.bcx.ins().jump(ret_ebb, &[]); + let ret_block = fx.get_block(dest); + fx.bcx.ins().jump(ret_block, &[]); } else { trap_unreachable(fx, "[corruption] Diverging function returned"); } @@ -513,7 +513,7 @@ fn codegen_call_inner<'tcx>( args: Vec>, ret_place: Option>, ) { - // FIXME mark the current ebb as cold when calling a `#[cold]` function. + // FIXME mark the current block as cold when calling a `#[cold]` function. let fn_sig = fx .tcx .normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &fn_ty.fn_sig(fx.tcx)); diff --git a/src/abi/pass_mode.rs b/src/abi/pass_mode.rs index bbb231ed8b74..3c19787ef925 100644 --- a/src/abi/pass_mode.rs +++ b/src/abi/pass_mode.rs @@ -129,7 +129,7 @@ pub(super) fn adjust_arg_for_abi<'tcx>( pub(super) fn cvalue_for_param<'tcx>( fx: &mut FunctionCx<'_, 'tcx, impl Backend>, - start_ebb: Ebb, + start_block: Block, local: Option, local_field: Option, arg_ty: Ty<'tcx>, @@ -142,7 +142,7 @@ pub(super) fn cvalue_for_param<'tcx>( } let clif_types = pass_mode.get_param_ty(fx.tcx); - let ebb_params = clif_types.map(|t| fx.bcx.append_ebb_param(start_ebb, t)); + let block_params = clif_types.map(|t| fx.bcx.append_block_param(start_block, t)); #[cfg(debug_assertions)] crate::abi::comments::add_arg_comment( @@ -150,21 +150,21 @@ pub(super) fn cvalue_for_param<'tcx>( "arg", local, local_field, - ebb_params, + block_params, pass_mode, arg_ty, ); match pass_mode { PassMode::NoPass => unreachable!(), - PassMode::ByVal(_) => Some(CValue::by_val(ebb_params.assert_single(), layout)), + PassMode::ByVal(_) => Some(CValue::by_val(block_params.assert_single(), layout)), PassMode::ByValPair(_, _) => { - let (a, b) = ebb_params.assert_pair(); + let (a, b) = block_params.assert_pair(); Some(CValue::by_val_pair(a, b, layout)) } - PassMode::ByRef { sized: true } => Some(CValue::by_ref(Pointer::new(ebb_params.assert_single()), layout)), + PassMode::ByRef { sized: true } => Some(CValue::by_ref(Pointer::new(block_params.assert_single()), layout)), PassMode::ByRef { sized: false } => { - let (ptr, meta) = ebb_params.assert_pair(); + let (ptr, meta) = block_params.assert_pair(); Some(CValue::by_ref_unsized(Pointer::new(ptr), meta, layout)) } } diff --git a/src/abi/returning.rs b/src/abi/returning.rs index d76711173f11..b4dd04002cf8 100644 --- a/src/abi/returning.rs +++ b/src/abi/returning.rs @@ -16,7 +16,7 @@ pub fn can_return_to_ssa_var<'tcx>(tcx: TyCtxt<'tcx>, dest_layout: TyLayout<'tcx pub(super) fn codegen_return_param( fx: &mut FunctionCx, ssa_analyzed: &rustc_index::vec::IndexVec, - start_ebb: Ebb, + start_block: Block, ) { let ret_layout = return_layout(fx); let ret_pass_mode = get_pass_mode(fx.tcx, ret_layout); @@ -34,7 +34,7 @@ pub(super) fn codegen_return_param( Empty } PassMode::ByRef { sized: true } => { - let ret_param = fx.bcx.append_ebb_param(start_ebb, fx.pointer_type); + let ret_param = fx.bcx.append_block_param(start_block, fx.pointer_type); fx.local_map .insert(RETURN_PLACE, CPlace::for_ptr(Pointer::new(ret_param), ret_layout)); diff --git a/src/allocator.rs b/src/allocator.rs index df9e6aa19628..8405096f32b4 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -78,11 +78,11 @@ fn codegen_inner(module: &mut Module, kind: AllocatorKin let mut func_ctx = FunctionBuilderContext::new(); let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx); - let ebb = bcx.create_ebb(); - bcx.switch_to_block(ebb); + let block = bcx.create_block(); + bcx.switch_to_block(block); let args = arg_tys .into_iter() - .map(|ty| bcx.append_ebb_param(ebb, ty)) + .map(|ty| bcx.append_block_param(block, ty)) .collect::>(); let callee_func_ref = module.declare_func_in_func(callee_func_id, &mut bcx.func); diff --git a/src/base.rs b/src/base.rs index a0add9b202f1..644a66bb31a9 100644 --- a/src/base.rs +++ b/src/base.rs @@ -29,9 +29,9 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>( let mut func_ctx = FunctionBuilderContext::new(); let mut bcx = FunctionBuilder::new(&mut context.func, &mut func_ctx); - // Predefine ebb's - let start_ebb = bcx.create_ebb(); - let ebb_map: IndexVec = (0..mir.basic_blocks().len()).map(|_| bcx.create_ebb()).collect(); + // Predefine block's + let start_block = bcx.create_block(); + let block_map: IndexVec = (0..mir.basic_blocks().len()).map(|_| bcx.create_block()).collect(); // Make FunctionCx let pointer_type = cx.module.target_config().pointer_type(); @@ -46,10 +46,10 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>( mir, bcx, - ebb_map, + block_map, local_map: HashMap::new(), caller_location: None, // set by `codegen_fn_prelude` - cold_ebbs: EntitySet::new(), + cold_blocks: EntitySet::new(), clif_comments, constants_cx: &mut cx.constants_cx, @@ -58,13 +58,13 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>( }; if fx.mir.args_iter().any(|arg| fx.layout_of(fx.monomorphize(&fx.mir.local_decls[arg].ty)).abi.is_uninhabited()) { - let entry_block = fx.bcx.create_ebb(); - fx.bcx.append_ebb_params_for_function_params(entry_block); + let entry_block = fx.bcx.create_block(); + fx.bcx.append_block_params_for_function_params(entry_block); fx.bcx.switch_to_block(entry_block); crate::trap::trap_unreachable(&mut fx, "function has uninhabited argument"); } else { tcx.sess.time("codegen clif ir", || { - tcx.sess.time("codegen prelude", || crate::abi::codegen_fn_prelude(&mut fx, start_ebb)); + tcx.sess.time("codegen prelude", || crate::abi::codegen_fn_prelude(&mut fx, start_block)); codegen_fn_content(&mut fx); }); } @@ -74,7 +74,7 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>( let mut clif_comments = fx.clif_comments; let source_info_set = fx.source_info_set; let local_map = fx.local_map; - let cold_ebbs = fx.cold_ebbs; + let cold_blocks = fx.cold_blocks; #[cfg(debug_assertions)] crate::pretty_clif::write_clif_file(cx.tcx, "unopt", instance, &context.func, &clif_comments, None); @@ -84,7 +84,7 @@ pub fn trans_fn<'clif, 'tcx, B: Backend + 'static>( // Perform rust specific optimizations tcx.sess.time("optimize clif ir", || { - crate::optimize::optimize_function(tcx, instance, context, &cold_ebbs, &mut clif_comments); + crate::optimize::optimize_function(tcx, instance, context, &cold_blocks, &mut clif_comments); }); // Define function @@ -142,22 +142,22 @@ pub fn verify_func(tcx: TyCtxt, writer: &crate::pretty_clif::CommentWriter, func fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) { for (bb, bb_data) in fx.mir.basic_blocks().iter_enumerated() { - let ebb = fx.get_ebb(bb); - fx.bcx.switch_to_block(ebb); + let block = fx.get_block(bb); + fx.bcx.switch_to_block(block); if bb_data.is_cleanup { // Unwinding after panicking is not supported continue; // FIXME once unwinding is supported uncomment next lines - // // Unwinding is unlikely to happen, so mark cleanup ebb's as cold. - // fx.cold_ebbs.insert(ebb); + // // Unwinding is unlikely to happen, so mark cleanup block's as cold. + // fx.cold_blocks.insert(block); } fx.bcx.ins().nop(); for stmt in &bb_data.statements { fx.set_debug_loc(stmt.source_info); - trans_stmt(fx, ebb, stmt); + trans_stmt(fx, block, stmt); } #[cfg(debug_assertions)] @@ -168,7 +168,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) { .kind .fmt_head(&mut terminator_head) .unwrap(); - let inst = fx.bcx.func.layout.last_inst(ebb).unwrap(); + let inst = fx.bcx.func.layout.last_inst(block).unwrap(); fx.add_comment(inst, terminator_head); } @@ -176,8 +176,8 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) { match &bb_data.terminator().kind { TerminatorKind::Goto { target } => { - let ebb = fx.get_ebb(*target); - fx.bcx.ins().jump(ebb, &[]); + let block = fx.get_block(*target); + fx.bcx.ins().jump(block, &[]); } TerminatorKind::Return => { crate::abi::codegen_return(fx); @@ -191,16 +191,16 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) { } => { if !fx.tcx.sess.overflow_checks() { if let mir::AssertKind::OverflowNeg = *msg { - let target = fx.get_ebb(*target); + let target = fx.get_block(*target); fx.bcx.ins().jump(target, &[]); continue; } } let cond = trans_operand(fx, cond).load_scalar(fx); - let target = fx.get_ebb(*target); - let failure = fx.bcx.create_ebb(); - fx.cold_ebbs.insert(failure); + let target = fx.get_block(*target); + let failure = fx.bcx.create_block(); + fx.cold_blocks.insert(failure); if *expected { fx.bcx.ins().brz(cond, failure, &[]); @@ -229,11 +229,11 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) { let discr = trans_operand(fx, discr).load_scalar(fx); let mut switch = ::cranelift_frontend::Switch::new(); for (i, value) in values.iter().enumerate() { - let ebb = fx.get_ebb(targets[i]); - switch.set_entry(*value as u64, ebb); + let block = fx.get_block(targets[i]); + switch.set_entry(*value as u64, block); } - let otherwise_ebb = fx.get_ebb(targets[targets.len() - 1]); - switch.emit(&mut fx.bcx, discr, otherwise_ebb); + let otherwise_block = fx.get_block(targets[targets.len() - 1]); + switch.emit(&mut fx.bcx, discr, otherwise_block); } TerminatorKind::Call { func, @@ -271,8 +271,8 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) { let drop_place = trans_place(fx, location); crate::abi::codegen_drop(fx, bb_data.terminator().source_info.span, drop_place); - let target_ebb = fx.get_ebb(*target); - fx.bcx.ins().jump(target_ebb, &[]); + let target_block = fx.get_block(*target); + fx.bcx.ins().jump(target_block, &[]); } }; } @@ -283,7 +283,7 @@ fn codegen_fn_content(fx: &mut FunctionCx<'_, '_, impl Backend>) { fn trans_stmt<'tcx>( fx: &mut FunctionCx<'_, 'tcx, impl Backend>, - cur_ebb: Ebb, + cur_block: Block, stmt: &Statement<'tcx>, ) { let _print_guard = PrintOnPanic(|| format!("stmt {:?}", stmt)); @@ -294,7 +294,7 @@ fn trans_stmt<'tcx>( match &stmt.kind { StatementKind::StorageLive(..) | StatementKind::StorageDead(..) => {} // Those are not very useful _ => { - let inst = fx.bcx.func.layout.last_inst(cur_ebb).unwrap(); + let inst = fx.bcx.func.layout.last_inst(cur_block).unwrap(); fx.add_comment(inst, format!("{:?}", stmt)); } } diff --git a/src/common.rs b/src/common.rs index a1d0203828e1..374ad0acee53 100644 --- a/src/common.rs +++ b/src/common.rs @@ -264,14 +264,14 @@ pub struct FunctionCx<'clif, 'tcx, B: Backend + 'static> { pub mir: &'tcx Body<'tcx>, pub bcx: FunctionBuilder<'clif>, - pub ebb_map: IndexVec, + pub block_map: IndexVec, pub local_map: HashMap>, /// When `#[track_caller]` is used, the implicit caller location is stored in this variable. pub caller_location: Option>, /// See [crate::optimize::code_layout] for more information. - pub cold_ebbs: EntitySet, + pub cold_blocks: EntitySet, pub clif_comments: crate::pretty_clif::CommentWriter, pub constants_cx: &'clif mut crate::constant::ConstantCx, @@ -325,7 +325,7 @@ impl<'tcx, B: Backend + 'static> HasTargetSpec for FunctionCx<'_, 'tcx, B> { impl<'tcx, B: Backend> BackendTypes for FunctionCx<'_, 'tcx, B> { type Value = Value; type Function = Value; - type BasicBlock = Ebb; + type BasicBlock = Block; type Type = Type; type Funclet = !; type DIScope = !; @@ -348,8 +348,8 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> { clif_type_from_ty(self.tcx, ty) } - pub fn get_ebb(&self, bb: BasicBlock) -> Ebb { - *self.ebb_map.get(bb).unwrap() + pub fn get_block(&self, bb: BasicBlock) -> Block { + *self.block_map.get(bb).unwrap() } pub fn get_local_place(&mut self, local: Local) -> CPlace<'tcx> { diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs index 3152e4812f75..7a3ac0991c41 100644 --- a/src/debuginfo/line_info.rs +++ b/src/debuginfo/line_info.rs @@ -118,8 +118,8 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> { let encinfo = isa.encoding_info(); let func = &context.func; - let mut ebbs = func.layout.ebbs().collect::>(); - ebbs.sort_by_key(|ebb| func.offsets[*ebb]); // Ensure inst offsets always increase + let mut blocks = func.layout.blocks().collect::>(); + blocks.sort_by_key(|block| func.offsets[*block]); // Ensure inst offsets always increase let line_strings = &mut self.debug_context.dwarf.line_strings; let mut last_file = None; @@ -147,8 +147,8 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> { }; let mut end = 0; - for ebb in ebbs { - for (offset, inst, size) in func.inst_offsets(ebb, &encinfo) { + for block in blocks { + for (offset, inst, size) in func.inst_offsets(block, &encinfo) { let srcloc = func.srclocs[inst]; line_program.row().address_offset = offset as u64; if !srcloc.is_default() { diff --git a/src/intrinsics/llvm.rs b/src/intrinsics/llvm.rs index 5b3deb52baad..b30f3b8f8dbd 100644 --- a/src/intrinsics/llvm.rs +++ b/src/intrinsics/llvm.rs @@ -97,8 +97,8 @@ pub fn codegen_llvm_intrinsic_call<'tcx>( } if let Some((_, dest)) = destination { - let ret_ebb = fx.get_ebb(dest); - fx.bcx.ins().jump(ret_ebb, &[]); + let ret_block = fx.get_block(dest); + fx.bcx.ins().jump(ret_block, &[]); } else { trap_unreachable(fx, "[corruption] Diverging intrinsic returned."); } diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 7470b55366c2..d23d28dccd2b 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -87,8 +87,8 @@ macro call_intrinsic_match { $ret.write_cvalue($fx, res); if let Some((_, dest)) = $destination { - let ret_ebb = $fx.get_ebb(dest); - $fx.bcx.ins().jump(ret_ebb, &[]); + let ret_block = $fx.get_block(dest); + $fx.bcx.ins().jump(ret_block, &[]); return; } else { unreachable!(); @@ -369,8 +369,8 @@ pub fn codegen_intrinsic_call<'tcx>( if intrinsic.starts_with("simd_") { self::simd::codegen_simd_intrinsic_call(fx, instance, args, ret, span); - let ret_ebb = fx.get_ebb(destination.expect("SIMD intrinsics don't diverge").1); - fx.bcx.ins().jump(ret_ebb, &[]); + let ret_block = fx.get_block(destination.expect("SIMD intrinsics don't diverge").1); + fx.bcx.ins().jump(ret_block, &[]); return; } @@ -992,8 +992,8 @@ pub fn codegen_intrinsic_call<'tcx>( } if let Some((_, dest)) = destination { - let ret_ebb = fx.get_ebb(dest); - fx.bcx.ins().jump(ret_ebb, &[]); + let ret_block = fx.get_block(dest); + fx.bcx.ins().jump(ret_block, &[]); } else { trap_unreachable(fx, "[corruption] Diverging intrinsic returned."); } diff --git a/src/lib.rs b/src/lib.rs index ad2ad82f0f20..21fca3c89f69 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -98,7 +98,7 @@ mod prelude { pub use cranelift_codegen::Context; pub use cranelift_codegen::entity::EntitySet; - pub use cranelift_codegen::ir::{AbiParam, Ebb, ExternalName, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value}; + pub use cranelift_codegen::ir::{AbiParam, Block, ExternalName, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value}; pub use cranelift_codegen::ir::condcodes::{FloatCC, IntCC}; pub use cranelift_codegen::ir::function::Function; pub use cranelift_codegen::ir::immediates::{Ieee32, Ieee64}; diff --git a/src/main_shim.rs b/src/main_shim.rs index b7c1425a1af5..fc3f9734874e 100644 --- a/src/main_shim.rs +++ b/src/main_shim.rs @@ -62,10 +62,10 @@ pub fn maybe_create_entry_wrapper(tcx: TyCtxt<'_>, module: &mut Module) { - // FIXME Move the ebb in place instead of remove and append once +pub(super) fn optimize_function(ctx: &mut Context, cold_blocks: &EntitySet) { + // FIXME Move the block in place instead of remove and append once // bytecodealliance/cranelift#1339 is implemented. - let mut ebb_insts = HashMap::new(); - for ebb in cold_ebbs.keys().filter(|&ebb| cold_ebbs.contains(ebb)) { - let insts = ctx.func.layout.ebb_insts(ebb).collect::>(); + let mut block_insts = HashMap::new(); + for block in cold_blocks.keys().filter(|&block| cold_blocks.contains(block)) { + let insts = ctx.func.layout.block_insts(block).collect::>(); for &inst in &insts { ctx.func.layout.remove_inst(inst); } - ebb_insts.insert(ebb, insts); - ctx.func.layout.remove_ebb(ebb); + block_insts.insert(block, insts); + ctx.func.layout.remove_block(block); } // And then append them at the back again. - for ebb in cold_ebbs.keys().filter(|&ebb| cold_ebbs.contains(ebb)) { - ctx.func.layout.append_ebb(ebb); - for inst in ebb_insts.remove(&ebb).unwrap() { - ctx.func.layout.append_inst(inst, ebb); + for block in cold_blocks.keys().filter(|&block| cold_blocks.contains(block)) { + ctx.func.layout.append_block(block); + for inst in block_insts.remove(&block).unwrap() { + ctx.func.layout.append_inst(inst, block); } } } diff --git a/src/optimize/mod.rs b/src/optimize/mod.rs index ba9839e84be1..23c14a57c56a 100644 --- a/src/optimize/mod.rs +++ b/src/optimize/mod.rs @@ -7,11 +7,11 @@ pub fn optimize_function<'tcx>( tcx: TyCtxt<'tcx>, instance: Instance<'tcx>, ctx: &mut Context, - cold_ebbs: &EntitySet, + cold_blocks: &EntitySet, clif_comments: &mut crate::pretty_clif::CommentWriter, ) { // The code_layout optimization is very cheap. - self::code_layout::optimize_function(ctx, cold_ebbs); + self::code_layout::optimize_function(ctx, cold_blocks); if tcx.sess.opts.optimize == rustc_session::config::OptLevel::No { return; // FIXME classify optimizations over opt levels diff --git a/src/optimize/stack2reg.rs b/src/optimize/stack2reg.rs index 8fa5fb13c2eb..acce3a6465b7 100644 --- a/src/optimize/stack2reg.rs +++ b/src/optimize/stack2reg.rs @@ -116,7 +116,7 @@ impl<'a> OptimizeContext<'a> { let mut stack_slot_usage_map = BTreeMap::::new(); let mut cursor = FuncCursor::new(&mut ctx.func); - while let Some(_ebb) = cursor.next_ebb() { + while let Some(_block) = cursor.next_block() { while let Some(inst) = cursor.next_inst() { match cursor.func.dfg[inst] { InstructionData::StackLoad { @@ -249,7 +249,7 @@ pub(super) fn optimize_function( fn combine_stack_addr_with_load_store(func: &mut Function) { // Turn load and store into stack_load and stack_store when possible. let mut cursor = FuncCursor::new(func); - while let Some(_ebb) = cursor.next_ebb() { + while let Some(_block) = cursor.next_block() { while let Some(inst) = cursor.next_inst() { match cursor.func.dfg[inst] { InstructionData::Load { opcode: Opcode::Load, arg: addr, flags: _, offset } => { @@ -284,7 +284,7 @@ fn remove_unused_stack_addr_and_stack_load(opt_ctx: &mut OptimizeContext) { let mut stack_addr_load_insts_users = HashMap::>::new(); let mut cursor = FuncCursor::new(&mut opt_ctx.ctx.func); - while let Some(_ebb) = cursor.next_ebb() { + while let Some(_block) = cursor.next_block() { while let Some(inst) = cursor.next_inst() { for &arg in cursor.func.dfg.inst_args(inst) { if let ValueDef::Result(arg_origin, 0) = cursor.func.dfg.value_def(arg) { diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs index 06be1636f802..e619be41cb18 100644 --- a/src/pretty_clif.rs +++ b/src/pretty_clif.rs @@ -38,14 +38,14 @@ use crate::prelude::*; /// sig1 = (i64, i64, i64) system_v /// fn0 = colocated u0:6 sig1 ; Instance { def: Item(DefId(0/0:31 ~ example[8787]::{{impl}}[1]::call_mut[0])), substs: [ReErased, ReErased] } /// -/// ebb0(v0: i64, v1: i64, v2: i64): +/// block0(v0: i64, v1: i64, v2: i64): /// v3 = stack_addr.i64 ss0 /// v4 = stack_addr.i64 ss1 /// store v2, v4 /// v5 = stack_addr.i64 ss2 -/// jump ebb1 +/// jump block1 /// -/// ebb1: +/// block1: /// nop /// ; _3 = &mut _1 /// ; _4 = _2 @@ -55,9 +55,9 @@ use crate::prelude::*; /// ; _0 = const mini_core::FnMut::call_mut(move _3, move _4) /// v7 = load.i64 v5 /// call fn0(v0, v3, v7) -/// jump ebb2 +/// jump block2 /// -/// ebb2: +/// block2: /// nop /// ; /// ; return @@ -136,15 +136,15 @@ impl FuncWriter for &'_ CommentWriter { } } - fn write_ebb_header( + fn write_block_header( &mut self, w: &mut dyn fmt::Write, func: &Function, isa: Option<&dyn isa::TargetIsa>, - ebb: Ebb, + block: Block, indent: usize, ) -> fmt::Result { - PlainWriter.write_ebb_header(w, func, isa, ebb, indent) + PlainWriter.write_block_header(w, func, isa, block, indent) } fn write_instruction( diff --git a/src/value_and_place.rs b/src/value_and_place.rs index 882eb82f5aaa..cc194e1c91ea 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -382,12 +382,12 @@ impl<'tcx> CPlace<'tcx> { #[cfg(debug_assertions)] { use cranelift_codegen::cursor::{Cursor, CursorPosition}; - let cur_ebb = match fx.bcx.cursor().position() { - CursorPosition::After(ebb) => ebb, + let cur_block = match fx.bcx.cursor().position() { + CursorPosition::After(block) => block, _ => unreachable!(), }; fx.add_comment( - fx.bcx.func.layout.last_inst(cur_ebb).unwrap(), + fx.bcx.func.layout.last_inst(cur_block).unwrap(), format!("write_cvalue: {:?} <- {:?}",self, from), ); }