Rename static_bitcast to const_bitcast

This commit is contained in:
bjorn3 2018-11-24 17:45:05 +01:00
parent e8da3c6c32
commit f47505e867
2 changed files with 6 additions and 6 deletions

View File

@ -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) => {
@ -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)
}
}
}
@ -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)
}

View File

@ -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)
}