(&mut self, val: &'ll Value, dest_ty: &'ll Type)
| 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); |
no test coverage detected