This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] sim/h8300/compile.c: Clean up the code.


Hi,

Attached is a patch to clean up the code in sim/h8300/compile.c.  The
real purpose is to sync with opcodes/h8300-dis.c.  These two files
should not diverge more than they have to.

Thanks,

Kazu Hirata

===File ~/gnu/gdb/ChangeLog-compile=========================
2000-07-27  Kazu Hirata  <kazu@hxi.com>

	* compile.c (decode): Clean up the code.

============================================================

===File ~/gnu/gdb/compile.patch=============================
Index: compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.5
diff -u -r1.5 compile.c
--- compile.c	2000/07/27 09:39:50	1.5
+++ compile.c	2000/07/27 14:30:38
@@ -172,20 +172,18 @@
   int abs = 0;
   int bit = 0;
   int plen = 0;
-  struct h8_opcode *q = h8_opcodes;
+  struct h8_opcode *q;
   int size = 0;
 
   dst->dst.type = -1;
   dst->src.type = -1;
 
   /* Find the exact opcode/arg combo.  */
-  while (q->name)
+  for (q = h8_opcodes; q->name; q++)
     {
-      op_type *nib;
+      op_type *nib = q->data.nib;
       unsigned int len = 0;
 
-      nib = q->data.nib;
-
       while (1)
 	{
 	  op_type looking_for = *nib;
@@ -356,8 +354,8 @@
 			  }
 			else if (x & REG)
 			  {
-			    /* Reset the size, some
-			       ops (like mul) have two sizes */
+			    /* Reset the size.
+			       Some ops (like mul) have two sizes.  */
 
 			    size = bitfrom (x);
 			    p->type = X (OP_REG, size);
@@ -456,7 +454,7 @@
 	}
 
     fail:
-      q++;
+      ;
     }
 
   /* Fell off the end.  */
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]