MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / bitcast

Method bitcast

crates/rustc_codegen_nvvm/src/builder.rs:828–843  ·  view source on GitHub ↗
(&mut self, val: &'ll Value, dest_ty: &'ll Type)

Source from the content-addressed store, hash-verified

826 }
827
828 fn bitcast(&mut self, val: &'ll Value, dest_ty: &'ll Type) -> &'ll Value {
829 trace!("Bitcast `{:?}` to ty `{:?}`", val, dest_ty);
830 unsafe {
831 let ty = llvm::LLVMRustGetValueType(val);
832 let kind = llvm::LLVMRustGetTypeKind(ty);
833 if kind == llvm::TypeKind::Pointer {
834 let element = llvm::LLVMGetElementType(ty);
835 let addrspace = llvm::LLVMGetPointerAddressSpace(ty);
836 let new_ty = self.type_ptr_to_ext(element, AddressSpace::DATA);
837 if addrspace != 0 {
838 return llvm::LLVMBuildAddrSpaceCast(self.llbuilder, val, new_ty, unnamed());
839 }
840 }
841 llvm::LLVMBuildBitCast(self.llbuilder, val, dest_ty, unnamed())
842 }
843 }
844
845 fn intcast(&mut self, val: &'ll Value, dest_ty: &'ll Type, is_signed: bool) -> &'ll Value {
846 trace!("Intcast `{:?}` to ty `{:?}`", val, dest_ty);

Callers 3

check_storeMethod · 0.80
check_callMethod · 0.80

Calls 4

LLVMRustGetValueTypeFunction · 0.85
LLVMRustGetTypeKindFunction · 0.85
unnamedFunction · 0.85
type_ptr_to_extMethod · 0.80

Tested by

no test coverage detected