2001-11-14 Michael Snyder <msnyder@redhat.com>
[deliverable/binutils-gdb.git] / gdb / gdbtypes.h
index bc0f8fb9cbae37df16be5bef1d3b3b53cb3a3f90..3bc8131585317b862b60f7e72ce957ab660cc702 100644 (file)
@@ -23,6 +23,9 @@
 #if !defined (GDBTYPES_H)
 #define GDBTYPES_H 1
 
+/* Forward declarations for prototypes.  */
+struct block;
+
 /* Codes for `fundamental types'.  This is a monstrosity based on the
    bogus notion that there are certain compiler-independent
    `fundamental types'.  None of these is well-defined (how big is
@@ -203,6 +206,28 @@ enum type_code
 
 #define TYPE_FLAG_INCOMPLETE (1 << 8)
 
+/* Instruction-space delimited type.  This is for Harvard architectures
+   which have separate instruction and data address spaces (and perhaps
+   others).
+
+   GDB usually defines a flat address space that is a superset of the
+   architecture's two (or more) address spaces, but this is an extension
+   of the architecture's model.
+
+   If TYPE_FLAG_INST is set, an object of the corresponding type
+   resides in instruction memory, even if its address (in the extended
+   flat address space) does not reflect this.
+
+   Similarly, if TYPE_FLAG_DATA is set, then an object of the 
+   corresponding type resides in the data memory space, even if
+   this is not indicated by its (flat address space) address.
+
+   If neither flag is set, the default space for functions / methods
+   is instruction space, and for data objects is data memory.  */
+
+#define TYPE_FLAG_CODE_SPACE (1 << 9)
+#define TYPE_FLAG_DATA_SPACE (1 << 10)
+
 
 struct type
   {
@@ -231,17 +256,29 @@ struct type
 
     char *tag_name;
 
-    /* Length of storage for a value of this type.  Various places pass
-       this to memcpy and such, meaning it must be in units of
-       HOST_CHAR_BIT.  Various other places expect they can calculate
-       addresses by adding it and such, meaning it must be in units of
-       TARGET_CHAR_BIT.  For some DSP targets, in which HOST_CHAR_BIT
-       will (presumably) be 8 and TARGET_CHAR_BIT will be (say) 32, this
-       is a problem.  One fix would be to make this field in bits
-       (requiring that it always be a multiple of HOST_CHAR_BIT and
-       TARGET_CHAR_BIT)--the other choice would be to make it
-       consistently in units of HOST_CHAR_BIT.  */
-
+    /* Length of storage for a value of this type.  This is what
+       sizeof(type) would return; use it for address arithmetic,
+       memory reads and writes, etc.  This size includes padding.  For
+       example, an i386 extended-precision floating point value really
+       only occupies ten bytes, but most ABI's declare its size to be
+       12 bytes, to preserve alignment.  A `struct type' representing
+       such a floating-point type would have a `length' value of 12,
+       even though the last two bytes are unused.
+
+       There's a bit of a host/target mess here, if you're concerned
+       about machines whose bytes aren't eight bits long, or who don't
+       have byte-addressed memory.  Various places pass this to memcpy
+       and such, meaning it must be in units of host bytes.  Various
+       other places expect they can calculate addresses by adding it
+       and such, meaning it must be in units of target bytes.  For
+       some DSP targets, in which HOST_CHAR_BIT will (presumably) be 8
+       and TARGET_CHAR_BIT will be (say) 32, this is a problem.
+
+       One fix would be to make this field in bits (requiring that it
+       always be a multiple of HOST_CHAR_BIT and TARGET_CHAR_BIT) ---
+       the other choice would be to make it consistently in units of
+       HOST_CHAR_BIT.  However, this would still fail to address
+       machines based on a ternary or decimal representation.  */
     unsigned length;
 
     /* FIXME, these should probably be restricted to a Fortran-specific
@@ -295,6 +332,12 @@ struct type
        are chained together in a ring. */
     struct type *cv_type;
 
+    /* Address-space delimited variant chain.  This points to a type
+       that differs from this one only in an address-space qualifier
+       attribute.  The otherwise-identical address-space delimited 
+       types are chained together in a ring. */
+    struct type *as_type;
+
     /* Flags about this type.  */
 
     int flags;
@@ -409,6 +452,11 @@ struct type
 
        struct cplus_struct_type *cplus_stuff;
 
+       /* FLOATFORMAT is for TYPE_CODE_FLT.  It is a pointer to the
+           floatformat object that describes the floating-point value
+           that resides within the type.  */
+
+       const struct floatformat *floatformat;
       }
     type_specific;
   };
@@ -669,6 +717,7 @@ extern void allocate_cplus_struct_type (struct type *);
 #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
 #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
 #define TYPE_CV_TYPE(thistype) (thistype)->cv_type
+#define TYPE_AS_TYPE(thistype) (thistype)->as_type
 /* Note that if thistype is a TYPEDEF type, you have to call check_typedef.
    But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
    so you only have to call check_typedef once.  Since allocate_value
@@ -718,6 +767,7 @@ extern void allocate_cplus_struct_type (struct type *);
 #define        TYPE_TYPE_SPECIFIC(thistype) (thistype)->type_specific
 #define TYPE_ARG_TYPES(thistype) (thistype)->type_specific.arg_types
 #define TYPE_CPLUS_SPECIFIC(thistype) (thistype)->type_specific.cplus_stuff
+#define TYPE_FLOATFORMAT(thistype) (thistype)->type_specific.floatformat
 #define TYPE_BASECLASS(thistype,index) (thistype)->fields[index].type
 #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
 #define TYPE_BASECLASS_NAME(thistype,index) (thistype)->fields[index].name
@@ -876,6 +926,8 @@ extern struct type *builtin_type_int32;
 extern struct type *builtin_type_uint32;
 extern struct type *builtin_type_int64;
 extern struct type *builtin_type_uint64;
+extern struct type *builtin_type_int128;
+extern struct type *builtin_type_uint128;
 
 /* SIMD types.  We inherit these names from GCC.  */
 extern struct type *builtin_type_v4sf;
@@ -884,6 +936,24 @@ extern struct type *builtin_type_v8qi;
 extern struct type *builtin_type_v4hi;
 extern struct type *builtin_type_v2si;
 
+/* Explicit floating-point formats.  See "floatformat.h".  */
+extern struct type *builtin_type_ieee_single_big;
+extern struct type *builtin_type_ieee_single_little;
+extern struct type *builtin_type_ieee_double_big;
+extern struct type *builtin_type_ieee_double_little;
+extern struct type *builtin_type_ieee_double_littlebyte_bigword;
+extern struct type *builtin_type_i387_ext;
+extern struct type *builtin_type_m68881_ext;
+extern struct type *builtin_type_i960_ext;
+extern struct type *builtin_type_m88110_ext;
+extern struct type *builtin_type_m88110_harris_ext;
+extern struct type *builtin_type_arm_ext_big;
+extern struct type *builtin_type_arm_ext_littlebyte_bigword;
+extern struct type *builtin_type_ia64_spill_big;
+extern struct type *builtin_type_ia64_spill_little;
+extern struct type *builtin_type_ia64_quad_big;
+extern struct type *builtin_type_ia64_quad_little;
+
 /* We use this for the '/c' print format, because builtin_type_char is
    just a one-byte integral type, which languages less laid back than
    C will print as ... well, a one-byte integral type.  */
@@ -967,6 +1037,13 @@ extern struct type *make_reference_type (struct type *, struct type **);
 
 extern struct type *make_cv_type (int, int, struct type *, struct type **);
 
+extern int address_space_name_to_int (char *);
+
+extern char *address_space_int_to_name (int);
+
+extern struct type *make_type_with_address_space (struct type *type, 
+                                                 int space_identifier);
+
 extern struct type *lookup_member_type (struct type *, struct type *);
 
 extern void
This page took 0.026582 seconds and 4 git commands to generate.