}
step_impl!(uint u8 u16 u32 int i8 i16 i32);
-#[cfg(target_word_size = "64")]
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
step_impl!(u64 i64);
-#[cfg(target_word_size = "32")]
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
step_impl_no_between!(u64 i64);
#![stable]
#![doc(primitive = "int")]
-#[cfg(target_word_size = "32")] int_module! { int, 32 }
-#[cfg(target_word_size = "64")] int_module! { int, 64 }
+#[cfg(stage0)] #[cfg(target_word_size = "32")] int_module! { int, 32 }
+#[cfg(stage0)] #[cfg(target_word_size = "64")] int_module! { int, 64 }
+
+#[cfg(not(stage0))] #[cfg(target_pointer_width = "32")] int_module! { int, 32 }
+#[cfg(not(stage0))] #[cfg(target_pointer_width = "64")] int_module! { int, 64 }
intrinsics::u64_sub_with_overflow,
intrinsics::u64_mul_with_overflow }
-#[cfg(target_word_size = "32")]
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
uint_impl! { uint = u32, 32,
intrinsics::ctpop32,
intrinsics::ctlz32,
intrinsics::u32_sub_with_overflow,
intrinsics::u32_mul_with_overflow }
-#[cfg(target_word_size = "64")]
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
uint_impl! { uint = u64, 64,
intrinsics::ctpop64,
intrinsics::ctlz64,
intrinsics::i64_sub_with_overflow,
intrinsics::i64_mul_with_overflow }
-#[cfg(target_word_size = "32")]
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
int_impl! { int = i32, u32, 32,
intrinsics::i32_add_with_overflow,
intrinsics::i32_sub_with_overflow,
intrinsics::i32_mul_with_overflow }
-#[cfg(target_word_size = "64")]
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
int_impl! { int = i64, u64, 64,
intrinsics::i64_add_with_overflow,
intrinsics::i64_sub_with_overflow,
}
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
fn primary_libdir_name() -> String {
"lib64".to_string()
}
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
fn primary_libdir_name() -> String {
"lib32".to_string()
}
let end = sess.target.target.target_endian.index(&FullRange);
let arch = sess.target.target.arch.index(&FullRange);
- let wordsz = sess.target.target.target_word_size.index(&FullRange);
+ let wordsz = sess.target.target.target_pointer_width.index(&FullRange);
let os = sess.target.target.target_os.index(&FullRange);
let fam = match sess.target.target.options.is_like_windows {
mk(InternedString::new("target_family"), fam),
mk(InternedString::new("target_arch"), intern(arch)),
mk(InternedString::new("target_endian"), intern(end)),
- mk(InternedString::new("target_word_size"),
+ mk(InternedString::new("target_pointer_width"),
intern(wordsz))
);
}
}
};
- let (int_type, uint_type) = match target.target_word_size.index(&FullRange) {
+ let (int_type, uint_type) = match target.target_pointer_width.index(&FullRange) {
"32" => (ast::TyI32, ast::TyU32),
"64" => (ast::TyI64, ast::TyU64),
w => sp.handler().fatal((format!("target specification was invalid: unrecognized \
n32:64-S128".to_string(),
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
- target_word_size: "64".to_string(),
+ target_pointer_width: "64".to_string(),
arch: "aarch64".to_string(),
target_os: "linux".to_string(),
options: base,
-a:0:64-n32".to_string(),
llvm_target: "arm-apple-ios".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "ios".to_string(),
options: TargetOptions {
-a:0:64-n32".to_string(),
llvm_target: "arm-linux-androideabi".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "android".to_string(),
options: base,
-a:0:64-n32".to_string(),
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
-a:0:64-n32".to_string(),
llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "arm".to_string(),
target_os: "linux".to_string(),
-n8:16:32".to_string(),
llvm_target: "i386-apple-ios".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "ios".to_string(),
-n8:16:32".to_string(),
llvm_target: "i686-apple-darwin".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "macos".to_string(),
options: base,
data_layout: "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string(),
llvm_target: "i686-pc-windows-gnu".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "windows".to_string(),
options: options,
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
llvm_target: "i686-unknown-dragonfly".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "dragonfly".to_string(),
options: base,
data_layout: "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
llvm_target: "i686-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "x86".to_string(),
target_os: "linux".to_string(),
options: base,
-a:0:64-n32".to_string(),
llvm_target: "mips-unknown-linux-gnu".to_string(),
target_endian: "big".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
options: super::linux_base::opts()
-a:0:64-n32".to_string(),
llvm_target: "mipsel-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
- target_word_size: "32".to_string(),
+ target_pointer_width: "32".to_string(),
arch: "mips".to_string(),
target_os: "linux".to_string(),
pub llvm_target: String,
/// String to use as the `target_endian` `cfg` variable.
pub target_endian: String,
- /// String to use as the `target_word_size` `cfg` variable.
- pub target_word_size: String,
+ /// String to use as the `target_pointer_width` `cfg` variable.
+ pub target_pointer_width: String,
/// OS name to use for conditional compilation.
pub target_os: String,
/// Architecture to use for ABI considerations. Valid options: "x86", "x86_64", "arm",
data_layout: get_req_field("data-layout"),
llvm_target: get_req_field("llvm-target"),
target_endian: get_req_field("target-endian"),
- target_word_size: get_req_field("target-word-size"),
+ target_pointer_width: get_req_field("target-word-size"),
arch: get_req_field("arch"),
target_os: get_req_field("os"),
options: Default::default(),
s0:64:64-f80:128:128-n8:16:32:64".to_string(),
llvm_target: "x86_64-apple-darwin".to_string(),
target_endian: "little".to_string(),
- target_word_size: "64".to_string(),
+ target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "macos".to_string(),
options: base,
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-pc-windows-gnu".to_string(),
target_endian: "little".to_string(),
- target_word_size: "64".to_string(),
+ target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "windows".to_string(),
options: base,
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-unknown-dragonfly".to_string(),
target_endian: "little".to_string(),
- target_word_size: "64".to_string(),
+ target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "dragonfly".to_string(),
options: base,
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-unknown-freebsd".to_string(),
target_endian: "little".to_string(),
- target_word_size: "64".to_string(),
+ target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "freebsd".to_string(),
options: base,
s0:64:64-f80:128:128-n8:16:32:64-S128".to_string(),
llvm_target: "x86_64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
- target_word_size: "64".to_string(),
+ target_pointer_width: "64".to_string(),
arch: "x86_64".to_string(),
target_os: "linux".to_string(),
options: base,
pub fn call_memcpy(cx: Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, align: u32) {
let _icx = push_ctxt("call_memcpy");
let ccx = cx.ccx();
- let key = match ccx.sess().target.target.target_word_size.index(&FullRange) {
+ let key = match ccx.sess().target.target.target_pointer_width.index(&FullRange) {
"32" => "llvm.memcpy.p0i8.p0i8.i32",
"64" => "llvm.memcpy.p0i8.p0i8.i64",
tws => panic!("Unsupported target word size for memcpy: {}", tws),
let llty = type_of::type_of(ccx, ty);
- let intrinsic_key = match ccx.sess().target.target.target_word_size.index(&FullRange) {
+ let intrinsic_key = match ccx.sess().target.target.target_pointer_width.index(&FullRange) {
"32" => "llvm.memset.p0i8.i32",
"64" => "llvm.memset.p0i8.i64",
tws => panic!("Unsupported target word size for memset: {}", tws),
/// currently conservatively bounded to 1 << 47 as that is enough to cover the current usable
/// address space on 64-bit ARMv8 and x86_64.
pub fn obj_size_bound(&self) -> u64 {
- match self.sess().target.target.target_word_size.index(&FullRange) {
+ match self.sess().target.target.target_pointer_width.index(&FullRange) {
"32" => 1 << 31,
"64" => 1 << 47,
_ => unreachable!() // error handled by config::build_target_config
}
pub fn int(ccx: &CrateContext) -> Type {
- match ccx.tcx().sess.target.target.target_word_size.index(&FullRange) {
+ match ccx.tcx().sess.target.target.target_pointer_width.index(&FullRange) {
"32" => Type::i32(ccx),
"64" => Type::i64(ccx),
tws => panic!("Unsupported target word size for int: {}", tws),
}
}
#[test]
- #[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
+ #[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_streaming_parser() {
assert_stream_equal(
r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#,
}
#[test]
- #[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
+ #[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_read_object_streaming() {
assert_eq!(last_event("{ "), Error(SyntaxError(EOFWhileParsingObject, 1, 3)));
assert_eq!(last_event("{1"), Error(SyntaxError(KeyMustBeAString, 1, 2)));
);
}
#[test]
- #[cfg_attr(target_word_size = "32", ignore)] // FIXME(#14064)
+ #[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_read_array_streaming() {
assert_stream_equal(
"[]",
assert_eq!(int::MIN.to_u32(), None);
assert_eq!(int::MIN.to_u64(), None);
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(int::MIN.to_i32(), Some(int::MIN as i32));
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(int::MIN.to_i32(), None);
}
assert_eq!(i64::MIN.to_u32(), None);
assert_eq!(i64::MIN.to_u64(), None);
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(i64::MIN.to_int(), None);
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(i64::MIN.to_int(), Some(i64::MIN as int));
}
// int::MAX.to_u32() is word-size specific
assert_eq!(int::MAX.to_u64(), Some(int::MAX as u64));
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(int::MAX.to_i32(), Some(int::MAX as i32));
assert_eq!(int::MAX.to_u32(), Some(int::MAX as u32));
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(int::MAX.to_i32(), None);
assert_eq!(int::MAX.to_u32(), None);
assert_eq!(i64::MAX.to_u32(), None);
assert_eq!(i64::MAX.to_u64(), Some(i64::MAX as u64));
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(i64::MAX.to_int(), None);
assert_eq!(i64::MAX.to_uint(), None);
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(i64::MAX.to_int(), Some(i64::MAX as int));
assert_eq!(i64::MAX.to_uint(), Some(i64::MAX as uint));
// uint::MAX.to_u32() is word-size specific
assert_eq!(uint::MAX.to_u64(), Some(uint::MAX as u64));
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(uint::MAX.to_u32(), Some(uint::MAX as u32));
assert_eq!(uint::MAX.to_i64(), Some(uint::MAX as i64));
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(uint::MAX.to_u32(), None);
assert_eq!(uint::MAX.to_i64(), None);
assert_eq!(u32::MAX.to_u32(), Some(u32::MAX as u32));
assert_eq!(u32::MAX.to_u64(), Some(u32::MAX as u64));
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(u32::MAX.to_int(), None);
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(u32::MAX.to_int(), Some(u32::MAX as int));
}
assert_eq!(u64::MAX.to_u32(), None);
assert_eq!(u64::MAX.to_u64(), Some(u64::MAX as u64));
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
fn check_word_size() {
assert_eq!(u64::MAX.to_uint(), None);
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
fn check_word_size() {
assert_eq!(u64::MAX.to_uint(), Some(u64::MAX as uint));
}
use result::Result::{Ok, Err};
use vec::Vec;
-#[cfg(not(target_word_size="64"))]
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
use core_rand::IsaacRng as IsaacWordRng;
-#[cfg(target_word_size="64")]
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
use core_rand::Isaac64Rng as IsaacWordRng;
pub use core_rand::{Rand, Rng, SeedableRng, Open01, Closed01};
use io::IoResult;
-#[cfg(target_word_size = "64")] pub const HEX_WIDTH: uint = 18;
-#[cfg(target_word_size = "32")] pub const HEX_WIDTH: uint = 10;
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
+pub const HEX_WIDTH: uint = 18;
+
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
+pub const HEX_WIDTH: uint = 10;
// All rust symbols are in theory lists of "::"-separated identifiers. Some
// assemblers, however, can't handle these characters in symbol names. To get
unsafe impl ::marker::Sync for sigaction { }
#[repr(C)]
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
pub struct sigset_t {
__val: [libc::c_ulong; 32],
}
#[repr(C)]
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
pub struct sigset_t {
__val: [libc::c_ulong; 16],
}
sa_restorer: *mut libc::c_void,
}
- #[cfg(target_word_size = "32")]
+ #[cfg(any(all(stage0, target_word_size = "32"),
+ all(not(stage0), target_pointer_width = "32")))]
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong; 32],
}
- #[cfg(target_word_size = "64")]
+ #[cfg(any(all(stage0, target_word_size = "64"),
+ all(not(stage0), target_pointer_width = "64")))]
#[repr(C)]
pub struct sigset_t {
__val: [libc::c_ulong; 16],
// FIXME: work properly with higher limits
-#[cfg(target_word_size = "32")]
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
fn main() {
let big: Option<[u32; (1<<29)-1]> = None;
}
-#[cfg(target_word_size = "64")]
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
fn main() {
let big: Option<[u32; (1<<45)-1]> = None;
}
// error-pattern: too big for the current architecture
-#[cfg(target_word_size = "64")]
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
fn main() {
let n = 0u;
let a = box [&n; 0xF000000000000000u];
println!("{}", a[0xFFFFFFu]);
}
-#[cfg(target_word_size = "32")]
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
fn main() {
let n = 0u;
let a = box [&n; 0xFFFFFFFFu];
use std::mem::size_of;
-#[cfg(target_word_size = "32")]
+#[cfg(any(all(stage0, target_word_size = "32"), all(not(stage0), target_pointer_width = "32")))]
pub fn main() {
assert_eq!(size_of::<[u8; (1 << 31) - 1]>(), (1 << 31) - 1);
}
-#[cfg(target_word_size = "64")]
+#[cfg(any(all(stage0, target_word_size = "64"), all(not(stage0), target_pointer_width = "64")))]
pub fn main() {
assert_eq!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1);
}
// FIXME #10183
// FIXME #18069
- //if cfg!(target_word_size = "64") {
+ //if cfg!(target_pointer_width = "64") {
// assert_eq!(size_of::<[u8; (1 << 32)]>(), (1u << 32));
//}
}