Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / rust / util / rust-abi.cc
blob36abb21520d2b400c1eeacccf9c39d652627be99
1 // This file is part of GCC.
3 // GCC is free software; you can redistribute it and/or modify it under
4 // the terms of the GNU General Public License as published by the Free
5 // Software Foundation; either version 3, or (at your option) any later
6 // version.
8 // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
9 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 // for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with GCC; see the file COPYING3. If not see
15 // <http://www.gnu.org/licenses/>.
17 #include "rust-abi.h"
19 namespace Rust {
21 Rust::ABI
22 get_abi_from_string (const std::string &abi)
24 if (abi.compare ("rust") == 0)
25 return Rust::ABI::RUST;
26 else if (abi.compare ("rust-call") == 0)
27 return Rust::ABI::RUST;
28 else if (abi.compare ("rust-intrinsic") == 0)
29 return Rust::ABI::INTRINSIC;
30 else if (abi.compare ("C") == 0)
31 return Rust::ABI::C;
32 else if (abi.compare ("cdecl") == 0)
33 return Rust::ABI::CDECL;
34 else if (abi.compare ("stdcall") == 0)
35 return Rust::ABI::STDCALL;
36 else if (abi.compare ("fastcall") == 0)
37 return Rust::ABI::FASTCALL;
38 else if (abi.compare ("sysv64") == 0)
39 return Rust::ABI::SYSV64;
40 else if (abi.compare ("win64") == 0)
41 return Rust::ABI::WIN64;
43 return Rust::ABI::UNKNOWN;
46 std::string
47 get_string_from_abi (Rust::ABI abi)
49 switch (abi)
51 case Rust::ABI::RUST:
52 return "rust";
53 case Rust::ABI::INTRINSIC:
54 return "rust-intrinsic";
55 case Rust::ABI::C:
56 return "C";
57 case Rust::ABI::CDECL:
58 return "cdecl";
59 case Rust::ABI::STDCALL:
60 return "stdcall";
61 case Rust::ABI::FASTCALL:
62 return "fastcall";
63 case Rust::ABI::SYSV64:
64 return "sysv64";
65 case Rust::ABI::WIN64:
66 return "win64";
68 case Rust::ABI::UNKNOWN:
69 return "unknown";
71 return "unknown";
74 } // namespace Rust