This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Dwarf and shift expressions


Patch below teaches gcc how to output dwarf debug info involving shift 
expressions.

I tripped over this requirement building an arm->i686 gcc cross. I never 
bothered to isolate a sane testcase, but the build now completes.

bootstrapped&Tested on i686-linux.
Ok?

Paul

2004-04-14  Paul Brook  <paul@codesourcery.com>

	* dwarf2out.c (mem_loc_descriptor): Handle shifts.

Index: dwarf2out.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/gcc/dwarf2out.c,v
retrieving revision 1.511
diff -u -p -r1.511 dwarf2out.c
--- a/dwarf2out.c	1 Apr 2004 03:50:28 -0000	1.511
+++ b/dwarf2out.c	14 Apr 2004 19:45:08 -0000
@@ -8435,6 +8435,7 @@ static dw_loc_descr_ref
 mem_loc_descriptor (rtx rtl, enum machine_mode mode, bool can_use_fbreg)
 {
   dw_loc_descr_ref mem_loc_result = NULL;
+  enum dwarf_location_atom op;
 
   /* Note that for a dynamically sized array, the location we will generate a
      description of here will be the lowest numbered location which is
@@ -8575,10 +8576,26 @@ mem_loc_descriptor (rtx rtl, enum machin
 	}
       break;
 
+    /* If a pseudo-reg is optimized away, it is possible for it to
+       be replaced with a MEM containing a multiply or shift.  */
     case MULT:
+      op = DW_OP_mul;
+      goto do_binop;
+
+    case ASHIFT:
+      op = DW_OP_shl;
+      goto do_binop;
+      
+    case ASHIFTRT:
+      op = DW_OP_shra;
+      goto do_binop;
+
+    case LSHIFTRT:
+      op = DW_OP_shr;
+      goto do_binop;
+
+    do_binop:
       {
-	/* If a pseudo-reg is optimized away, it is possible for it to
-	   be replaced with a MEM containing a multiply.  */
 	dw_loc_descr_ref op0 = mem_loc_descriptor (XEXP (rtl, 0), mode,
 						   can_use_fbreg);
 	dw_loc_descr_ref op1 = mem_loc_descriptor (XEXP (rtl, 1), mode,
@@ -8589,7 +8606,7 @@ mem_loc_descriptor (rtx rtl, enum machin
 
 	mem_loc_result = op0;
 	add_loc_descr (&mem_loc_result, op1);
-	add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_mul, 0, 0));
+	add_loc_descr (&mem_loc_result, new_loc_descr (op, 0, 0));
 	break;
       }
 


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