• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use super::BackendTypes;
2 use rustc_middle::mir::interpret::{ConstAllocation, Scalar};
3 use rustc_target::abi;
4 
5 pub trait ConstMethods<'tcx>: BackendTypes {
6     // Constant constructors
const_null(&self, t: Self::Type) -> Self::Value7     fn const_null(&self, t: Self::Type) -> Self::Value;
const_undef(&self, t: Self::Type) -> Self::Value8     fn const_undef(&self, t: Self::Type) -> Self::Value;
const_poison(&self, t: Self::Type) -> Self::Value9     fn const_poison(&self, t: Self::Type) -> Self::Value;
const_int(&self, t: Self::Type, i: i64) -> Self::Value10     fn const_int(&self, t: Self::Type, i: i64) -> Self::Value;
const_uint(&self, t: Self::Type, i: u64) -> Self::Value11     fn const_uint(&self, t: Self::Type, i: u64) -> Self::Value;
const_uint_big(&self, t: Self::Type, u: u128) -> Self::Value12     fn const_uint_big(&self, t: Self::Type, u: u128) -> Self::Value;
const_bool(&self, val: bool) -> Self::Value13     fn const_bool(&self, val: bool) -> Self::Value;
const_i16(&self, i: i16) -> Self::Value14     fn const_i16(&self, i: i16) -> Self::Value;
const_i32(&self, i: i32) -> Self::Value15     fn const_i32(&self, i: i32) -> Self::Value;
const_u32(&self, i: u32) -> Self::Value16     fn const_u32(&self, i: u32) -> Self::Value;
const_u64(&self, i: u64) -> Self::Value17     fn const_u64(&self, i: u64) -> Self::Value;
const_u128(&self, i: u128) -> Self::Value18     fn const_u128(&self, i: u128) -> Self::Value;
const_usize(&self, i: u64) -> Self::Value19     fn const_usize(&self, i: u64) -> Self::Value;
const_u8(&self, i: u8) -> Self::Value20     fn const_u8(&self, i: u8) -> Self::Value;
const_real(&self, t: Self::Type, val: f64) -> Self::Value21     fn const_real(&self, t: Self::Type, val: f64) -> Self::Value;
22 
const_str(&self, s: &str) -> (Self::Value, Self::Value)23     fn const_str(&self, s: &str) -> (Self::Value, Self::Value);
const_struct(&self, elts: &[Self::Value], packed: bool) -> Self::Value24     fn const_struct(&self, elts: &[Self::Value], packed: bool) -> Self::Value;
25 
const_to_opt_uint(&self, v: Self::Value) -> Option<u64>26     fn const_to_opt_uint(&self, v: Self::Value) -> Option<u64>;
const_to_opt_u128(&self, v: Self::Value, sign_ext: bool) -> Option<u128>27     fn const_to_opt_u128(&self, v: Self::Value, sign_ext: bool) -> Option<u128>;
28 
const_data_from_alloc(&self, alloc: ConstAllocation<'tcx>) -> Self::Value29     fn const_data_from_alloc(&self, alloc: ConstAllocation<'tcx>) -> Self::Value;
30 
scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: Self::Type) -> Self::Value31     fn scalar_to_backend(&self, cv: Scalar, layout: abi::Scalar, llty: Self::Type) -> Self::Value;
32 
const_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value33     fn const_ptrcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
const_bitcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value34     fn const_bitcast(&self, val: Self::Value, ty: Self::Type) -> Self::Value;
const_ptr_byte_offset(&self, val: Self::Value, offset: abi::Size) -> Self::Value35     fn const_ptr_byte_offset(&self, val: Self::Value, offset: abi::Size) -> Self::Value;
36 }
37