Commit 094d7661 by Bernd Schmidt Committed by Bernd Schmidt

dwarf2out.c (struct dw_cfi_struct): Remove member dw_cfi_next.

	* dwarf2out.c (struct dw_cfi_struct): Remove member dw_cfi_next.
	(dw_cfi_ref): Add DEF_VEC_P and some DEF_VEC_ALLOC_Ps.
	(cfi_vec): New typedef.
	(struct dw_fde_struct): Make dw_fde_cfi a cfi_vec. Replace
	dw_fde_switch_cfi with an integer dw_fde_switch_cfi_index.
	(cie_cfi_vec): New static variable.
	(cie_cfi_head): Delete.
	(add_cfi): Accept a cfi_vec * as first argument. All callers and
	declaration changed. Use vector rather than list operations.
	(new_cfi): Don't initialize the dw_cfi_next field.
	(add_fde_cfi): Allocate cie_cfi_vec if necessary. Use vector
	rather than list operations.
	(lookup_cfa): Use vector rather than list operations.
	(output_cfis): New argument upto. Accept a cfi_vec rather than
	a dw_cfi_ref list head as argument. All callers changed.
	Iterate over the vector using upto as a maximum index.
	(output_all_cfis): New static function.
	(output_fde): Use vector rather than list operations. Use the
	new upto argument for output_cfis rather than manipulating a
	list.
	(dwarf2out_begin_prologue): Change initializations to match
	new struct members.
	(dwarf2out_switch_text_section): Initialize dw_fde_switch_cfi_index
	from the vector length rather than searching for the end of a list.
	Use output_all_cfis.
	(convert_cfa_to_fb_loc_list): Use vector rather than list operations.

From-SVN: r172369
parent 673a5740
2011-04-13 Bernd Schmidt <bernds@codesourcery.com>
* dwarf2out.c (struct dw_cfi_struct): Remove member dw_cfi_next.
(dw_cfi_ref): Add DEF_VEC_P and some DEF_VEC_ALLOC_Ps.
(cfi_vec): New typedef.
(struct dw_fde_struct): Make dw_fde_cfi a cfi_vec. Replace
dw_fde_switch_cfi with an integer dw_fde_switch_cfi_index.
(cie_cfi_vec): New static variable.
(cie_cfi_head): Delete.
(add_cfi): Accept a cfi_vec * as first argument. All callers and
declaration changed. Use vector rather than list operations.
(new_cfi): Don't initialize the dw_cfi_next field.
(add_fde_cfi): Allocate cie_cfi_vec if necessary. Use vector
rather than list operations.
(lookup_cfa): Use vector rather than list operations.
(output_cfis): New argument upto. Accept a cfi_vec rather than
a dw_cfi_ref list head as argument. All callers changed.
Iterate over the vector using upto as a maximum index.
(output_all_cfis): New static function.
(output_fde): Use vector rather than list operations. Use the
new upto argument for output_cfis rather than manipulating a
list.
(dwarf2out_begin_prologue): Change initializations to match
new struct members.
(dwarf2out_switch_text_section): Initialize dw_fde_switch_cfi_index
from the vector length rather than searching for the end of a list.
Use output_all_cfis.
(convert_cfa_to_fb_loc_list): Use vector rather than list operations.
2011-04-13 Nick Clifton <nickc@redhat.com> 2011-04-13 Nick Clifton <nickc@redhat.com>
* config/rx/rx.md (movmemsi): Do not use this pattern when * config/rx/rx.md (movmemsi): Do not use this pattern when
......
...@@ -267,7 +267,6 @@ typedef union GTY(()) dw_cfi_oprnd_struct { ...@@ -267,7 +267,6 @@ typedef union GTY(()) dw_cfi_oprnd_struct {
dw_cfi_oprnd; dw_cfi_oprnd;
typedef struct GTY(()) dw_cfi_struct { typedef struct GTY(()) dw_cfi_struct {
dw_cfi_ref dw_cfi_next;
enum dwarf_call_frame_info dw_cfi_opc; enum dwarf_call_frame_info dw_cfi_opc;
dw_cfi_oprnd GTY ((desc ("dw_cfi_oprnd1_desc (%1.dw_cfi_opc)"))) dw_cfi_oprnd GTY ((desc ("dw_cfi_oprnd1_desc (%1.dw_cfi_opc)")))
dw_cfi_oprnd1; dw_cfi_oprnd1;
...@@ -276,6 +275,12 @@ typedef struct GTY(()) dw_cfi_struct { ...@@ -276,6 +275,12 @@ typedef struct GTY(()) dw_cfi_struct {
} }
dw_cfi_node; dw_cfi_node;
DEF_VEC_P (dw_cfi_ref);
DEF_VEC_ALLOC_P (dw_cfi_ref, heap);
DEF_VEC_ALLOC_P (dw_cfi_ref, gc);
typedef VEC(dw_cfi_ref, gc) *cfi_vec;
/* This is how we define the location of the CFA. We use to handle it /* This is how we define the location of the CFA. We use to handle it
as REG + OFFSET all the time, but now it can be more complex. as REG + OFFSET all the time, but now it can be more complex.
It can now be either REG + CFA_OFFSET or *(REG + BASE_OFFSET) + CFA_OFFSET. It can now be either REG + CFA_OFFSET or *(REG + BASE_OFFSET) + CFA_OFFSET.
...@@ -304,8 +309,8 @@ typedef struct GTY(()) dw_fde_struct { ...@@ -304,8 +309,8 @@ typedef struct GTY(()) dw_fde_struct {
const char *dw_fde_vms_begin_epilogue; const char *dw_fde_vms_begin_epilogue;
const char *dw_fde_second_begin; const char *dw_fde_second_begin;
const char *dw_fde_second_end; const char *dw_fde_second_end;
dw_cfi_ref dw_fde_cfi; cfi_vec dw_fde_cfi;
dw_cfi_ref dw_fde_switch_cfi; /* Last CFI before switching sections. */ int dw_fde_switch_cfi_index; /* Last CFI before switching sections. */
HOST_WIDE_INT stack_realignment; HOST_WIDE_INT stack_realignment;
unsigned funcdef_number; unsigned funcdef_number;
/* Dynamic realign argument pointer register. */ /* Dynamic realign argument pointer register. */
...@@ -410,8 +415,8 @@ current_fde (void) ...@@ -410,8 +415,8 @@ current_fde (void)
return fde_table_in_use ? &fde_table[fde_table_in_use - 1] : NULL; return fde_table_in_use ? &fde_table[fde_table_in_use - 1] : NULL;
} }
/* A list of call frame insns for the CIE. */ /* A vector of call frame insns for the CIE. */
static GTY(()) dw_cfi_ref cie_cfi_head; static GTY(()) cfi_vec cie_cfi_vec;
/* Some DWARF extensions (e.g., MIPS/SGI) implement a subprogram /* Some DWARF extensions (e.g., MIPS/SGI) implement a subprogram
attribute that accelerates the lookup of the FDE associated attribute that accelerates the lookup of the FDE associated
...@@ -451,7 +456,7 @@ static GTY(()) section *cold_text_section; ...@@ -451,7 +456,7 @@ static GTY(()) section *cold_text_section;
static char *stripattributes (const char *); static char *stripattributes (const char *);
static const char *dwarf_cfi_name (unsigned); static const char *dwarf_cfi_name (unsigned);
static dw_cfi_ref new_cfi (void); static dw_cfi_ref new_cfi (void);
static void add_cfi (dw_cfi_ref *, dw_cfi_ref); static void add_cfi (cfi_vec *, dw_cfi_ref);
static void add_fde_cfi (const char *, dw_cfi_ref); static void add_fde_cfi (const char *, dw_cfi_ref);
static void lookup_cfa_1 (dw_cfi_ref, dw_cfa_location *, dw_cfa_location *); static void lookup_cfa_1 (dw_cfi_ref, dw_cfa_location *, dw_cfa_location *);
static void lookup_cfa (dw_cfa_location *); static void lookup_cfa (dw_cfa_location *);
...@@ -807,7 +812,6 @@ new_cfi (void) ...@@ -807,7 +812,6 @@ new_cfi (void)
{ {
dw_cfi_ref cfi = ggc_alloc_dw_cfi_node (); dw_cfi_ref cfi = ggc_alloc_dw_cfi_node ();
cfi->dw_cfi_next = NULL;
cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0; cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0;
cfi->dw_cfi_oprnd2.dw_cfi_reg_num = 0; cfi->dw_cfi_oprnd2.dw_cfi_reg_num = 0;
...@@ -817,9 +821,8 @@ new_cfi (void) ...@@ -817,9 +821,8 @@ new_cfi (void)
/* Add a Call Frame Instruction to list of instructions. */ /* Add a Call Frame Instruction to list of instructions. */
static inline void static inline void
add_cfi (dw_cfi_ref *list_head, dw_cfi_ref cfi) add_cfi (cfi_vec *vec, dw_cfi_ref cfi)
{ {
dw_cfi_ref *p;
dw_fde_ref fde = current_fde (); dw_fde_ref fde = current_fde ();
/* When DRAP is used, CFA is defined with an expression. Redefine /* When DRAP is used, CFA is defined with an expression. Redefine
...@@ -841,11 +844,7 @@ add_cfi (dw_cfi_ref *list_head, dw_cfi_ref cfi) ...@@ -841,11 +844,7 @@ add_cfi (dw_cfi_ref *list_head, dw_cfi_ref cfi)
break; break;
} }
/* Find the end of the chain. */ VEC_safe_push (dw_cfi_ref, gc, *vec, cfi);
for (p = list_head; (*p) != NULL; p = &(*p)->dw_cfi_next)
;
*p = cfi;
} }
/* Generate a new label for the CFI info to refer to. FORCE is true /* Generate a new label for the CFI info to refer to. FORCE is true
...@@ -885,7 +884,12 @@ static bool any_cfis_emitted; ...@@ -885,7 +884,12 @@ static bool any_cfis_emitted;
static void static void
add_fde_cfi (const char *label, dw_cfi_ref cfi) add_fde_cfi (const char *label, dw_cfi_ref cfi)
{ {
dw_cfi_ref *list_head; cfi_vec *vec;
if (cie_cfi_vec == NULL)
cie_cfi_vec = VEC_alloc (dw_cfi_ref, gc, 20);
vec = &cie_cfi_vec;
if (emit_cfa_remember) if (emit_cfa_remember)
{ {
...@@ -898,8 +902,6 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi) ...@@ -898,8 +902,6 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
add_fde_cfi (label, cfi_remember); add_fde_cfi (label, cfi_remember);
} }
list_head = &cie_cfi_head;
if (dwarf2out_do_cfi_asm ()) if (dwarf2out_do_cfi_asm ())
{ {
if (label) if (label)
...@@ -957,7 +959,7 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi) ...@@ -957,7 +959,7 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
output_cfi_directive (cfi); output_cfi_directive (cfi);
list_head = &fde->dw_fde_cfi; vec = &fde->dw_fde_cfi;
any_cfis_emitted = true; any_cfis_emitted = true;
} }
/* ??? If this is a CFI for the CIE, we don't emit. This /* ??? If this is a CFI for the CIE, we don't emit. This
...@@ -995,11 +997,11 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi) ...@@ -995,11 +997,11 @@ add_fde_cfi (const char *label, dw_cfi_ref cfi)
fde->dw_fde_current_label = label; fde->dw_fde_current_label = label;
} }
list_head = &fde->dw_fde_cfi; vec = &fde->dw_fde_cfi;
any_cfis_emitted = true; any_cfis_emitted = true;
} }
add_cfi (list_head, cfi); add_cfi (vec, cfi);
} }
/* Subroutine of lookup_cfa. */ /* Subroutine of lookup_cfa. */
...@@ -1046,6 +1048,7 @@ lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember) ...@@ -1046,6 +1048,7 @@ lookup_cfa_1 (dw_cfi_ref cfi, dw_cfa_location *loc, dw_cfa_location *remember)
static void static void
lookup_cfa (dw_cfa_location *loc) lookup_cfa (dw_cfa_location *loc)
{ {
int ix;
dw_cfi_ref cfi; dw_cfi_ref cfi;
dw_fde_ref fde; dw_fde_ref fde;
dw_cfa_location remember; dw_cfa_location remember;
...@@ -1054,12 +1057,12 @@ lookup_cfa (dw_cfa_location *loc) ...@@ -1054,12 +1057,12 @@ lookup_cfa (dw_cfa_location *loc)
loc->reg = INVALID_REGNUM; loc->reg = INVALID_REGNUM;
remember = *loc; remember = *loc;
for (cfi = cie_cfi_head; cfi; cfi = cfi->dw_cfi_next) FOR_EACH_VEC_ELT (dw_cfi_ref, cie_cfi_vec, ix, cfi)
lookup_cfa_1 (cfi, loc, &remember); lookup_cfa_1 (cfi, loc, &remember);
fde = current_fde (); fde = current_fde ();
if (fde) if (fde)
for (cfi = fde->dw_fde_cfi; cfi; cfi = cfi->dw_cfi_next) FOR_EACH_VEC_ELT (dw_cfi_ref, fde->dw_fde_cfi, ix, cfi)
lookup_cfa_1 (cfi, loc, &remember); lookup_cfa_1 (cfi, loc, &remember);
} }
...@@ -3430,24 +3433,26 @@ output_cfi_directive (dw_cfi_ref cfi) ...@@ -3430,24 +3433,26 @@ output_cfi_directive (dw_cfi_ref cfi)
} }
} }
DEF_VEC_P (dw_cfi_ref); /* Output CFIs from VEC, up to index UPTO, to bring current FDE to the
DEF_VEC_ALLOC_P (dw_cfi_ref, heap); same state as after executing CFIs in CFI chain. DO_CFI_ASM is
true if .cfi_* directives shall be emitted, false otherwise. If it
/* Output CFIs to bring current FDE to the same state as after executing is false, FDE and FOR_EH are the other arguments to pass to
CFIs in CFI chain. DO_CFI_ASM is true if .cfi_* directives shall output_cfi. */
be emitted, false otherwise. If it is false, FDE and FOR_EH are the
other arguments to pass to output_cfi. */
static void static void
output_cfis (dw_cfi_ref cfi, bool do_cfi_asm, dw_fde_ref fde, bool for_eh) output_cfis (cfi_vec vec, int upto, bool do_cfi_asm,
dw_fde_ref fde, bool for_eh)
{ {
int ix;
struct dw_cfi_struct cfi_buf; struct dw_cfi_struct cfi_buf;
dw_cfi_ref cfi2; dw_cfi_ref cfi2;
dw_cfi_ref cfi_args_size = NULL, cfi_cfa = NULL, cfi_cfa_offset = NULL; dw_cfi_ref cfi_args_size = NULL, cfi_cfa = NULL, cfi_cfa_offset = NULL;
VEC (dw_cfi_ref, heap) *regs = VEC_alloc (dw_cfi_ref, heap, 32); VEC(dw_cfi_ref, heap) *regs = VEC_alloc (dw_cfi_ref, heap, 32);
unsigned int len, idx; unsigned int len, idx;
for (;; cfi = cfi->dw_cfi_next) for (ix = 0; ix < upto + 1; ix++)
{
dw_cfi_ref cfi = ix < upto ? VEC_index (dw_cfi_ref, vec, ix) : NULL;
switch (cfi ? cfi->dw_cfi_opc : DW_CFA_nop) switch (cfi ? cfi->dw_cfi_opc : DW_CFA_nop)
{ {
case DW_CFA_advance_loc: case DW_CFA_advance_loc:
...@@ -3464,21 +3469,22 @@ output_cfis (dw_cfi_ref cfi, bool do_cfi_asm, dw_fde_ref fde, bool for_eh) ...@@ -3464,21 +3469,22 @@ output_cfis (dw_cfi_ref cfi, bool do_cfi_asm, dw_fde_ref fde, bool for_eh)
/* Skip everything between .cfi_remember_state and /* Skip everything between .cfi_remember_state and
.cfi_restore_state. */ .cfi_restore_state. */
for (cfi2 = cfi->dw_cfi_next; cfi2; cfi2 = cfi2->dw_cfi_next) ix++;
if (ix == upto)
goto flush_all;
for (; ix < upto; ix++)
{
cfi2 = VEC_index (dw_cfi_ref, vec, ix);
if (cfi2->dw_cfi_opc == DW_CFA_restore_state) if (cfi2->dw_cfi_opc == DW_CFA_restore_state)
break; break;
else if (cfi2->dw_cfi_opc == DW_CFA_GNU_args_size) else if (cfi2->dw_cfi_opc == DW_CFA_GNU_args_size)
args_size = cfi2; args_size = cfi2;
else else
gcc_assert (cfi2->dw_cfi_opc != DW_CFA_remember_state); gcc_assert (cfi2->dw_cfi_opc != DW_CFA_remember_state);
}
if (cfi2 == NULL)
goto flush_all;
else
{
cfi = cfi2;
cfi_args_size = args_size; cfi_args_size = args_size;
}
break; break;
} }
case DW_CFA_GNU_args_size: case DW_CFA_GNU_args_size:
...@@ -3499,10 +3505,12 @@ output_cfis (dw_cfi_ref cfi, bool do_cfi_asm, dw_fde_ref fde, bool for_eh) ...@@ -3499,10 +3505,12 @@ output_cfis (dw_cfi_ref cfi, bool do_cfi_asm, dw_fde_ref fde, bool for_eh)
case DW_CFA_expression: case DW_CFA_expression:
case DW_CFA_val_expression: case DW_CFA_val_expression:
case DW_CFA_GNU_negative_offset_extended: case DW_CFA_GNU_negative_offset_extended:
if (VEC_length (dw_cfi_ref, regs) <= cfi->dw_cfi_oprnd1.dw_cfi_reg_num) if (VEC_length (dw_cfi_ref, regs)
<= cfi->dw_cfi_oprnd1.dw_cfi_reg_num)
VEC_safe_grow_cleared (dw_cfi_ref, heap, regs, VEC_safe_grow_cleared (dw_cfi_ref, heap, regs,
cfi->dw_cfi_oprnd1.dw_cfi_reg_num + 1); cfi->dw_cfi_oprnd1.dw_cfi_reg_num + 1);
VEC_replace (dw_cfi_ref, regs, cfi->dw_cfi_oprnd1.dw_cfi_reg_num, cfi); VEC_replace (dw_cfi_ref, regs, cfi->dw_cfi_oprnd1.dw_cfi_reg_num,
cfi);
break; break;
case DW_CFA_def_cfa: case DW_CFA_def_cfa:
case DW_CFA_def_cfa_sf: case DW_CFA_def_cfa_sf:
...@@ -3591,6 +3599,15 @@ output_cfis (dw_cfi_ref cfi, bool do_cfi_asm, dw_fde_ref fde, bool for_eh) ...@@ -3591,6 +3599,15 @@ output_cfis (dw_cfi_ref cfi, bool do_cfi_asm, dw_fde_ref fde, bool for_eh)
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
}
}
/* Like output_cfis, but emit all CFIs in the vector. */
static void
output_all_cfis (cfi_vec vec, bool do_cfi_asm,
dw_fde_ref fde, bool for_eh)
{
output_cfis (vec, VEC_length (dw_cfi_ref, vec), do_cfi_asm, fde, for_eh);
} }
/* Output one FDE. */ /* Output one FDE. */
...@@ -3600,6 +3617,7 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second, ...@@ -3600,6 +3617,7 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
char *section_start_label, int fde_encoding, char *augmentation, char *section_start_label, int fde_encoding, char *augmentation,
bool any_lsda_needed, int lsda_encoding) bool any_lsda_needed, int lsda_encoding)
{ {
int ix;
const char *begin, *end; const char *begin, *end;
static unsigned int j; static unsigned int j;
char l1[20], l2[20]; char l1[20], l2[20];
...@@ -3687,31 +3705,31 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second, ...@@ -3687,31 +3705,31 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
this FDE. */ this FDE. */
fde->dw_fde_current_label = begin; fde->dw_fde_current_label = begin;
if (fde->dw_fde_second_begin == NULL) if (fde->dw_fde_second_begin == NULL)
for (cfi = fde->dw_fde_cfi; cfi != NULL; cfi = cfi->dw_cfi_next) FOR_EACH_VEC_ELT (dw_cfi_ref, fde->dw_fde_cfi, ix, cfi)
output_cfi (cfi, fde, for_eh); output_cfi (cfi, fde, for_eh);
else if (!second) else if (!second)
{ {
if (fde->dw_fde_switch_cfi) if (fde->dw_fde_switch_cfi_index > 0)
for (cfi = fde->dw_fde_cfi; cfi != NULL; cfi = cfi->dw_cfi_next) FOR_EACH_VEC_ELT (dw_cfi_ref, fde->dw_fde_cfi, ix, cfi)
{ {
output_cfi (cfi, fde, for_eh); if (ix == fde->dw_fde_switch_cfi_index)
if (cfi == fde->dw_fde_switch_cfi)
break; break;
output_cfi (cfi, fde, for_eh);
} }
} }
else else
{ {
dw_cfi_ref cfi_next = fde->dw_fde_cfi; int i, from = 0;
int until = VEC_length (dw_cfi_ref, fde->dw_fde_cfi);
if (fde->dw_fde_switch_cfi) if (fde->dw_fde_switch_cfi_index > 0)
{ {
cfi_next = fde->dw_fde_switch_cfi->dw_cfi_next; from = fde->dw_fde_switch_cfi_index;
fde->dw_fde_switch_cfi->dw_cfi_next = NULL; output_cfis (fde->dw_fde_cfi, from, false, fde, for_eh);
output_cfis (fde->dw_fde_cfi, false, fde, for_eh);
fde->dw_fde_switch_cfi->dw_cfi_next = cfi_next;
} }
for (cfi = cfi_next; cfi != NULL; cfi = cfi->dw_cfi_next) for (i = from; i < until; i++)
output_cfi (cfi, fde, for_eh); output_cfi (VEC_index (dw_cfi_ref, fde->dw_fde_cfi, i),
fde, for_eh);
} }
/* If we are to emit a ref/link from function bodies to their frame tables, /* If we are to emit a ref/link from function bodies to their frame tables,
...@@ -3947,7 +3965,7 @@ output_call_frame_info (int for_eh) ...@@ -3947,7 +3965,7 @@ output_call_frame_info (int for_eh)
eh_data_format_name (fde_encoding)); eh_data_format_name (fde_encoding));
} }
for (cfi = cie_cfi_head; cfi != NULL; cfi = cfi->dw_cfi_next) FOR_EACH_VEC_ELT (dw_cfi_ref, cie_cfi_vec, i, cfi)
output_cfi (cfi, NULL, for_eh); output_cfi (cfi, NULL, for_eh);
/* Pad the CIE out to an address sized boundary. */ /* Pad the CIE out to an address sized boundary. */
...@@ -4089,8 +4107,8 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, ...@@ -4089,8 +4107,8 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
fde->dw_fde_second_end = NULL; fde->dw_fde_second_end = NULL;
fde->dw_fde_vms_end_prologue = NULL; fde->dw_fde_vms_end_prologue = NULL;
fde->dw_fde_vms_begin_epilogue = NULL; fde->dw_fde_vms_begin_epilogue = NULL;
fde->dw_fde_cfi = NULL; fde->dw_fde_cfi = VEC_alloc (dw_cfi_ref, gc, 20);
fde->dw_fde_switch_cfi = NULL; fde->dw_fde_switch_cfi_index = 0;
fde->funcdef_number = current_function_funcdef_no; fde->funcdef_number = current_function_funcdef_no;
fde->all_throwers_are_sibcalls = crtl->all_throwers_are_sibcalls; fde->all_throwers_are_sibcalls = crtl->all_throwers_are_sibcalls;
fde->uses_eh_lsda = crtl->uses_eh_lsda; fde->uses_eh_lsda = crtl->uses_eh_lsda;
...@@ -4251,7 +4269,6 @@ dwarf2out_switch_text_section (void) ...@@ -4251,7 +4269,6 @@ dwarf2out_switch_text_section (void)
{ {
section *sect; section *sect;
dw_fde_ref fde = current_fde (); dw_fde_ref fde = current_fde ();
dw_cfi_ref cfi;
gcc_assert (cfun && fde && fde->dw_fde_second_begin == NULL); gcc_assert (cfun && fde && fde->dw_fde_second_begin == NULL);
...@@ -4293,13 +4310,9 @@ dwarf2out_switch_text_section (void) ...@@ -4293,13 +4310,9 @@ dwarf2out_switch_text_section (void)
dwarf2out_do_cfi_startproc (true); dwarf2out_do_cfi_startproc (true);
/* As this is a different FDE, insert all current CFI instructions /* As this is a different FDE, insert all current CFI instructions
again. */ again. */
output_cfis (fde->dw_fde_cfi, true, fde, true); output_all_cfis (fde->dw_fde_cfi, true, fde, true);
} }
cfi = fde->dw_fde_cfi; fde->dw_fde_switch_cfi_index = VEC_length (dw_cfi_ref, fde->dw_fde_cfi);
if (cfi)
while (cfi->dw_cfi_next != NULL)
cfi = cfi->dw_cfi_next;
fde->dw_fde_switch_cfi = cfi;
var_location_switch_text_section (); var_location_switch_text_section ();
set_cur_line_info_table (sect); set_cur_line_info_table (sect);
...@@ -17168,6 +17181,7 @@ tree_add_const_value_attribute_for_decl (dw_die_ref var_die, tree decl) ...@@ -17168,6 +17181,7 @@ tree_add_const_value_attribute_for_decl (dw_die_ref var_die, tree decl)
static dw_loc_list_ref static dw_loc_list_ref
convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset) convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset)
{ {
int ix;
dw_fde_ref fde; dw_fde_ref fde;
dw_loc_list_ref list, *list_tail; dw_loc_list_ref list, *list_tail;
dw_cfi_ref cfi; dw_cfi_ref cfi;
...@@ -17190,13 +17204,13 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset) ...@@ -17190,13 +17204,13 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset)
/* ??? Bald assumption that the CIE opcode list does not contain /* ??? Bald assumption that the CIE opcode list does not contain
advance opcodes. */ advance opcodes. */
for (cfi = cie_cfi_head; cfi; cfi = cfi->dw_cfi_next) FOR_EACH_VEC_ELT (dw_cfi_ref, cie_cfi_vec, ix, cfi)
lookup_cfa_1 (cfi, &next_cfa, &remember); lookup_cfa_1 (cfi, &next_cfa, &remember);
last_cfa = next_cfa; last_cfa = next_cfa;
last_label = start_label; last_label = start_label;
if (fde->dw_fde_second_begin && fde->dw_fde_switch_cfi == NULL) if (fde->dw_fde_second_begin && fde->dw_fde_switch_cfi_index == 0)
{ {
/* If the first partition contained no CFI adjustments, the /* If the first partition contained no CFI adjustments, the
CIE opcodes apply to the whole first partition. */ CIE opcodes apply to the whole first partition. */
...@@ -17206,7 +17220,7 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset) ...@@ -17206,7 +17220,7 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset)
start_label = last_label = fde->dw_fde_second_begin; start_label = last_label = fde->dw_fde_second_begin;
} }
for (cfi = fde->dw_fde_cfi; cfi; cfi = cfi->dw_cfi_next) FOR_EACH_VEC_ELT (dw_cfi_ref, fde->dw_fde_cfi, ix, cfi)
{ {
switch (cfi->dw_cfi_opc) switch (cfi->dw_cfi_opc)
{ {
...@@ -17234,7 +17248,7 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset) ...@@ -17234,7 +17248,7 @@ convert_cfa_to_fb_loc_list (HOST_WIDE_INT offset)
lookup_cfa_1 (cfi, &next_cfa, &remember); lookup_cfa_1 (cfi, &next_cfa, &remember);
break; break;
} }
if (cfi == fde->dw_fde_switch_cfi) if (ix + 1 == fde->dw_fde_switch_cfi_index)
{ {
if (!cfa_equal_p (&last_cfa, &next_cfa)) if (!cfa_equal_p (&last_cfa, &next_cfa))
{ {
......
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