]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/riscv/riscv-subset.h
Update copyright years.
[thirdparty/gcc.git] / gcc / config / riscv / riscv-subset.h
CommitLineData
0b7b4710 1/* Definition of data structure of RISC-V subset for GNU compiler.
7adcbafe 2 Copyright (C) 2011-2022 Free Software Foundation, Inc.
0b7b4710
KC
3 Contributed by Andrew Waterman (andrew@sifive.com).
4 Based on MIPS target for GNU compiler.
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
22#ifndef GCC_RISCV_SUBSET_H
23#define GCC_RISCV_SUBSET_H
24
25#define RISCV_DONT_CARE_VERSION -1
26
27/* Subset info. */
28struct riscv_subset_t
29{
30 riscv_subset_t ();
31
32 std::string name;
33 int major_version;
34 int minor_version;
35 struct riscv_subset_t *next;
36
37 bool explicit_version_p;
38 bool implied_p;
39};
40
41/* Subset list. */
42class riscv_subset_list
43{
44private:
45 /* Original arch string. */
46 const char *m_arch;
47
48 /* Location of arch string, used for report error. */
49 location_t m_loc;
50
51 /* Head of subset info list. */
52 riscv_subset_t *m_head;
53
54 /* Tail of subset info list. */
55 riscv_subset_t *m_tail;
56
57 /* X-len of m_arch. */
58 unsigned m_xlen;
59
60 riscv_subset_list (const char *, location_t);
61
62 const char *parsing_subset_version (const char *, const char *, unsigned *,
63 unsigned *, bool, bool *);
64
65 const char *parse_std_ext (const char *);
66
67 const char *parse_multiletter_ext (const char *, const char *,
68 const char *);
69
70 void handle_implied_ext (riscv_subset_t *);
71
72public:
73 ~riscv_subset_list ();
74
75 void add (const char *, int, int, bool, bool);
76
77 void add (const char *, bool);
78
79 riscv_subset_t *lookup (const char *,
80 int major_version = RISCV_DONT_CARE_VERSION,
81 int minor_version = RISCV_DONT_CARE_VERSION) const;
82
83 std::string to_string (bool) const;
84
85 unsigned xlen () const {return m_xlen;};
86
87 static riscv_subset_list *parse (const char *, location_t);
e3354b6d
KC
88
89 const riscv_subset_t *begin () const {return m_head;};
90 const riscv_subset_t *end () const {return NULL;};
0b7b4710
KC
91};
92
e3354b6d
KC
93extern const riscv_subset_list *riscv_current_subset_list (void);
94
0b7b4710 95#endif /* ! GCC_RISCV_SUBSET_H */