about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorTim Neumann <mail@timnn.me>2016-10-24 11:04:04 +0200
committerTim Neumann <mail@timnn.me>2016-10-24 15:59:53 +0200
commit9eb0fd98c6f780ac93b877c5429fe22b50bf4e1a (patch)
tree495bfb82e7e6e17cb513c69ac7ba5f606b8dedbb /src/libsyntax
parentac468b67bffc6c386dd04b7955eec013ef99dc39 (diff)
downloadrust-9eb0fd98c6f780ac93b877c5429fe22b50bf4e1a.tar.gz
rust-9eb0fd98c6f780ac93b877c5429fe22b50bf4e1a.zip
check target abi support
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/abi.rs50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index 1f2dc228ded..a39cac8db99 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -33,7 +33,7 @@ pub enum Abi {
     // NB: This ordering MUST match the AbiDatas array below.
     // (This is ensured by the test indices_are_correct().)
 
-    // Single platform ABIs come first (`for_arch()` relies on this)
+    // Single platform ABIs
     Cdecl,
     Stdcall,
     Fastcall,
@@ -42,7 +42,7 @@ pub enum Abi {
     Win64,
     SysV64,
 
-    // Multiplatform ABIs second
+    // Multiplatform / generic ABIs
     Rust,
     C,
     System,
@@ -65,41 +65,31 @@ pub enum Architecture {
 pub struct AbiData {
     abi: Abi,
 
-    // Name of this ABI as we like it called.
+    /// Name of this ABI as we like it called.
     name: &'static str,
-}
 
-#[derive(Copy, Clone)]
-pub enum AbiArchitecture {
-    /// Not a real ABI (e.g., intrinsic)
-    Rust,
-    /// An ABI that specifies cross-platform defaults (e.g., "C")
-    All,
-    /// Multiple architectures (bitset)
-    Archs(u32)
+    /// A generic ABI is supported on all platforms.
+    generic: bool,
 }
 
 #[allow(non_upper_case_globals)]
 const AbiDatas: &'static [AbiData] = &[
     // Platform-specific ABIs
-    AbiData {abi: Abi::Cdecl, name: "cdecl" },
-    AbiData {abi: Abi::Stdcall, name: "stdcall" },
-    AbiData {abi: Abi::Fastcall, name: "fastcall" },
-    AbiData {abi: Abi::Vectorcall, name: "vectorcall"},
-    AbiData {abi: Abi::Aapcs, name: "aapcs" },
-    AbiData {abi: Abi::Win64, name: "win64" },
-    AbiData {abi: Abi::SysV64, name: "sysv64" },
+    AbiData {abi: Abi::Cdecl, name: "cdecl", generic: false },
+    AbiData {abi: Abi::Stdcall, name: "stdcall", generic: false },
+    AbiData {abi: Abi::Fastcall, name: "fastcall", generic: false },
+    AbiData {abi: Abi::Vectorcall, name: "vectorcall", generic: false},
+    AbiData {abi: Abi::Aapcs, name: "aapcs", generic: false },
+    AbiData {abi: Abi::Win64, name: "win64", generic: false },
+    AbiData {abi: Abi::SysV64, name: "sysv64", generic: false },
 
     // Cross-platform ABIs
-    //
-    // NB: Do not adjust this ordering without
-    // adjusting the indices below.
-    AbiData {abi: Abi::Rust, name: "Rust" },
-    AbiData {abi: Abi::C, name: "C" },
-    AbiData {abi: Abi::System, name: "system" },
-    AbiData {abi: Abi::RustIntrinsic, name: "rust-intrinsic" },
-    AbiData {abi: Abi::RustCall, name: "rust-call" },
-    AbiData {abi: Abi::PlatformIntrinsic, name: "platform-intrinsic" }
+    AbiData {abi: Abi::Rust, name: "Rust", generic: true },
+    AbiData {abi: Abi::C, name: "C", generic: true },
+    AbiData {abi: Abi::System, name: "system", generic: true },
+    AbiData {abi: Abi::RustIntrinsic, name: "rust-intrinsic", generic: true },
+    AbiData {abi: Abi::RustCall, name: "rust-call", generic: true },
+    AbiData {abi: Abi::PlatformIntrinsic, name: "platform-intrinsic", generic: true },
 ];
 
 /// Returns the ABI with the given name (if any).
@@ -125,6 +115,10 @@ impl Abi {
     pub fn name(&self) -> &'static str {
         self.data().name
     }
+
+    pub fn generic(&self) -> bool {
+        self.data().generic
+    }
 }
 
 impl fmt::Display for Abi {