From 5c3d17117abfc216b7fe7aca105baef67bd5a3ef Mon Sep 17 00:00:00 2001
From: hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 29 Mar 2002 17:07:59 +0000
Subject: [PATCH] 	* config/mmix/mmix.c
 (mmix_target_asm_function_prologue): Correct 	unwind information when
 frame_pointer_needed. 	(mmix_assemble_integer): Tweak wording in comment.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51562 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog          |  6 +++++
 gcc/config/mmix/mmix.c | 61 +++++++++++++++++++++++++-----------------
 2 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fbed9ce4623c..702a2d378fc2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2002-03-29  Hans-Peter Nilsson  <hp@bitrange.com>
+
+	* config/mmix/mmix.c (mmix_target_asm_function_prologue): Correct
+	unwind information when frame_pointer_needed.
+	(mmix_assemble_integer): Tweak wording in comment.
+
 2002-03-29  Neil Booth  <neil@daikokuya.demon.co.uk>
 
 	* Makefile.in (except.o): Update.
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index 6fe02275c6cc..c59baf3f776b 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -734,8 +734,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
 		     setting; they don't accumulate.  We must keep track
 		     of the offset ourselves.  */
 		  cfa_offset += stack_chunk;
-		  dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
-				     cfa_offset);
+		  if (!frame_pointer_needed)
+		    dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
+				       cfa_offset);
 		}
 	      offset += stack_chunk;
 	      stack_space_to_allocate -= stack_chunk;
@@ -768,11 +769,7 @@ mmix_target_asm_function_prologue (stream, locals_size)
 		   reg_names[MMIX_STACK_POINTER_REGNUM],
 		   stack_chunk);
 	  if (doing_dwarf)
-	    {
-	      cfa_offset += stack_chunk;
-	      dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
-				 cfa_offset);
-	    }
+	    cfa_offset += stack_chunk;
 	  offset += stack_chunk;
 	  stack_space_to_allocate -= stack_chunk;
 	}
@@ -785,8 +782,18 @@ mmix_target_asm_function_prologue (stream, locals_size)
 	       reg_names[MMIX_STACK_POINTER_REGNUM],
 	       offset + 8);
       if (doing_dwarf)
-	dwarf2out_reg_save ("", MMIX_FRAME_POINTER_REGNUM,
-			    -cfa_offset + offset);
+	{
+	  /* If we're using the frame-pointer, then we just need this CFA
+	     definition basing on that value (often equal to the CFA).
+	     Further changes to the stack-pointer do not affect the
+	     frame-pointer, so we conditionalize them below on
+	     !frame_pointer_needed.  */
+	  dwarf2out_def_cfa ("", MMIX_FRAME_POINTER_REGNUM,
+			     -cfa_offset + offset + 8);
+
+	  dwarf2out_reg_save ("", MMIX_FRAME_POINTER_REGNUM,
+			      -cfa_offset + offset);
+	}
 
       offset -= 8;
     }
@@ -811,8 +818,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
 	  if (doing_dwarf)
 	    {
 	      cfa_offset += stack_chunk;
-	      dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
-				 cfa_offset);
+	      if (!frame_pointer_needed)
+		dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
+				   cfa_offset);
 	    }
 	  offset += stack_chunk;
 	  stack_space_to_allocate -= stack_chunk;
@@ -850,7 +858,8 @@ mmix_target_asm_function_prologue (stream, locals_size)
 	  if (doing_dwarf)
 	    {
 	      cfa_offset += stack_chunk;
-	      dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
+	      if (!frame_pointer_needed)
+		dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
 				 cfa_offset);
 	    }
 	}
@@ -910,8 +919,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
 		if (doing_dwarf)
 		  {
 		    cfa_offset += stack_chunk;
-		    dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
-				       cfa_offset);
+		    if (!frame_pointer_needed)
+		      dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
+					 cfa_offset);
 		  }
 	      }
 	    else
@@ -925,8 +935,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
 		if (doing_dwarf)
 		  {
 		    cfa_offset += stack_chunk;
-		    dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
-				       cfa_offset);
+		    if (!frame_pointer_needed)
+		      dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
+					 cfa_offset);
 		  }
 	      }
 
@@ -965,8 +976,9 @@ mmix_target_asm_function_prologue (stream, locals_size)
       if (doing_dwarf)
 	{
 	  cfa_offset += stack_space_to_allocate;
-	  dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
-			     cfa_offset);
+	  if (!frame_pointer_needed)
+	    dwarf2out_def_cfa ("", MMIX_STACK_POINTER_REGNUM,
+			       cfa_offset);
 	}
     }
 
@@ -1913,13 +1925,12 @@ mmix_assemble_integer (x, size, aligned_p)
       {
 	/* We handle a limited number of types of operands in here.  But
 	   that's ok, because we can punt to generic functions.  We then
-	   pretend that we don't emit aligned data is needed, so the usual
-	   .pseudo syntax is used (which work for aligned data too).  We
-	   actually *must* do that, since we say we don't have simple
-	   aligned pseudos, causing this function to be called.  We just
-	   try and keep as much compatibility as possible with mmixal
-	   syntax for normal cases (i.e. without GNU extensions and C
-	   only).  */
+	   pretend that aligned data isn't needed, so the usual .<pseudo>
+	   syntax is used (which works for aligned data too).  We actually
+	   *must* do that, since we say we don't have simple aligned
+	   pseudos, causing this function to be called.  We just try and
+	   keep as much compatibility as possible with mmixal syntax for
+	   normal cases (i.e. without GNU extensions and C only).  */
       case 1:
 	if (GET_CODE (x) != CONST_INT)
 	  {
-- 
GitLab