Skip to content

Commit 430f738

Browse files
committed
Update Cranelift for basic blocks
1 parent b5b2ffa commit 430f738

17 files changed

+154
-154
lines changed

Cargo.lock

+51-51
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/abi/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ fn local_place<'tcx>(
288288
fx.local_map[&local]
289289
}
290290

291-
pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb: Ebb) {
291+
pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_block: Block) {
292292
let ssa_analyzed = crate::analyze::analyze(fx);
293293

294294
#[cfg(debug_assertions)]
295295
self::comments::add_args_header_comment(fx);
296296

297-
self::returning::codegen_return_param(fx, &ssa_analyzed, start_ebb);
297+
self::returning::codegen_return_param(fx, &ssa_analyzed, start_block);
298298

299299
// None means pass_mode == NoPass
300300
enum ArgKind<'tcx> {
@@ -322,13 +322,13 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb:
322322

323323
let mut params = Vec::new();
324324
for (i, arg_ty) in tupled_arg_tys.types().enumerate() {
325-
let param = cvalue_for_param(fx, start_ebb, Some(local), Some(i), arg_ty);
325+
let param = cvalue_for_param(fx, start_block, Some(local), Some(i), arg_ty);
326326
params.push(param);
327327
}
328328

329329
(local, ArgKind::Spread(params), arg_ty)
330330
} else {
331-
let param = cvalue_for_param(fx, start_ebb, Some(local), None, arg_ty);
331+
let param = cvalue_for_param(fx, start_block, Some(local), None, arg_ty);
332332
(local, ArgKind::Normal(param), arg_ty)
333333
}
334334
})
@@ -337,10 +337,10 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb:
337337
assert!(fx.caller_location.is_none());
338338
if fx.instance.def.requires_caller_location(fx.tcx) {
339339
// Store caller location for `#[track_caller]`.
340-
fx.caller_location = Some(cvalue_for_param(fx, start_ebb, None, None, fx.tcx.caller_location_ty()).unwrap());
340+
fx.caller_location = Some(cvalue_for_param(fx, start_block, None, None, fx.tcx.caller_location_ty()).unwrap());
341341
}
342342

343-
fx.bcx.switch_to_block(start_ebb);
343+
fx.bcx.switch_to_block(start_block);
344344
fx.bcx.ins().nop();
345345

346346
#[cfg(debug_assertions)]
@@ -416,7 +416,7 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_ebb:
416416

417417
fx.bcx
418418
.ins()
419-
.jump(*fx.ebb_map.get(START_BLOCK).unwrap(), &[]);
419+
.jump(*fx.block_map.get(START_BLOCK).unwrap(), &[]);
420420
}
421421

422422
pub fn codegen_terminator_call<'tcx>(
@@ -458,8 +458,8 @@ pub fn codegen_terminator_call<'tcx>(
458458
InstanceDef::DropGlue(_, None) => {
459459
// empty drop glue - a nop.
460460
let (_, dest) = destination.expect("Non terminating drop_in_place_real???");
461-
let ret_ebb = fx.get_ebb(dest);
462-
fx.bcx.ins().jump(ret_ebb, &[]);
461+
let ret_block = fx.get_block(dest);
462+
fx.bcx.ins().jump(ret_block, &[]);
463463
return;
464464
}
465465
_ => {}
@@ -498,8 +498,8 @@ pub fn codegen_terminator_call<'tcx>(
498498
);
499499

500500
if let Some((_, dest)) = destination {
501-
let ret_ebb = fx.get_ebb(dest);
502-
fx.bcx.ins().jump(ret_ebb, &[]);
501+
let ret_block = fx.get_block(dest);
502+
fx.bcx.ins().jump(ret_block, &[]);
503503
} else {
504504
trap_unreachable(fx, "[corruption] Diverging function returned");
505505
}
@@ -513,7 +513,7 @@ fn codegen_call_inner<'tcx>(
513513
args: Vec<CValue<'tcx>>,
514514
ret_place: Option<CPlace<'tcx>>,
515515
) {
516-
// FIXME mark the current ebb as cold when calling a `#[cold]` function.
516+
// FIXME mark the current block as cold when calling a `#[cold]` function.
517517
let fn_sig = fx
518518
.tcx
519519
.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &fn_ty.fn_sig(fx.tcx));

src/abi/pass_mode.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub(super) fn adjust_arg_for_abi<'tcx>(
129129

130130
pub(super) fn cvalue_for_param<'tcx>(
131131
fx: &mut FunctionCx<'_, 'tcx, impl Backend>,
132-
start_ebb: Ebb,
132+
start_block: Block,
133133
local: Option<mir::Local>,
134134
local_field: Option<usize>,
135135
arg_ty: Ty<'tcx>,
@@ -142,29 +142,29 @@ pub(super) fn cvalue_for_param<'tcx>(
142142
}
143143

144144
let clif_types = pass_mode.get_param_ty(fx.tcx);
145-
let ebb_params = clif_types.map(|t| fx.bcx.append_ebb_param(start_ebb, t));
145+
let block_params = clif_types.map(|t| fx.bcx.append_block_param(start_block, t));
146146

147147
#[cfg(debug_assertions)]
148148
crate::abi::comments::add_arg_comment(
149149
fx,
150150
"arg",
151151
local,
152152
local_field,
153-
ebb_params,
153+
block_params,
154154
pass_mode,
155155
arg_ty,
156156
);
157157

158158
match pass_mode {
159159
PassMode::NoPass => unreachable!(),
160-
PassMode::ByVal(_) => Some(CValue::by_val(ebb_params.assert_single(), layout)),
160+
PassMode::ByVal(_) => Some(CValue::by_val(block_params.assert_single(), layout)),
161161
PassMode::ByValPair(_, _) => {
162-
let (a, b) = ebb_params.assert_pair();
162+
let (a, b) = block_params.assert_pair();
163163
Some(CValue::by_val_pair(a, b, layout))
164164
}
165-
PassMode::ByRef { sized: true } => Some(CValue::by_ref(Pointer::new(ebb_params.assert_single()), layout)),
165+
PassMode::ByRef { sized: true } => Some(CValue::by_ref(Pointer::new(block_params.assert_single()), layout)),
166166
PassMode::ByRef { sized: false } => {
167-
let (ptr, meta) = ebb_params.assert_pair();
167+
let (ptr, meta) = block_params.assert_pair();
168168
Some(CValue::by_ref_unsized(Pointer::new(ptr), meta, layout))
169169
}
170170
}

src/abi/returning.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn can_return_to_ssa_var<'tcx>(tcx: TyCtxt<'tcx>, dest_layout: TyLayout<'tcx
1616
pub(super) fn codegen_return_param(
1717
fx: &mut FunctionCx<impl Backend>,
1818
ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
19-
start_ebb: Ebb,
19+
start_block: Block,
2020
) {
2121
let ret_layout = return_layout(fx);
2222
let ret_pass_mode = get_pass_mode(fx.tcx, ret_layout);
@@ -34,7 +34,7 @@ pub(super) fn codegen_return_param(
3434
Empty
3535
}
3636
PassMode::ByRef { sized: true } => {
37-
let ret_param = fx.bcx.append_ebb_param(start_ebb, fx.pointer_type);
37+
let ret_param = fx.bcx.append_block_param(start_block, fx.pointer_type);
3838
fx.local_map
3939
.insert(RETURN_PLACE, CPlace::for_ptr(Pointer::new(ret_param), ret_layout));
4040

src/allocator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ fn codegen_inner(module: &mut Module<impl Backend + 'static>, kind: AllocatorKin
7878
let mut func_ctx = FunctionBuilderContext::new();
7979
let mut bcx = FunctionBuilder::new(&mut ctx.func, &mut func_ctx);
8080

81-
let ebb = bcx.create_ebb();
82-
bcx.switch_to_block(ebb);
81+
let block = bcx.create_block();
82+
bcx.switch_to_block(block);
8383
let args = arg_tys
8484
.into_iter()
85-
.map(|ty| bcx.append_ebb_param(ebb, ty))
85+
.map(|ty| bcx.append_block_param(block, ty))
8686
.collect::<Vec<Value>>();
8787

8888
let callee_func_ref = module.declare_func_in_func(callee_func_id, &mut bcx.func);

0 commit comments

Comments
 (0)