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