Skip to content

Commit

Permalink
Rename static_bitcast to const_bitcast
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Nov 24, 2018
1 parent 01fad77 commit 36baa97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/librustc_codegen_llvm/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
if layout.value == layout::Pointer {
unsafe { llvm::LLVMConstIntToPtr(llval, llty) }
} else {
self.static_bitcast(llval, llty)
self.const_bitcast(llval, llty)
}
},
Scalar::Ptr(ptr) => {
Expand All @@ -336,14 +336,14 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
None => bug!("missing allocation {:?}", ptr.alloc_id),
};
let llval = unsafe { llvm::LLVMConstInBoundsGEP(
self.static_bitcast(base_addr, self.type_i8p()),
self.const_bitcast(base_addr, self.type_i8p()),
&self.const_usize(ptr.offset.bytes()),
1,
) };
if layout.value != layout::Pointer {
unsafe { llvm::LLVMConstPtrToInt(llval, llty) }
} else {
self.static_bitcast(llval, llty)
self.const_bitcast(llval, llty)
}
}
}
Expand All @@ -359,11 +359,11 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
let base_addr = self.static_addr_of(init, layout.align.abi, None);

let llval = unsafe { llvm::LLVMConstInBoundsGEP(
self.static_bitcast(base_addr, self.type_i8p()),
self.const_bitcast(base_addr, self.type_i8p()),
&self.const_usize(offset.bytes()),
1,
)};
let llval = self.static_bitcast(llval, self.type_ptr_to(layout.llvm_type(self)));
let llval = self.const_bitcast(llval, self.type_ptr_to(layout.llvm_type(self)));
PlaceRef::new_sized(llval, layout, alloc.align)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub fn ptrcast(val: &'ll Value, ty: &'ll Type) -> &'ll Value {
}

impl CodegenCx<'ll, 'tcx> {
crate fn static_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
crate fn const_bitcast(&self, val: &'ll Value, ty: &'ll Type) -> &'ll Value {
unsafe {
llvm::LLVMConstBitCast(val, ty)
}
Expand Down

0 comments on commit 36baa97

Please sign in to comment.