Builder.build_new_block -> Builder.build_sibling_block
This commit is contained in:
parent
81e8137b0d
commit
901984e1d1
@ -80,18 +80,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_new_block<'b>(&self, name: &'b str) -> Builder<'a, 'tcx> {
|
||||
let builder = Builder::with_ccx(self.ccx);
|
||||
let llbb = unsafe {
|
||||
let name = CString::new(name).unwrap();
|
||||
llvm::LLVMAppendBasicBlockInContext(
|
||||
self.ccx.llcx(),
|
||||
self.llfn(),
|
||||
name.as_ptr()
|
||||
)
|
||||
};
|
||||
builder.position_at_end(llbb);
|
||||
builder
|
||||
pub fn build_sibling_block<'b>(&self, name: &'b str) -> Builder<'a, 'tcx> {
|
||||
Builder::new_block(self.ccx, self.llfn(), name)
|
||||
}
|
||||
|
||||
pub fn sess(&self) -> &Session {
|
||||
|
@ -370,7 +370,7 @@ fn trans_fn_once_adapter_shim<'a, 'tcx>(
|
||||
let llfn = callee.reify(bcx.ccx);
|
||||
let llret;
|
||||
if let Some(landing_pad) = self_scope.landing_pad {
|
||||
let normal_bcx = bcx.build_new_block("normal-return");
|
||||
let normal_bcx = bcx.build_sibling_block("normal-return");
|
||||
llret = bcx.invoke(llfn, &llargs[..], normal_bcx.llbb(), landing_pad, None);
|
||||
bcx = normal_bcx;
|
||||
} else {
|
||||
|
@ -54,7 +54,7 @@ impl<'tcx> DropValue<'tcx> {
|
||||
/// This should only be called once per function, as it creates an alloca for the landingpad.
|
||||
fn get_landing_pad<'a>(&self, bcx: &Builder<'a, 'tcx>) -> BasicBlockRef {
|
||||
debug!("get_landing_pad");
|
||||
let bcx = bcx.build_new_block("cleanup_unwind");
|
||||
let bcx = bcx.build_sibling_block("cleanup_unwind");
|
||||
let llpersonality = bcx.ccx.eh_personality();
|
||||
bcx.set_personality_fn(llpersonality);
|
||||
|
||||
|
@ -263,7 +263,7 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKi
|
||||
let llret;
|
||||
let args = &[ptr.llval, ptr.llextra][..1 + ptr.has_extra() as usize];
|
||||
if let Some(landing_pad) = contents_scope.landing_pad {
|
||||
let normal_bcx = bcx.build_new_block("normal-return");
|
||||
let normal_bcx = bcx.build_sibling_block("normal-return");
|
||||
llret = bcx.invoke(callee.reify(ccx), args, normal_bcx.llbb(), landing_pad, None);
|
||||
bcx = normal_bcx;
|
||||
} else {
|
||||
@ -503,15 +503,15 @@ fn drop_structural_ty<'a, 'tcx>(cx: Builder<'a, 'tcx>, ptr: LvalueRef<'tcx>) ->
|
||||
// from the outer function, and any other use case will only
|
||||
// call this for an already-valid enum in which case the `ret
|
||||
// void` will never be hit.
|
||||
let ret_void_cx = cx.build_new_block("enum-iter-ret-void");
|
||||
let ret_void_cx = cx.build_sibling_block("enum-iter-ret-void");
|
||||
ret_void_cx.ret_void();
|
||||
let llswitch = cx.switch(lldiscrim_a, ret_void_cx.llbb(), n_variants);
|
||||
let next_cx = cx.build_new_block("enum-iter-next");
|
||||
let next_cx = cx.build_sibling_block("enum-iter-next");
|
||||
|
||||
for (i, variant) in adt.variants.iter().enumerate() {
|
||||
let variant_cx_name = format!("enum-iter-variant-{}",
|
||||
&variant.disr_val.to_string());
|
||||
let variant_cx = cx.build_new_block(&variant_cx_name);
|
||||
let variant_cx = cx.build_sibling_block(&variant_cx_name);
|
||||
let case_val = adt::trans_case(&cx, t, Disr::from(variant.disr_val));
|
||||
variant_cx.add_case(llswitch, case_val, variant_cx.llbb());
|
||||
iter_variant(&variant_cx, ptr, &adt, i, substs);
|
||||
|
@ -718,10 +718,10 @@ fn trans_msvc_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
|
||||
|
||||
bcx.set_personality_fn(bcx.ccx.eh_personality());
|
||||
|
||||
let normal = bcx.build_new_block("normal");
|
||||
let catchswitch = bcx.build_new_block("catchswitch");
|
||||
let catchpad = bcx.build_new_block("catchpad");
|
||||
let caught = bcx.build_new_block("caught");
|
||||
let normal = bcx.build_sibling_block("normal");
|
||||
let catchswitch = bcx.build_sibling_block("catchswitch");
|
||||
let catchpad = bcx.build_sibling_block("catchpad");
|
||||
let caught = bcx.build_sibling_block("caught");
|
||||
|
||||
let func = llvm::get_param(bcx.llfn(), 0);
|
||||
let data = llvm::get_param(bcx.llfn(), 1);
|
||||
@ -837,8 +837,8 @@ fn trans_gnu_try<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
|
||||
// expected to be `*mut *mut u8` for this to actually work, but that's
|
||||
// managed by the standard library.
|
||||
|
||||
let then = bcx.build_new_block("then");
|
||||
let catch = bcx.build_new_block("catch");
|
||||
let then = bcx.build_sibling_block("then");
|
||||
let catch = bcx.build_sibling_block("catch");
|
||||
|
||||
let func = llvm::get_param(bcx.llfn(), 0);
|
||||
let data = llvm::get_param(bcx.llfn(), 1);
|
||||
|
@ -218,9 +218,9 @@ pub fn trans_mir<'a, 'tcx: 'a>(
|
||||
let block_bcxs: IndexVec<mir::BasicBlock, BasicBlockRef> =
|
||||
mir.basic_blocks().indices().map(|bb| {
|
||||
if bb == mir::START_BLOCK {
|
||||
bcx.build_new_block("start").llbb()
|
||||
bcx.build_sibling_block("start").llbb()
|
||||
} else {
|
||||
bcx.build_new_block(&format!("{:?}", bb)).llbb()
|
||||
bcx.build_sibling_block(&format!("{:?}", bb)).llbb()
|
||||
}
|
||||
}).collect();
|
||||
|
||||
|
@ -29,9 +29,9 @@ pub fn slice_for_each<'a, 'tcx, F>(
|
||||
bcx.inbounds_gep(a, &[b])
|
||||
};
|
||||
|
||||
let body_bcx = bcx.build_new_block("slice_loop_body");
|
||||
let next_bcx = bcx.build_new_block("slice_loop_next");
|
||||
let header_bcx = bcx.build_new_block("slice_loop_header");
|
||||
let body_bcx = bcx.build_sibling_block("slice_loop_body");
|
||||
let next_bcx = bcx.build_sibling_block("slice_loop_next");
|
||||
let header_bcx = bcx.build_sibling_block("slice_loop_header");
|
||||
|
||||
let start = if zst {
|
||||
C_uint(bcx.ccx, 0usize)
|
||||
|
Loading…
Reference in New Issue
Block a user