fix cranelift and gcc backends
This commit is contained in:
parent
4587677300
commit
33e8d4c2d4
@ -9,7 +9,6 @@ use rustc_codegen_ssa::traits::{
|
|||||||
StaticMethods,
|
StaticMethods,
|
||||||
};
|
};
|
||||||
use rustc_middle::mir::Mutability;
|
use rustc_middle::mir::Mutability;
|
||||||
use rustc_middle::ty::ScalarInt;
|
|
||||||
use rustc_middle::ty::layout::{TyAndLayout, LayoutOf};
|
use rustc_middle::ty::layout::{TyAndLayout, LayoutOf};
|
||||||
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
|
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
|
||||||
use rustc_target::abi::{self, HasDataLayout, Pointer, Size};
|
use rustc_target::abi::{self, HasDataLayout, Pointer, Size};
|
||||||
@ -159,13 +158,13 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn zst_to_backend(&self, _ty: Type<'gcc>) -> RValue<'gcc> {
|
||||||
|
self.const_undef(self.type_ix(0))
|
||||||
|
}
|
||||||
|
|
||||||
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, ty: Type<'gcc>) -> RValue<'gcc> {
|
fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, ty: Type<'gcc>) -> RValue<'gcc> {
|
||||||
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
|
let bitsize = if layout.is_bool() { 1 } else { layout.size(self).bits() };
|
||||||
match cv {
|
match cv {
|
||||||
Scalar::Int(ScalarInt::ZST) => {
|
|
||||||
assert_eq!(0, layout.size(self).bytes());
|
|
||||||
self.const_undef(self.type_ix(0))
|
|
||||||
}
|
|
||||||
Scalar::Int(int) => {
|
Scalar::Int(int) => {
|
||||||
let data = int.assert_bits(layout.size(self));
|
let data = int.assert_bits(layout.size(self));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user