aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2009-05-28 22:53:08 +0000
committerDJ Delorie <dj@redhat.com>2009-05-28 22:53:08 +0000
commitd285268e489645807d4e96e3b50bb3bf068d3e5f (patch)
treed65a89292951e4a1a1dbc4425490638daa8c80cd
parent8281e61f8929a3b6132f0951ef643cafde429df8 (diff)
downloadgdb-d285268e489645807d4e96e3b50bb3bf068d3e5f.zip
gdb-d285268e489645807d4e96e3b50bb3bf068d3e5f.tar.gz
gdb-d285268e489645807d4e96e3b50bb3bf068d3e5f.tar.bz2
[cgen]
* cpu/mep.opc (parse_signed16_range): New. (parse_unsigned16_range): New. * cpu/mep-ivc2.cpu (imm16p0, simm16p0): Use them. [opcodes] * mep-asm.c: Regenerate. * mep-desc.c: Regenerate.
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/mep-asm.c46
-rw-r--r--opcodes/mep-desc.c4
3 files changed, 51 insertions, 4 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 7a48ec9..200ddfc 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-28 DJ Delorie <dj@redhat.com>
+
+ * mep-asm.c: Regenerate.
+ * mep-desc.c: Regenerate.
+
2009-05-26 DJ Delorie <dj@redhat.com>
* mep-asm.c: Regenerate.
diff --git a/opcodes/mep-asm.c b/opcodes/mep-asm.c
index b0546f4..9843cf7 100644
--- a/opcodes/mep-asm.c
+++ b/opcodes/mep-asm.c
@@ -61,7 +61,9 @@ static const char * parse_insn_normal
const char * parse_mep_align (CGEN_CPU_DESC, const char **, enum cgen_operand_type, long *);
const char * parse_mep_alignu (CGEN_CPU_DESC, const char **, enum cgen_operand_type, unsigned long *);
static const char * parse_signed16 (CGEN_CPU_DESC, const char **, int, long *);
+static const char * parse_signed16_range (CGEN_CPU_DESC, const char **, int, long *);
static const char * parse_unsigned16 (CGEN_CPU_DESC, const char **, int, unsigned long *);
+static const char * parse_unsigned16_range (CGEN_CPU_DESC, const char **, int, unsigned long *);
static const char * parse_lo16 (CGEN_CPU_DESC, const char **, int, long *, long);
static const char * parse_unsigned7 (CGEN_CPU_DESC, const char **, enum cgen_operand_type, unsigned long *);
static const char * parse_zero (CGEN_CPU_DESC, const char **, int, long *);
@@ -316,6 +318,46 @@ parse_unsigned16 (CGEN_CPU_DESC cd,
return parse_lo16 (cd, strp, opindex, (long *) valuep, 0);
}
+static const char *
+parse_signed16_range (CGEN_CPU_DESC cd,
+ const char **strp,
+ int opindex,
+ signed long *valuep)
+{
+ const char *errmsg = 0;
+ signed long value;
+
+ errmsg = cgen_parse_signed_integer (cd, strp, opindex, & value);
+ if (errmsg)
+ return errmsg;
+
+ if (value < -32768 || value > 32767)
+ return _("Immediate is out of range -32768 to 32767");
+
+ *valuep = value;
+ return 0;
+}
+
+static const char *
+parse_unsigned16_range (CGEN_CPU_DESC cd,
+ const char **strp,
+ int opindex,
+ unsigned long *valuep)
+{
+ const char *errmsg = 0;
+ unsigned long value;
+
+ errmsg = cgen_parse_unsigned_integer (cd, strp, opindex, & value);
+ if (errmsg)
+ return errmsg;
+
+ if (value > 65535)
+ return _("Immediate is out of range 0 to 65535");
+
+ *valuep = value;
+ return 0;
+}
+
/* A special case of parse_signed16 which accepts only the value zero. */
static const char *
@@ -906,7 +948,7 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd,
errmsg = cgen_parse_keyword (cd, strp, & mep_cgen_opval_h_csr, & junk);
break;
case MEP_OPERAND_IMM16P0 :
- errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM16P0, (unsigned long *) (& fields->f_ivc2_imm16p0));
+ errmsg = parse_unsigned16_range (cd, strp, MEP_OPERAND_IMM16P0, (unsigned long *) (& fields->f_ivc2_imm16p0));
break;
case MEP_OPERAND_IMM3P12 :
errmsg = cgen_parse_unsigned_integer (cd, strp, MEP_OPERAND_IMM3P12, (unsigned long *) (& fields->f_ivc2_3u12));
@@ -1104,7 +1146,7 @@ mep_cgen_parse_operand (CGEN_CPU_DESC cd,
errmsg = parse_signed16 (cd, strp, MEP_OPERAND_SIMM16, (long *) (& fields->f_16s16));
break;
case MEP_OPERAND_SIMM16P0 :
- errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM16P0, (long *) (& fields->f_ivc2_simm16p0));
+ errmsg = parse_signed16_range (cd, strp, MEP_OPERAND_SIMM16P0, (long *) (& fields->f_ivc2_simm16p0));
break;
case MEP_OPERAND_SIMM6 :
errmsg = cgen_parse_signed_integer (cd, strp, MEP_OPERAND_SIMM6, (long *) (& fields->f_6s8));
diff --git a/opcodes/mep-desc.c b/opcodes/mep-desc.c
index 7c8510e..b773e4b 100644
--- a/opcodes/mep-desc.c
+++ b/opcodes/mep-desc.c
@@ -1335,11 +1335,11 @@ const CGEN_OPERAND mep_cgen_operand_table[] =
{ "ivc-x-0-5", MEP_OPERAND_IVC_X_0_5, HW_H_UINT, 0, 5,
{ 0, { (const PTR) &mep_cgen_ifld_table[MEP_F_IVC2_5U0] } },
{ 0, { { { (1<<MACH_BASE), 0 } }, { { 1, "\xfc" } }, { { CDATA_LONG, 0 } }, { { 1, 0 } } } } },
-/* imm16p0: Imm16p0 */
+/* imm16p0: comment */
{ "imm16p0", MEP_OPERAND_IMM16P0, HW_H_UINT, 0, 16,
{ 2, { (const PTR) &MEP_F_IVC2_IMM16P0_MULTI_IFIELD[0] } },
{ 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xfc" } }, { { CDATA_LONG, 0 } }, { { 1, 0 } } } } },
-/* simm16p0: sImm16p0 */
+/* simm16p0: comment */
{ "simm16p0", MEP_OPERAND_SIMM16P0, HW_H_SINT, 0, 16,
{ 2, { (const PTR) &MEP_F_IVC2_SIMM16P0_MULTI_IFIELD[0] } },
{ 0|A(VIRTUAL), { { { (1<<MACH_BASE), 0 } }, { { 1, "\xfc" } }, { { CDATA_LONG, 0 } }, { { 1, 0 } } } } },