OSDN Git Service

* cgen asm/disasm
authorfche <fche>
Mon, 7 May 2001 17:55:20 +0000 (17:55 +0000)
committerfche <fche>
Mon, 7 May 2001 17:55:20 +0000 (17:55 +0000)
[opcodes/ChangeLog]
2001-05-07  Frank Ch. Eigler  <fche@redhat.com>

        * cgen-dis.in (default_print_insn): Tolerate min<base instructions
        even at end of a section.
        * cgen-ibld.in (extract_normal): Tolerate min!=base!=max instructions
        by ignoring precariously-unpacked insn_value in favor of raw buffer.

[cgen/ChangeLog]
2001-05-07  Frank Ch. Eigler  <fche@redhat.com>

        * iformat.scm (compute-insn-base-mask-length): Rewrite to tolerate
        various-base-length instruction sets.

cgen/ChangeLog
cgen/iformat.scm
opcodes/ChangeLog
opcodes/cgen-dis.in
opcodes/cgen-ibld.in

index 16f2d5b..13a0222 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-07  Frank Ch. Eigler  <fche@redhat.com>
+
+       * iformat.scm (compute-insn-base-mask-length): Rewrite to tolerate
+       various-base-length instruction sets.
+
 2001-04-02  Ben Elliston  <bje@redhat.com>
 
        * sid-cpu.scm (-last-insn): New function.
index 5ddef25..9a54d56 100644 (file)
 )
 
 ; Given FLD-LIST, compute the base length in bits.
-; Computing the min of state-base-insn-bitsize and the total-length
-; is for [V]LIW instruction sets.
+;
+; For variable length instruction sets, or with cpus with multiple
+; instruction sets, compute the base appropriate for this set of
+; ifields.  Check that ifields are not shared among isas with
+; inconsistent base insn lengths.
 
 (define (compute-insn-base-mask-length fld-list)
-  (min (state-base-insn-bitsize) (compute-insn-length fld-list))
+  (let* ((isa-base-bitsizes
+         (remove-duplicates
+          (map isa-base-insn-bitsize
+               (map current-isa-lookup
+                    (collect (lambda (ifld) 
+                               (bitset-attr->list (atlist-attr-value (obj-atlist ifld) 'ISA #f)))
+                             fld-list))))))
+    (if (= 1 (length isa-base-bitsizes))
+       (min (car isa-base-bitsizes) (compute-insn-length fld-list))
+       (error "ifields have inconsistent isa/base-insn-size values:" isa-base-bitsizes)))
 )
 
 ; Given FLD-LIST, compute the bitmask of constant values in the base part
index f4247e9..d390515 100644 (file)
@@ -1,3 +1,10 @@
+2001-05-07  Frank Ch. Eigler  <fche@redhat.com>
+
+       * cgen-dis.in (default_print_insn): Tolerate min<base instructions
+       even at end of a section.
+       * cgen-ibld.in (extract_normal): Tolerate min!=base!=max instructions
+       by ignoring precariously-unpacked insn_value in favor of raw buffer.
+
 2001-05-03  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
 
        * disassemble.c (disassembler_usage): Remove unused attribute.
index b2865f8..91fed7b 100644 (file)
@@ -334,18 +334,27 @@ default_print_insn (cd, pc, info)
      disassemble_info *info;
 {
   char buf[CGEN_MAX_INSN_SIZE];
+  int buflen;
   int status;
 
-  /* Read the base part of the insn.  */
+  /* Attempt to read the base part of the insn.  */
+  buflen = cd->base_insn_bitsize / 8;
+  status = (*info->read_memory_func) (pc, buf, buflen, info);
+
+  /* Try again with the minimum part, if min < base.  */
+  if (status != 0 && (cd->min_insn_bitsize < cd->base_insn_bitsize))
+    {
+      buflen = cd->min_insn_bitsize / 8;
+      status = (*info->read_memory_func) (pc, buf, buflen, info);
+    }
 
-  status = (*info->read_memory_func) (pc, buf, cd->base_insn_bitsize / 8, info);
   if (status != 0)
     {
       (*info->memory_error_func) (status, pc, info);
       return -1;
     }
 
-  return print_insn (cd, pc, info, buf, cd->base_insn_bitsize / 8);
+  return print_insn (cd, pc, info, buf, buflen);
 }
 
 /* Main entry point.
index 528e609..ca2f1e5 100644 (file)
@@ -428,9 +428,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);