Patchwork Handle IF_THEN_ELSE in mem_loc_descriptor

login
register
mail settings
Submitter Jakub Jelinek
Date Sept. 30, 2010, 7:10 p.m.
Message ID <20100930191058.GL10599@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/66235/
State New
Headers show

Comments

Jakub Jelinek - Sept. 30, 2010, 7:10 p.m.
Hi!

I've noticed some cases where location info wasn't provided just
because IF_THEN_ELSE wasn't handled.  We already use bra+swap+drop
for min/max, this patch just adds it also for IF_THEN_ELSE.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2010-09-30  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (mem_loc_descriptor): Handle IF_THEN_ELSE.


	Jakub
Richard Henderson - Sept. 30, 2010, 7:12 p.m.
On 09/30/2010 12:10 PM, Jakub Jelinek wrote:
> 	* dwarf2out.c (mem_loc_descriptor): Handle IF_THEN_ELSE.

Ok.


r~

Patch

--- gcc/dwarf2out.c.jj	2010-09-30 09:27:39.000000000 +0200
+++ gcc/dwarf2out.c	2010-09-30 10:00:57.578771420 +0200
@@ -14251,8 +14251,32 @@  mem_loc_descriptor (rtx rtl, enum machin
 	}
       break;
 
-    case COMPARE:
     case IF_THEN_ELSE:
+      {
+	dw_loc_descr_ref op2, bra_node, drop_node;
+	op0 = mem_loc_descriptor (XEXP (rtl, 0), mode,
+				  VAR_INIT_STATUS_INITIALIZED);
+	op1 = mem_loc_descriptor (XEXP (rtl, 1), mode,
+				  VAR_INIT_STATUS_INITIALIZED);
+	op2 = mem_loc_descriptor (XEXP (rtl, 2), mode,
+				  VAR_INIT_STATUS_INITIALIZED);
+	if (op0 == NULL || op1 == NULL || op2 == NULL)
+	  break;
+
+	mem_loc_result = op1;
+	add_loc_descr (&mem_loc_result, op2);
+	add_loc_descr (&mem_loc_result, op0);
+	bra_node = new_loc_descr (DW_OP_bra, 0, 0);
+	add_loc_descr (&mem_loc_result, bra_node);
+	add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_swap, 0, 0));
+	drop_node = new_loc_descr (DW_OP_drop, 0, 0);
+	add_loc_descr (&mem_loc_result, drop_node);
+	bra_node->dw_loc_oprnd1.val_class = dw_val_class_loc;
+	bra_node->dw_loc_oprnd1.v.val_loc = drop_node;
+      }
+      break;
+
+    case COMPARE:
     case ROTATE:
     case ROTATERT:
     case TRUNCATE: