Branch data Line data Source code
1 : : /* Subroutines for the JIT front end on the x86 architecture.
2 : : Copyright (C) 2023 Free Software Foundation, Inc.
3 : :
4 : : GCC is free software; you can redistribute it and/or modify
5 : : it under the terms of the GNU General Public License as published by
6 : : the Free Software Foundation; either version 3, or (at your option)
7 : : any later version.
8 : :
9 : : GCC is distributed in the hope that it will be useful,
10 : : but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : : GNU General Public License for more details.
13 : :
14 : : You should have received a copy of the GNU General Public License
15 : : along with GCC; see the file COPYING3. If not see
16 : : <http://www.gnu.org/licenses/>. */
17 : :
18 : : #define IN_TARGET_CODE 1
19 : :
20 : : #define INCLUDE_STRING
21 : : #include "config.h"
22 : : #include "system.h"
23 : : #include "coretypes.h"
24 : : #include "target.h"
25 : : #include "tm.h"
26 : : #include "tm_jit.h"
27 : : #include "jit/jit-target.h"
28 : : #include "jit/jit-target-def.h"
29 : :
30 : : /* Implement TARGET_JIT_REGISTER_CPU_TARGET_INFO. */
31 : :
32 : : #ifndef CROSS_DIRECTORY_STRUCTURE
33 : : extern const char *host_detect_local_cpu (int argc, const char **argv);
34 : : #endif
35 : :
36 : : #if TARGET_64BIT_DEFAULT
37 : : const char* x86_bits = "64";
38 : : #else
39 : : const char* x86_bits = "32";
40 : : #endif
41 : :
42 : : void
43 : 1271 : ix86_jit_register_target_info (void)
44 : : {
45 : : #ifndef CROSS_DIRECTORY_STRUCTURE
46 : 1271 : const char *params[] = {"arch", x86_bits};
47 : 1271 : const char* local_cpu = host_detect_local_cpu (2, params);
48 : 1271 : if (local_cpu)
49 : : {
50 : 1271 : std::string arch = local_cpu;
51 : 1271 : free (const_cast <char *> (local_cpu));
52 : :
53 : 1271 : const char* arg = "-march=";
54 : 1271 : size_t arg_pos = arch.find (arg) + strlen (arg);
55 : 1271 : size_t end_pos = arch.find (" ", arg_pos);
56 : :
57 : 1271 : std::string cpu = arch.substr (arg_pos, end_pos - arg_pos);
58 : 1271 : jit_target_set_arch (cpu);
59 : 1271 : }
60 : : #endif
61 : :
62 : 1271 : if (targetm.scalar_mode_supported_p (TImode))
63 : : {
64 : 1271 : jit_target_add_supported_target_dependent_type (GCC_JIT_TYPE_UINT128_T);
65 : 1271 : jit_target_add_supported_target_dependent_type (GCC_JIT_TYPE_INT128_T);
66 : : }
67 : :
68 : : #define ADD_TARGET_INFO jit_add_target_info
69 : : #include "i386-rust-and-jit.inc"
70 : : #undef ADD_TARGET_INFO
71 : 1271 : }
|