Commit | Line | Data |
---|---|---|
e2882c85 | 1 | /* Copyright (C) 2006-2018 Free Software Foundation, Inc. |
f49ff000 YQ |
2 | |
3 | This file is part of GDB. | |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | #ifndef ARCH_TDESC_H | |
19 | #define ARCH_TDESC_H 1 | |
20 | ||
21 | struct tdesc_feature; | |
22 | struct tdesc_type; | |
d4a0e8b5 SM |
23 | struct tdesc_type_builtin; |
24 | struct tdesc_type_vector; | |
25 | struct tdesc_type_with_fields; | |
f49ff000 YQ |
26 | struct tdesc_reg; |
27 | struct target_desc; | |
28 | ||
5f035c07 YQ |
29 | /* Allocate a new target_desc. */ |
30 | target_desc *allocate_target_description (void); | |
31 | ||
32 | /* Set TARGET_DESC's architecture by NAME. */ | |
33 | void set_tdesc_architecture (target_desc *target_desc, | |
34 | const char *name); | |
35 | ||
36 | /* Set TARGET_DESC's osabi by NAME. */ | |
37 | void set_tdesc_osabi (target_desc *target_desc, const char *name); | |
38 | ||
f49ff000 YQ |
39 | /* Return the type associated with ID in the context of FEATURE, or |
40 | NULL if none. */ | |
41 | struct tdesc_type *tdesc_named_type (const struct tdesc_feature *feature, | |
42 | const char *id); | |
43 | ||
44 | /* Return the created feature named NAME in target description TDESC. */ | |
45 | struct tdesc_feature *tdesc_create_feature (struct target_desc *tdesc, | |
0abe8a89 YQ |
46 | const char *name, |
47 | const char *xml = nullptr); | |
48 | ||
f49ff000 YQ |
49 | |
50 | /* Return the created vector tdesc_type named NAME in FEATURE. */ | |
51 | struct tdesc_type *tdesc_create_vector (struct tdesc_feature *feature, | |
52 | const char *name, | |
53 | struct tdesc_type *field_type, | |
54 | int count); | |
55 | ||
56 | /* Return the created struct tdesc_type named NAME in FEATURE. */ | |
d4a0e8b5 SM |
57 | tdesc_type_with_fields *tdesc_create_struct (struct tdesc_feature *feature, |
58 | const char *name); | |
f49ff000 YQ |
59 | |
60 | /* Return the created union tdesc_type named NAME in FEATURE. */ | |
d4a0e8b5 SM |
61 | tdesc_type_with_fields *tdesc_create_union (struct tdesc_feature *feature, |
62 | const char *name); | |
f49ff000 YQ |
63 | |
64 | /* Return the created flags tdesc_type named NAME in FEATURE. */ | |
d4a0e8b5 SM |
65 | tdesc_type_with_fields *tdesc_create_flags (struct tdesc_feature *feature, |
66 | const char *name, | |
67 | int size); | |
f49ff000 YQ |
68 | |
69 | /* Add a new field to TYPE. FIELD_NAME is its name, and FIELD_TYPE is | |
70 | its type. */ | |
d4a0e8b5 | 71 | void tdesc_add_field (tdesc_type_with_fields *type, const char *field_name, |
f49ff000 YQ |
72 | struct tdesc_type *field_type); |
73 | ||
74 | /* Set the total length of TYPE. Structs which contain bitfields may | |
75 | omit the reserved bits, so the end of the last field may not | |
76 | suffice. */ | |
d4a0e8b5 | 77 | void tdesc_set_struct_size (tdesc_type_with_fields *type, int size); |
f49ff000 YQ |
78 | |
79 | /* Add a new untyped bitfield to TYPE. | |
80 | Untyped bitfields become either uint32 or uint64 depending on the size | |
81 | of the underlying type. */ | |
d4a0e8b5 | 82 | void tdesc_add_bitfield (tdesc_type_with_fields *type, const char *field_name, |
f49ff000 YQ |
83 | int start, int end); |
84 | ||
85 | /* A flag is just a typed(bool) single-bit bitfield. | |
86 | This function is kept to minimize changes in generated files. */ | |
d4a0e8b5 | 87 | void tdesc_add_flag (tdesc_type_with_fields *type, int start, |
f49ff000 YQ |
88 | const char *flag_name); |
89 | ||
90 | /* Create a register in feature FEATURE. */ | |
91 | void tdesc_create_reg (struct tdesc_feature *feature, const char *name, | |
92 | int regnum, int save_restore, const char *group, | |
93 | int bitsize, const char *type); | |
94 | ||
95 | #endif /* ARCH_TDESC_H */ |