]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/loongarch/loongarch-def.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / loongarch / loongarch-def.h
CommitLineData
b44786f6 1/* LoongArch definitions.
83ffe9cd 2 Copyright (C) 2021-2023 Free Software Foundation, Inc.
b44786f6 3 Contributed by Loongson Ltd.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21/* Definition of standard codes for:
22 - base architecture types (isa_base),
23 - ISA extensions (isa_ext),
24 - base ABI types (abi_base),
25 - ABI extension types (abi_ext).
26
27 - code models (cmodel)
28 - other command-line switches (switch)
29
30 These values are primarily used for implementing option handling
31 logic in "loongarch.opt", "loongarch-driver.c" and "loongarch-opt.c".
32
33 As for the result of this option handling process, the following
34 scheme is adopted to represent the final configuration:
35
36 - The target ABI is encoded with a tuple (abi_base, abi_ext)
37 using the code defined below.
38
39 - The target ISA is encoded with a "struct loongarch_isa" defined
40 in loongarch-cpu.h.
41
42 - The target microarchitecture is represented with a cpu model
43 index defined in loongarch-cpu.h.
44*/
45
46#ifndef LOONGARCH_DEF_H
47#define LOONGARCH_DEF_H
48
49#include "loongarch-tune.h"
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55/* enum isa_base */
56extern const char* loongarch_isa_base_strings[];
57#define ISA_BASE_LA64V100 0
58#define N_ISA_BASE_TYPES 1
59
60/* enum isa_ext_* */
61extern const char* loongarch_isa_ext_strings[];
62#define ISA_EXT_NOFPU 0
63#define ISA_EXT_FPU32 1
64#define ISA_EXT_FPU64 2
65#define N_ISA_EXT_FPU_TYPES 3
66#define N_ISA_EXT_TYPES 3
67
68/* enum abi_base */
69extern const char* loongarch_abi_base_strings[];
70#define ABI_BASE_LP64D 0
71#define ABI_BASE_LP64F 1
72#define ABI_BASE_LP64S 2
73#define N_ABI_BASE_TYPES 3
74
75/* enum abi_ext */
76extern const char* loongarch_abi_ext_strings[];
77#define ABI_EXT_BASE 0
78#define N_ABI_EXT_TYPES 1
79
80/* enum cmodel */
81extern const char* loongarch_cmodel_strings[];
82#define CMODEL_NORMAL 0
83#define CMODEL_TINY 1
84#define CMODEL_TINY_STATIC 2
d1028c57
LC
85#define CMODEL_MEDIUM 3
86#define CMODEL_LARGE 4
87#define CMODEL_EXTREME 5
88#define N_CMODEL_TYPES 6
b44786f6 89
90/* enum switches */
91/* The "SW_" codes represent command-line switches (options that
92 accept no parameters). Definition for other switches that affects
93 the target ISA / ABI configuration will also be appended here
94 in the future. */
95
96extern const char* loongarch_switch_strings[];
97#define SW_SOFT_FLOAT 0
98#define SW_SINGLE_FLOAT 1
99#define SW_DOUBLE_FLOAT 2
100#define N_SWITCH_TYPES 3
101
102/* The common default value for variables whose assignments
103 are triggered by command-line options. */
104
105#define M_OPTION_NOT_SEEN -1
106#define M_OPT_ABSENT(opt_enum) ((opt_enum) == M_OPTION_NOT_SEEN)
107
108
109/* Internal representation of the target. */
110struct loongarch_isa
111{
112 unsigned char base; /* ISA_BASE_ */
113 unsigned char fpu; /* ISA_EXT_FPU_ */
114};
115
116struct loongarch_abi
117{
118 unsigned char base; /* ABI_BASE_ */
119 unsigned char ext; /* ABI_EXT_ */
120};
121
122struct loongarch_target
123{
124 struct loongarch_isa isa;
125 struct loongarch_abi abi;
126 unsigned char cpu_arch; /* CPU_ */
127 unsigned char cpu_tune; /* same */
128 unsigned char cpu_native; /* same */
129 unsigned char cmodel; /* CMODEL_ */
130};
131
132/* CPU properties. */
133/* index */
134#define CPU_NATIVE 0
135#define CPU_LOONGARCH64 1
136#define CPU_LA464 2
137#define N_ARCH_TYPES 3
138#define N_TUNE_TYPES 3
139
140/* parallel tables. */
141extern const char* loongarch_cpu_strings[];
142extern struct loongarch_isa loongarch_cpu_default_isa[];
143extern int loongarch_cpu_issue_rate[];
144extern int loongarch_cpu_multipass_dfa_lookahead[];
145
146extern struct loongarch_cache loongarch_cpu_cache[];
147extern struct loongarch_rtx_cost_data loongarch_cpu_rtx_cost_data[];
148
149#ifdef __cplusplus
150}
151#endif
152#endif /* LOONGARCH_DEF_H */