Commit | Line | Data |
---|---|---|
f49ff000 YQ |
1 | /* Copyright (C) 2006-2017 Free Software Foundation, Inc. |
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; | |
23 | struct tdesc_reg; | |
24 | struct target_desc; | |
25 | ||
26 | /* Return the type associated with ID in the context of FEATURE, or | |
27 | NULL if none. */ | |
28 | struct tdesc_type *tdesc_named_type (const struct tdesc_feature *feature, | |
29 | const char *id); | |
30 | ||
31 | /* Return the created feature named NAME in target description TDESC. */ | |
32 | struct tdesc_feature *tdesc_create_feature (struct target_desc *tdesc, | |
0abe8a89 YQ |
33 | const char *name, |
34 | const char *xml = nullptr); | |
35 | ||
f49ff000 YQ |
36 | |
37 | /* Return the created vector tdesc_type named NAME in FEATURE. */ | |
38 | struct tdesc_type *tdesc_create_vector (struct tdesc_feature *feature, | |
39 | const char *name, | |
40 | struct tdesc_type *field_type, | |
41 | int count); | |
42 | ||
43 | /* Return the created struct tdesc_type named NAME in FEATURE. */ | |
44 | struct tdesc_type *tdesc_create_struct (struct tdesc_feature *feature, | |
45 | const char *name); | |
46 | ||
47 | /* Return the created union tdesc_type named NAME in FEATURE. */ | |
48 | struct tdesc_type *tdesc_create_union (struct tdesc_feature *feature, | |
49 | const char *name); | |
50 | ||
51 | /* Return the created flags tdesc_type named NAME in FEATURE. */ | |
52 | struct tdesc_type *tdesc_create_flags (struct tdesc_feature *feature, | |
53 | const char *name, | |
54 | int size); | |
55 | ||
56 | /* Add a new field to TYPE. FIELD_NAME is its name, and FIELD_TYPE is | |
57 | its type. */ | |
58 | void tdesc_add_field (struct tdesc_type *type, const char *field_name, | |
59 | struct tdesc_type *field_type); | |
60 | ||
61 | /* Set the total length of TYPE. Structs which contain bitfields may | |
62 | omit the reserved bits, so the end of the last field may not | |
63 | suffice. */ | |
64 | void tdesc_set_struct_size (struct tdesc_type *type, int size); | |
65 | ||
66 | /* Add a new untyped bitfield to TYPE. | |
67 | Untyped bitfields become either uint32 or uint64 depending on the size | |
68 | of the underlying type. */ | |
69 | void tdesc_add_bitfield (struct tdesc_type *type, const char *field_name, | |
70 | int start, int end); | |
71 | ||
72 | /* A flag is just a typed(bool) single-bit bitfield. | |
73 | This function is kept to minimize changes in generated files. */ | |
74 | void tdesc_add_flag (struct tdesc_type *type, int start, | |
75 | const char *flag_name); | |
76 | ||
77 | /* Create a register in feature FEATURE. */ | |
78 | void tdesc_create_reg (struct tdesc_feature *feature, const char *name, | |
79 | int regnum, int save_restore, const char *group, | |
80 | int bitsize, const char *type); | |
81 | ||
82 | #endif /* ARCH_TDESC_H */ |