Skip to content

Commit 209abc7

Browse files
committed
rustc_trans: rename bcx to bx.
1 parent e69dacb commit 209abc7

19 files changed

+906
-906
lines changed

src/librustc_trans/abi.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -555,20 +555,20 @@ impl<'a, 'tcx> ArgType<'tcx> {
555555
/// place for the original Rust type of this argument/return.
556556
/// Can be used for both storing formal arguments into Rust variables
557557
/// or results of call/invoke instructions into their destinations.
558-
pub fn store(&self, bcx: &Builder<'a, 'tcx>, val: ValueRef, dst: PlaceRef<'tcx>) {
558+
pub fn store(&self, bx: &Builder<'a, 'tcx>, val: ValueRef, dst: PlaceRef<'tcx>) {
559559
if self.is_ignore() {
560560
return;
561561
}
562-
let cx = bcx.cx;
562+
let cx = bx.cx;
563563
if self.is_indirect() {
564-
OperandValue::Ref(val, self.layout.align).store(bcx, dst)
564+
OperandValue::Ref(val, self.layout.align).store(bx, dst)
565565
} else if let PassMode::Cast(cast) = self.mode {
566566
// FIXME(eddyb): Figure out when the simpler Store is safe, clang
567567
// uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
568568
let can_store_through_cast_ptr = false;
569569
if can_store_through_cast_ptr {
570-
let cast_dst = bcx.pointercast(dst.llval, cast.llvm_type(cx).ptr_to());
571-
bcx.store(val, cast_dst, self.layout.align);
570+
let cast_dst = bx.pointercast(dst.llval, cast.llvm_type(cx).ptr_to());
571+
bx.store(val, cast_dst, self.layout.align);
572572
} else {
573573
// The actual return type is a struct, but the ABI
574574
// adaptation code has cast it into some scalar type. The
@@ -587,42 +587,42 @@ impl<'a, 'tcx> ArgType<'tcx> {
587587
// We instead thus allocate some scratch space...
588588
let scratch_size = cast.size(cx);
589589
let scratch_align = cast.align(cx);
590-
let llscratch = bcx.alloca(cast.llvm_type(cx), "abi_cast", scratch_align);
591-
bcx.lifetime_start(llscratch, scratch_size);
590+
let llscratch = bx.alloca(cast.llvm_type(cx), "abi_cast", scratch_align);
591+
bx.lifetime_start(llscratch, scratch_size);
592592

593593
// ...where we first store the value...
594-
bcx.store(val, llscratch, scratch_align);
594+
bx.store(val, llscratch, scratch_align);
595595

596596
// ...and then memcpy it to the intended destination.
597-
base::call_memcpy(bcx,
598-
bcx.pointercast(dst.llval, Type::i8p(cx)),
599-
bcx.pointercast(llscratch, Type::i8p(cx)),
597+
base::call_memcpy(bx,
598+
bx.pointercast(dst.llval, Type::i8p(cx)),
599+
bx.pointercast(llscratch, Type::i8p(cx)),
600600
C_usize(cx, self.layout.size.bytes()),
601601
self.layout.align.min(scratch_align));
602602

603-
bcx.lifetime_end(llscratch, scratch_size);
603+
bx.lifetime_end(llscratch, scratch_size);
604604
}
605605
} else {
606-
OperandValue::Immediate(val).store(bcx, dst);
606+
OperandValue::Immediate(val).store(bx, dst);
607607
}
608608
}
609609

610-
pub fn store_fn_arg(&self, bcx: &Builder<'a, 'tcx>, idx: &mut usize, dst: PlaceRef<'tcx>) {
610+
pub fn store_fn_arg(&self, bx: &Builder<'a, 'tcx>, idx: &mut usize, dst: PlaceRef<'tcx>) {
611611
if self.pad.is_some() {
612612
*idx += 1;
613613
}
614614
let mut next = || {
615-
let val = llvm::get_param(bcx.llfn(), *idx as c_uint);
615+
let val = llvm::get_param(bx.llfn(), *idx as c_uint);
616616
*idx += 1;
617617
val
618618
};
619619
match self.mode {
620620
PassMode::Ignore => {},
621621
PassMode::Pair(..) => {
622-
OperandValue::Pair(next(), next()).store(bcx, dst);
622+
OperandValue::Pair(next(), next()).store(bx, dst);
623623
}
624624
PassMode::Direct(_) | PassMode::Indirect(_) | PassMode::Cast(_) => {
625-
self.store(bcx, next(), dst);
625+
self.store(bx, next(), dst);
626626
}
627627
}
628628
}

src/librustc_trans/asm.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use libc::{c_uint, c_char};
2727

2828
// Take an inline assembly expression and splat it out via LLVM
2929
pub fn trans_inline_asm<'a, 'tcx>(
30-
bcx: &Builder<'a, 'tcx>,
30+
bx: &Builder<'a, 'tcx>,
3131
ia: &hir::InlineAsm,
3232
outputs: Vec<PlaceRef<'tcx>>,
3333
mut inputs: Vec<ValueRef>
@@ -39,13 +39,13 @@ pub fn trans_inline_asm<'a, 'tcx>(
3939
let mut indirect_outputs = vec![];
4040
for (i, (out, place)) in ia.outputs.iter().zip(&outputs).enumerate() {
4141
if out.is_rw {
42-
inputs.push(place.load(bcx).immediate());
42+
inputs.push(place.load(bx).immediate());
4343
ext_constraints.push(i.to_string());
4444
}
4545
if out.is_indirect {
46-
indirect_outputs.push(place.load(bcx).immediate());
46+
indirect_outputs.push(place.load(bx).immediate());
4747
} else {
48-
output_types.push(place.layout.llvm_type(bcx.cx));
48+
output_types.push(place.layout.llvm_type(bx.cx));
4949
}
5050
}
5151
if !indirect_outputs.is_empty() {
@@ -58,7 +58,7 @@ pub fn trans_inline_asm<'a, 'tcx>(
5858

5959
// Default per-arch clobbers
6060
// Basically what clang does
61-
let arch_clobbers = match &bcx.sess().target.target.arch[..] {
61+
let arch_clobbers = match &bx.sess().target.target.arch[..] {
6262
"x86" | "x86_64" => vec!["~{dirflag}", "~{fpsr}", "~{flags}"],
6363
_ => Vec::new()
6464
};
@@ -76,9 +76,9 @@ pub fn trans_inline_asm<'a, 'tcx>(
7676
// Depending on how many outputs we have, the return type is different
7777
let num_outputs = output_types.len();
7878
let output_type = match num_outputs {
79-
0 => Type::void(bcx.cx),
79+
0 => Type::void(bx.cx),
8080
1 => output_types[0],
81-
_ => Type::struct_(bcx.cx, &output_types, false)
81+
_ => Type::struct_(bx.cx, &output_types, false)
8282
};
8383

8484
let dialect = match ia.dialect {
@@ -88,7 +88,7 @@ pub fn trans_inline_asm<'a, 'tcx>(
8888

8989
let asm = CString::new(ia.asm.as_str().as_bytes()).unwrap();
9090
let constraint_cstr = CString::new(all_constraints).unwrap();
91-
let r = bcx.inline_asm_call(
91+
let r = bx.inline_asm_call(
9292
asm.as_ptr(),
9393
constraint_cstr.as_ptr(),
9494
&inputs,
@@ -101,21 +101,21 @@ pub fn trans_inline_asm<'a, 'tcx>(
101101
// Again, based on how many outputs we have
102102
let outputs = ia.outputs.iter().zip(&outputs).filter(|&(ref o, _)| !o.is_indirect);
103103
for (i, (_, &place)) in outputs.enumerate() {
104-
let v = if num_outputs == 1 { r } else { bcx.extract_value(r, i as u64) };
105-
OperandValue::Immediate(v).store(bcx, place);
104+
let v = if num_outputs == 1 { r } else { bx.extract_value(r, i as u64) };
105+
OperandValue::Immediate(v).store(bx, place);
106106
}
107107

108108
// Store mark in a metadata node so we can map LLVM errors
109109
// back to source locations. See #17552.
110110
unsafe {
111111
let key = "srcloc";
112-
let kind = llvm::LLVMGetMDKindIDInContext(bcx.cx.llcx,
112+
let kind = llvm::LLVMGetMDKindIDInContext(bx.cx.llcx,
113113
key.as_ptr() as *const c_char, key.len() as c_uint);
114114

115-
let val: llvm::ValueRef = C_i32(bcx.cx, ia.ctxt.outer().as_u32() as i32);
115+
let val: llvm::ValueRef = C_i32(bx.cx, ia.ctxt.outer().as_u32() as i32);
116116

117117
llvm::LLVMSetMetadata(r, kind,
118-
llvm::LLVMMDNodeInContext(bcx.cx.llcx, &val, 1));
118+
llvm::LLVMMDNodeInContext(bx.cx.llcx, &val, 1));
119119
}
120120
}
121121

0 commit comments

Comments
 (0)