Commit ea93971a by Jakub Jelinek Committed by Jakub Jelinek

dwarf2out.c (concat_loc_descriptor): Add can_use_fbreg argument, pass it down to loc_descriptor.

	* dwarf2out.c (concat_loc_descriptor): Add can_use_fbreg argument,
	pass it down to loc_descriptor.
	(loc_descriptor): Pass can_use_fbreg to concat_loc_descriptor.
	(containing_function_has_frame_base): Move earlier in the file.
	(loc_descriptor_from_tree_1): Use containing_function_has_frame_base
	instead of always assuming fbreg can't be used.

From-SVN: r103003
parent 8a42356f
2005-08-11 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (concat_loc_descriptor): Add can_use_fbreg argument,
pass it down to loc_descriptor.
(loc_descriptor): Pass can_use_fbreg to concat_loc_descriptor.
(containing_function_has_frame_base): Move earlier in the file.
(loc_descriptor_from_tree_1): Use containing_function_has_frame_base
instead of always assuming fbreg can't be used.
2005-08-11 David Edelsohn <edelsohn@gnu.org> 2005-08-11 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/altivec.md: Change constraint "m" to "Z". * config/rs6000/altivec.md: Change constraint "m" to "Z".
......
...@@ -3982,7 +3982,7 @@ static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT); ...@@ -3982,7 +3982,7 @@ static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
static dw_loc_descr_ref based_loc_descr (unsigned, HOST_WIDE_INT, bool); static dw_loc_descr_ref based_loc_descr (unsigned, HOST_WIDE_INT, bool);
static int is_based_loc (rtx); static int is_based_loc (rtx);
static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode, bool); static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode, bool);
static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx); static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx, bool);
static dw_loc_descr_ref loc_descriptor (rtx, bool); static dw_loc_descr_ref loc_descriptor (rtx, bool);
static dw_loc_descr_ref loc_descriptor_from_tree_1 (tree, int); static dw_loc_descr_ref loc_descriptor_from_tree_1 (tree, int);
static dw_loc_descr_ref loc_descriptor_from_tree (tree); static dw_loc_descr_ref loc_descriptor_from_tree (tree);
...@@ -8806,11 +8806,11 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode, bool can_use_fbreg) ...@@ -8806,11 +8806,11 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode, bool can_use_fbreg)
This is typically a complex variable. */ This is typically a complex variable. */
static dw_loc_descr_ref static dw_loc_descr_ref
concat_loc_descriptor (rtx x0, rtx x1) concat_loc_descriptor (rtx x0, rtx x1, bool can_use_fbreg)
{ {
dw_loc_descr_ref cc_loc_result = NULL; dw_loc_descr_ref cc_loc_result = NULL;
dw_loc_descr_ref x0_ref = loc_descriptor (x0, false); dw_loc_descr_ref x0_ref = loc_descriptor (x0, can_use_fbreg);
dw_loc_descr_ref x1_ref = loc_descriptor (x1, false); dw_loc_descr_ref x1_ref = loc_descriptor (x1, can_use_fbreg);
if (x0_ref == 0 || x1_ref == 0) if (x0_ref == 0 || x1_ref == 0)
return 0; return 0;
...@@ -8824,6 +8824,29 @@ concat_loc_descriptor (rtx x0, rtx x1) ...@@ -8824,6 +8824,29 @@ concat_loc_descriptor (rtx x0, rtx x1)
return cc_loc_result; return cc_loc_result;
} }
/* Return true if DECL's containing function has a frame base attribute.
Return false otherwise. */
static bool
containing_function_has_frame_base (tree decl)
{
tree declcontext = decl_function_context (decl);
dw_die_ref context;
dw_attr_ref attr;
if (!declcontext)
return false;
context = lookup_decl_die (declcontext);
if (!context)
return false;
for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
if (attr->dw_attr == DW_AT_frame_base)
return true;
return false;
}
/* Output a proper Dwarf location descriptor for a variable or parameter /* Output a proper Dwarf location descriptor for a variable or parameter
which is either allocated in a register or in a memory location. For a which is either allocated in a register or in a memory location. For a
register, we just generate an OP_REG and the register number. For a register, we just generate an OP_REG and the register number. For a
...@@ -8859,7 +8882,8 @@ loc_descriptor (rtx rtl, bool can_use_fbreg) ...@@ -8859,7 +8882,8 @@ loc_descriptor (rtx rtl, bool can_use_fbreg)
break; break;
case CONCAT: case CONCAT:
loc_result = concat_loc_descriptor (XEXP (rtl, 0), XEXP (rtl, 1)); loc_result = concat_loc_descriptor (XEXP (rtl, 0), XEXP (rtl, 1),
can_use_fbreg);
break; break;
case VAR_LOCATION: case VAR_LOCATION:
...@@ -9019,10 +9043,11 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) ...@@ -9019,10 +9043,11 @@ loc_descriptor_from_tree_1 (tree loc, int want_address)
else else
{ {
enum machine_mode mode; enum machine_mode mode;
bool can_use_fb = containing_function_has_frame_base (loc);
/* Certain constructs can only be represented at top-level. */ /* Certain constructs can only be represented at top-level. */
if (want_address == 2) if (want_address == 2)
return loc_descriptor (rtl, false); return loc_descriptor (rtl, can_use_fb);
mode = GET_MODE (rtl); mode = GET_MODE (rtl);
if (MEM_P (rtl)) if (MEM_P (rtl))
...@@ -9030,7 +9055,7 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) ...@@ -9030,7 +9055,7 @@ loc_descriptor_from_tree_1 (tree loc, int want_address)
rtl = XEXP (rtl, 0); rtl = XEXP (rtl, 0);
have_address = 1; have_address = 1;
} }
ret = mem_loc_descriptor (rtl, mode, false); ret = mem_loc_descriptor (rtl, mode, can_use_fb);
} }
} }
break; break;
...@@ -9104,12 +9129,14 @@ loc_descriptor_from_tree_1 (tree loc, int want_address) ...@@ -9104,12 +9129,14 @@ loc_descriptor_from_tree_1 (tree loc, int want_address)
/* Get an RTL for this, if something has been emitted. */ /* Get an RTL for this, if something has been emitted. */
rtx rtl = lookup_constant_def (loc); rtx rtl = lookup_constant_def (loc);
enum machine_mode mode; enum machine_mode mode;
bool can_use_fb;
if (!rtl || !MEM_P (rtl)) if (!rtl || !MEM_P (rtl))
return 0; return 0;
can_use_fb = containing_function_has_frame_base (loc);
mode = GET_MODE (rtl); mode = GET_MODE (rtl);
rtl = XEXP (rtl, 0); rtl = XEXP (rtl, 0);
ret = mem_loc_descriptor (rtl, mode, false); ret = mem_loc_descriptor (rtl, mode, can_use_fb);
have_address = 1; have_address = 1;
break; break;
} }
...@@ -10073,29 +10100,6 @@ rtl_for_decl_location (tree decl) ...@@ -10073,29 +10100,6 @@ rtl_for_decl_location (tree decl)
return rtl; return rtl;
} }
/* Return true if DECL's containing function has a frame base attribute.
Return false otherwise. */
static bool
containing_function_has_frame_base (tree decl)
{
tree declcontext = decl_function_context (decl);
dw_die_ref context;
dw_attr_ref attr;
if (!declcontext)
return false;
context = lookup_decl_die (declcontext);
if (!context)
return false;
for (attr = context->die_attr; attr; attr = attr->dw_attr_next)
if (attr->dw_attr == DW_AT_frame_base)
return true;
return false;
}
/* Generate *either* a DW_AT_location attribute or else a DW_AT_const_value /* Generate *either* a DW_AT_location attribute or else a DW_AT_const_value
data attribute for a variable or a parameter. We generate the data attribute for a variable or a parameter. We generate the
DW_AT_const_value attribute only in those cases where the given variable DW_AT_const_value attribute only in those cases where the given variable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment