Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] sim/h8300/compile.c: Fix formatting.
@ 2002-05-18  4:41 Kazu Hirata
  2002-05-18 12:43 ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Kazu Hirata @ 2002-05-18  4:41 UTC (permalink / raw)
  To: gdb-patches

Hi,

Attached is a patch to fix formatting.  Committed as obvious.

Kazu Hirata

2002-05-18  Kazu Hirata  <kazu@cs.umass.edu>

	* compile.c: Fix formatting.

Index: compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.13
diff -u -r1.13 compile.c
--- compile.c	17 May 2002 19:22:14 -0000	1.13
+++ compile.c	18 May 2002 11:30:21 -0000
@@ -1044,10 +1044,10 @@
 #endif
 
       if (code->opcode)
-       {
-        cycles += code->cycles;
-        insts++;
-       }
+	{
+	  cycles += code->cycles;
+	  insts++;
+	}
 
       switch (code->opcode)
 	{
@@ -1139,35 +1139,35 @@
 
 	case O (O_EEPMOV, SB):
 	case O (O_EEPMOV, SW):
-		 if(h8300hmode||h8300smode)
-	          {
-		    register unsigned char *_src,*_dst;
-		    unsigned int count = (code->opcode==O(O_EEPMOV, SW))?cpu.regs[R4_REGNUM]&0xffff:
-									 cpu.regs[R4_REGNUM]&0xff;
-
-		   _src = cpu.regs[R5_REGNUM] < memory_size ? cpu.memory+cpu.regs[R5_REGNUM] :
-	           				       	      cpu.eightbit + (cpu.regs[R5_REGNUM] & 0xff);
-		   if((_src+count)>=(cpu.memory+memory_size))
-		   {
-			   if((_src+count)>=(cpu.eightbit+0x100))
-			      goto illegal;
-		   }
-		   _dst = cpu.regs[R6_REGNUM] < memory_size ? cpu.memory+cpu.regs[R6_REGNUM] :
+	  if(h8300hmode||h8300smode)
+	    {
+	      register unsigned char *_src,*_dst;
+	      unsigned int count = (code->opcode==O(O_EEPMOV, SW))?cpu.regs[R4_REGNUM]&0xffff:
+		cpu.regs[R4_REGNUM]&0xff;
+
+	      _src = cpu.regs[R5_REGNUM] < memory_size ? cpu.memory+cpu.regs[R5_REGNUM] :
+		cpu.eightbit + (cpu.regs[R5_REGNUM] & 0xff);
+	      if((_src+count)>=(cpu.memory+memory_size))
+		{
+		  if((_src+count)>=(cpu.eightbit+0x100))
+		    goto illegal;
+		}
+	      _dst = cpu.regs[R6_REGNUM] < memory_size ? cpu.memory+cpu.regs[R6_REGNUM] :
 	           				       	      cpu.eightbit + (cpu.regs[R6_REGNUM] & 0xff);
-		   if((_dst+count)>=(cpu.memory+memory_size))
-		   {
-			   if((_dst+count)>=(cpu.eightbit+0x100))
-			      goto illegal;
-		   }
-		   memcpy(_dst,_src,count);
-
-		   cpu.regs[R5_REGNUM]+=count;
-		   cpu.regs[R6_REGNUM]+=count;
-		   cpu.regs[R4_REGNUM]&=(code->opcode==O(O_EEPMOV, SW))?(~0xffff):(~0xff);
-		   cycles += 2*count;
-	           goto next;
-	     }
-	    goto illegal;
+	      if((_dst+count)>=(cpu.memory+memory_size))
+		{
+		  if((_dst+count)>=(cpu.eightbit+0x100))
+		    goto illegal;
+		}
+	      memcpy(_dst,_src,count);
+
+	      cpu.regs[R5_REGNUM]+=count;
+	      cpu.regs[R6_REGNUM]+=count;
+	      cpu.regs[R4_REGNUM]&=(code->opcode==O(O_EEPMOV, SW))?(~0xffff):(~0xff);
+	      cycles += 2*count;
+	      goto next;
+	    }
+	  goto illegal;
 
 	case O (O_ADDS, SL):
 	  SET_L_REG (code->dst.reg,
@@ -1256,59 +1256,59 @@
 	  goto setc;
 	case O (O_STC, SB):
 	case O (O_STC, SW):
-          if(code->src.type==OP_CCR)
-          {
-	     GET_CCR(res);
-          }
-          else if(code->src.type==OP_EXR && h8300smode)
-          {
-	     GET_EXR(res);
-          }
-          else
+	  if(code->src.type==OP_CCR)
+	    {
+	      GET_CCR(res);
+	    }
+	  else if(code->src.type==OP_EXR && h8300smode)
+	    {
+	      GET_EXR(res);
+	    }
+	  else
 	    goto illegal;
 	  store (&code->dst, res);
 	  goto next;
 
 	case O (O_ANDC, SB):
-          if(code->dst.type==OP_CCR)
-          {
-	     GET_CCR (rd);
-          }
-          else if(code->dst.type==OP_EXR && h8300smode)
-          {
-	     GET_EXR (rd);
-          }
-          else
+	  if(code->dst.type==OP_CCR)
+	    {
+	      GET_CCR (rd);
+	    }
+	  else if(code->dst.type==OP_EXR && h8300smode)
+	    {
+	      GET_EXR (rd);
+	    }
+	  else
 	    goto illegal;
 	  ea = code->src.literal;
 	  res = rd & ea;
 	  goto setc;
 
 	case O (O_ORC, SB):
-          if(code->dst.type==OP_CCR)
-          {
-	     GET_CCR (rd);
-          }
-          else if(code->dst.type==OP_EXR && h8300smode)
-          {
-	     GET_EXR (rd);
-          }
-          else
+	  if(code->dst.type==OP_CCR)
+	    {
+	      GET_CCR (rd);
+	    }
+	  else if(code->dst.type==OP_EXR && h8300smode)
+	    {
+	      GET_EXR (rd);
+	    }
+	  else
 	    goto illegal;
 	  ea = code->src.literal;
 	  res = rd | ea;
 	  goto setc;
 
 	case O (O_XORC, SB):
-          if(code->dst.type==OP_CCR)
-          {
-	     GET_CCR (rd);
-          }
-          else if(code->dst.type==OP_EXR && h8300smode)
-          {
-	     GET_EXR (rd);
-          }
-          else
+	  if(code->dst.type==OP_CCR)
+	    {
+	      GET_CCR (rd);
+	    }
+	  else if(code->dst.type==OP_EXR && h8300smode)
+	    {
+	      GET_EXR (rd);
+	    }
+	  else
 	    goto illegal;
 	  ea = code->src.literal;
 	  res = rd ^ ea;
@@ -1489,7 +1489,7 @@
              the macros here instead of looking for .../sys/wait.h.  */
 #define SIM_WIFEXITED(v) (((v) & 0xff) == 0)
 #define SIM_WIFSIGNALED(v) (((v) & 0x7f) > 0 && (((v) & 0x7f) < 0x7f))
-  	  if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0])) 
+  	  if (! SIM_WIFEXITED (cpu.regs[0]) && SIM_WIFSIGNALED (cpu.regs[0]))
 	    cpu.exception = SIGILL;
 	  else
 	    cpu.exception = SIGTRAP;
@@ -1502,7 +1502,7 @@
 	  OBITOP (O_BNOT, 1, 1, ea ^= m);
 	  OBITOP (O_BTST, 1, 0, nz = ea & m);
 	  OBITOP (O_BCLR, 1, 1, ea &= ~m);
-	  OBITOP (O_BSET, 1, 1, ea |= m);	
+	  OBITOP (O_BSET, 1, 1, ea |= m);
 	  OBITOP (O_BLD, 1, 0, c = ea & m);
 	  OBITOP (O_BILD, 1, 0, c = !(ea & m));
 	  OBITOP (O_BST, 1, 1, ea &= ~m;
@@ -1534,20 +1534,20 @@
 	  break;
 
 	case O (O_TAS, SB):
-          if( !h8300smode || code->src.type != X (OP_REG, SL) )
-          	goto illegal;
-          switch(code->src.reg)
-          {
-           case R0_REGNUM:
-           case R1_REGNUM:
-           case R4_REGNUM:
-           case R5_REGNUM:
-           	break;
-           default:
-             goto illegal;
-          }
-          res =  fetch (&code->src);
-          store (&code->src,res|0x80);
+	  if( !h8300smode || code->src.type != X (OP_REG, SL) )
+	    goto illegal;
+	  switch(code->src.reg)
+	    {
+	    case R0_REGNUM:
+	    case R1_REGNUM:
+	    case R4_REGNUM:
+	    case R5_REGNUM:
+	      break;
+	    default:
+	      goto illegal;
+	    }
+	  res = fetch (&code->src);
+	  store (&code->src,res|0x80);
 	  goto just_flags_log8;
 
 	case O (O_DIVU, SB):
@@ -1682,17 +1682,17 @@
 
     setc:
       if(code->dst.type==OP_CCR)
-      {
-       cpu.ccr = res;
-       GETSR ();
-      }
+	{
+	  cpu.ccr = res;
+	  GETSR ();
+	}
       else if(code->dst.type==OP_EXR && h8300smode)
-      {
-       cpu.exr = res;
-       GETEXR ();
-      }
+	{
+	  cpu.exr = res;
+	  GETEXR ();
+	}
       else
-	 goto illegal;
+	goto illegal;
 
       goto next;
 
@@ -1995,7 +1995,7 @@
   init_pointers ();
 
   if(!h8300smode && rn >=EXR_REGNUM)
-  	rn++;
+    rn++;
   switch (rn)
     {
     default:


^ permalink raw reply	[flat|nested] 4+ messages in thread
* RE: [patch] sim/h8300/compile.c: Fix formatting.
@ 2002-05-20  3:22 Andrew Volkov
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Volkov @ 2002-05-20  3:22 UTC (permalink / raw)
  To: Andrew Cagney, Kazu Hirata; +Cc: gdb-patches

Hi

>
>AndrewV,
>
>Don't forget the coding standard:
>
>	http://www.gnu.org/prep/standards_toc.html
>
>One thing I noticed is variables like ``_dst''.  The leading 
>underscore 
>shouldn't be used.
>
>enjoy,
>Andrew
>
>

Corrected

Andrey

2002-05-20  Andrey Volkov  (avolkov@transas.com)

	* compile.c: remove leading undescores in EEPMOV case.

Index: compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.15
diff -u -r1.15 compile.c
--- compile.c	19 May 2002 12:52:54 -0000	1.15
+++ compile.c	20 May 2002 10:12:16 -0000
@@ -1141,25 +1141,25 @@
 	case O (O_EEPMOV, SW):
 	  if (h8300hmode||h8300smode)
 	    {
-	      register unsigned char *_src,*_dst;
+	      register unsigned char *src,*dst;
 	      unsigned int count = (code->opcode == O(O_EEPMOV,
SW))?cpu.regs[R4_REGNUM]&0xffff:
 		cpu.regs[R4_REGNUM]&0xff;
 
-	      _src = cpu.regs[R5_REGNUM] < memory_size ?
cpu.memory+cpu.regs[R5_REGNUM] :
+	      src = cpu.regs[R5_REGNUM] < memory_size ?
cpu.memory+cpu.regs[R5_REGNUM] :
 		cpu.eightbit + (cpu.regs[R5_REGNUM] & 0xff);
-	      if ((_src+count)>=(cpu.memory+memory_size))
+	      if ((src+count)>=(cpu.memory+memory_size))
 		{
-		  if ((_src+count)>=(cpu.eightbit+0x100))
+		  if ((src+count)>=(cpu.eightbit+0x100))
 		    goto illegal;
 		}
-	      _dst = cpu.regs[R6_REGNUM] < memory_size ?
cpu.memory+cpu.regs[R6_REGNUM] :
+	      dst = cpu.regs[R6_REGNUM] < memory_size ?
cpu.memory+cpu.regs[R6_REGNUM] :
 	           				       	      cpu.eightbit +
(cpu.regs[R6_REGNUM] & 0xff);
-	      if ((_dst+count)>=(cpu.memory+memory_size))
+	      if ((dst+count)>=(cpu.memory+memory_size))
 		{
-		  if ((_dst+count)>=(cpu.eightbit+0x100))
+		  if ((dst+count)>=(cpu.eightbit+0x100))
 		    goto illegal;
 		}
-	      memcpy(_dst,_src,count);
+	      memcpy(dst,src,count);
 
 	      cpu.regs[R5_REGNUM]+=count;
 	      cpu.regs[R6_REGNUM]+=count;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-05-20 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-18  4:41 [patch] sim/h8300/compile.c: Fix formatting Kazu Hirata
2002-05-18 12:43 ` Andrew Cagney
2002-05-19  4:59   ` Kazu Hirata
2002-05-20  3:22 Andrew Volkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox