diff options
author | Dave Brolley <brolley@redhat.com> | 2005-10-28 23:38:59 +0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2005-10-28 23:38:59 +0400 |
commit | 2f8b2203e31ff067f30c7a22e1665e225a8b3967 (patch) | |
tree | c233637db8e92fe96ce359b4640b351b9312c374 | |
parent | cc2ac099b5ce9500ace808be5eece585169b18ea (diff) |
2005-10-28 Dave Brolley <brolley@redhat.com>
Contribute the following changes:
2005-02-16 Dave Brolley <brolley@redhat.com>
* cgen-bitset.h: Rename CGEN_ISA_MASK to CGEN_BITSET. Rename
cgen_isa_mask_* to cgen_bitset_*.
* cgen.h: Likewise.
-rw-r--r-- | include/opcode/ChangeLog | 9 | ||||
-rw-r--r-- | include/opcode/cgen-bitset.h | 55 | ||||
-rw-r--r-- | include/opcode/cgen.h | 26 |
3 files changed, 83 insertions, 7 deletions
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index 1f50c5f6a..da503b6bc 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,12 @@ +2005-10-28 Dave Brolley <brolley@redhat.com> + + Contribute the following changes: + 2005-02-16 Dave Brolley <brolley@redhat.com> + + * cgen-bitset.h: Rename CGEN_ISA_MASK to CGEN_BITSET. Rename + cgen_isa_mask_* to cgen_bitset_*. + * cgen.h: Likewise. + 2005-09-30 Catherine Moore <clm@cm00re.com> * bfin.h: New file. diff --git a/include/opcode/cgen-bitset.h b/include/opcode/cgen-bitset.h new file mode 100644 index 000000000..1b6fbe32c --- /dev/null +++ b/include/opcode/cgen-bitset.h @@ -0,0 +1,55 @@ +/* Header file the type CGEN_BITSET. + +Copyright 2002, 2005 Free Software Foundation, Inc. + +This file is part of GDB, the GNU debugger, and the GNU Binutils. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifndef CGEN_BITSET_H +#define CGEN_BITSET_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* A bitmask represented as a string. + Each member of the set is represented as a bit + in the string. Bytes are indexed from left to right in the string and + bits from most significant to least within each byte. + + For example, the bit representing member number 6 is (set->bits[0] & 0x02). +*/ +typedef struct cgen_bitset +{ + unsigned length; + char *bits; +} CGEN_BITSET; + +extern CGEN_BITSET *cgen_bitset_create PARAMS ((unsigned)); +extern void cgen_bitset_init PARAMS ((CGEN_BITSET *, unsigned)); +extern void cgen_bitset_clear PARAMS ((CGEN_BITSET *)); +extern void cgen_bitset_add PARAMS ((CGEN_BITSET *, unsigned)); +extern void cgen_bitset_set PARAMS ((CGEN_BITSET *, unsigned)); +extern int cgen_bitset_compare PARAMS ((CGEN_BITSET *, CGEN_BITSET *)); +extern void cgen_bitset_union PARAMS ((CGEN_BITSET *, CGEN_BITSET *, CGEN_BITSET *)); +extern int cgen_bitset_intersect_p PARAMS ((CGEN_BITSET *, CGEN_BITSET *)); +extern int cgen_bitset_contains PARAMS ((CGEN_BITSET *, unsigned)); +extern CGEN_BITSET *cgen_bitset_copy PARAMS ((CGEN_BITSET *)); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/include/opcode/cgen.h b/include/opcode/cgen.h index efebadb67..e8fd5d3d9 100644 --- a/include/opcode/cgen.h +++ b/include/opcode/cgen.h @@ -22,6 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef CGEN_H #define CGEN_H +#include "symcat.h" +#include "cgen-bitset.h" /* ??? This file requires bfd.h but only to get bfd_vma. Seems like an awful lot to require just to get such a fundamental type. Perhaps the definition of bfd_vma can be moved outside of bfd.h. @@ -107,7 +109,13 @@ typedef struct cgen_cpu_desc *CGEN_CPU_DESC; /* Type of attribute values. */ -typedef int CGEN_ATTR_VALUE_TYPE; +typedef CGEN_BITSET CGEN_ATTR_VALUE_BITSET_TYPE; +typedef int CGEN_ATTR_VALUE_ENUM_TYPE; +typedef union +{ + CGEN_ATTR_VALUE_BITSET_TYPE bitset; + CGEN_ATTR_VALUE_ENUM_TYPE nonbitset; +} CGEN_ATTR_VALUE_TYPE; /* Struct to record attribute information. */ @@ -153,7 +161,9 @@ struct { unsigned int bool; \ #define CGEN_ATTR_VALUE(obj, attr_table, attr) \ ((unsigned int) (attr) < CGEN_ATTR_NBOOL_OFFSET \ ? ((CGEN_ATTR_BOOLS (attr_table) & CGEN_ATTR_MASK (attr)) != 0) \ - : ((attr_table)->nonbool[(attr) - CGEN_ATTR_NBOOL_OFFSET])) + : ((attr_table)->nonbool[(attr) - CGEN_ATTR_NBOOL_OFFSET].nonbitset)) +#define CGEN_BITSET_ATTR_VALUE(obj, attr_table, attr) \ + ((attr_table)->nonbool[(attr) - CGEN_ATTR_NBOOL_OFFSET].bitset) /* Attribute name/value tables. These are used to assist parsing of descriptions at run-time. */ @@ -161,7 +171,7 @@ struct { unsigned int bool; \ typedef struct { const char * name; - CGEN_ATTR_VALUE_TYPE value; + unsigned value; } CGEN_ATTR_ENTRY; /* For each domain (ifld,hw,operand,insn), list of attributes. */ @@ -965,6 +975,7 @@ typedef CGEN_ATTR_TYPE (CGEN_INSN_NBOOL_ATTRS) CGEN_INSN_ATTR_TYPE; typedef enum cgen_insn_attr { CGEN_INSN_ALIAS = 0 } CGEN_INSN_ATTR; +#define CGEN_ATTR_CGEN_INSN_ALIAS_VALUE(attrs) ((attrs)->bool & (1 << CGEN_INSN_ALIAS)) #endif /* This struct defines each entry in the instruction table. */ @@ -1016,6 +1027,8 @@ typedef struct /* Return value of attribute ATTR in INSN. */ #define CGEN_INSN_ATTR_VALUE(insn, attr) \ CGEN_ATTR_VALUE ((insn), CGEN_INSN_ATTRS (insn), (attr)) +#define CGEN_INSN_BITSET_ATTR_VALUE(insn, attr) \ + CGEN_BITSET_ATTR_VALUE ((insn), CGEN_INSN_ATTRS (insn), (attr)) } CGEN_IBASE; /* Return non-zero if INSN is the "invalid" insn marker. */ @@ -1179,10 +1192,9 @@ typedef struct cgen_cpu_desc /* Bitmap of selected machine(s) (a la BFD machine number). */ int machs; - /* Bitmap of selected isa(s). - ??? Simultaneous multiple isas might not make sense, but it's not (yet) - precluded. */ - int isas; + /* Bitmap of selected isa(s). */ + CGEN_BITSET *isas; +#define CGEN_CPU_ISAS(cd) ((cd)->isas) /* Current endian. */ enum cgen_endian endian; |