aboutsummaryrefslogtreecommitdiff
path: root/opcodes/fr30-ibld.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-08-12 20:16:29 +0000
committerRichard Henderson <rth@redhat.com>2001-08-12 20:16:29 +0000
commitfc7bc88384beca1d62919c19120cc0e70c0d1e4e (patch)
tree2b4a692ea199f3df001384947d93ed529700d5c7 /opcodes/fr30-ibld.c
parentd8b6305a45989e1260db502c8fd13fba53d44c45 (diff)
downloadgdb-fc7bc88384beca1d62919c19120cc0e70c0d1e4e.zip
gdb-fc7bc88384beca1d62919c19120cc0e70c0d1e4e.tar.gz
gdb-fc7bc88384beca1d62919c19120cc0e70c0d1e4e.tar.bz2
* cgen-ibld.in (extract_normal): Match type of VALUE and MASK
to *VALUEP. Regenerate all cgen files.
Diffstat (limited to 'opcodes/fr30-ibld.c')
-rw-r--r--opcodes/fr30-ibld.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/opcodes/fr30-ibld.c b/opcodes/fr30-ibld.c
index 6bfca21..90ad6ef 100644
--- a/opcodes/fr30-ibld.c
+++ b/opcodes/fr30-ibld.c
@@ -145,7 +145,22 @@ insert_normal (cd, value, attrs, word_offset, start, length, word_length,
}
/* Ensure VALUE will fit. */
- if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
+ if (CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGN_OPT))
+ {
+ long minval = - (1L << (length - 1));
+ unsigned long maxval = mask;
+
+ if ((value > 0 && (unsigned long) value > maxval)
+ || value < minval)
+ {
+ /* xgettext:c-format */
+ sprintf (errbuf,
+ _("operand out of range (%ld not between %ld and %lu)"),
+ value, minval, maxval);
+ return errbuf;
+ }
+ }
+ else if (! CGEN_BOOL_ATTR (attrs, CGEN_IFLD_SIGNED))
{
unsigned long maxval = mask;
@@ -202,10 +217,10 @@ insert_normal (cd, value, attrs, word_offset, start, length, word_length,
}
/* Default insn builder (insert handler).
- The instruction is recorded in CGEN_INT_INSN_P byte order
- (meaning that if CGEN_INT_INSN_P BUFFER is an int * and thus the value is
- recorded in host byte order, otherwise BUFFER is an array of bytes and the
- value is recorded in target byte order).
+ The instruction is recorded in CGEN_INT_INSN_P byte order (meaning
+ that if CGEN_INSN_BYTES_PTR is an int * and thus, the value is
+ recorded in host byte order, otherwise BUFFER is an array of bytes
+ and the value is recorded in target byte order).
The result is an error message or NULL if success. */
static const char *
@@ -265,7 +280,7 @@ insert_insn_normal (cd, insn, fields, buffer, pc)
static void
put_insn_int_value (cd, buf, length, insn_length, value)
- CGEN_CPU_DESC cd;
+ CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
CGEN_INSN_BYTES_PTR buf;
int length;
int insn_length;
@@ -400,7 +415,7 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
#endif
long *valuep;
{
- CGEN_INSN_INT value, mask;
+ long value, mask;
/* If LENGTH is zero, this operand doesn't contribute to the value
so give it a standard value of zero. */
@@ -428,9 +443,9 @@ extract_normal (cd, ex_info, insn_value, attrs, word_offset, start, length,
word_length = total_length;
}
- /* Does the value reside in INSN_VALUE? */
+ /* Does the value reside in INSN_VALUE, and at the right alignment? */
- if (CGEN_INT_INSN_P || word_offset == 0)
+ if (CGEN_INT_INSN_P || (word_offset == 0 && word_length == total_length))
{
if (CGEN_INSN_LSB0_P)
value = insn_value >> ((word_offset + start + 1) - length);