Commit 17f6e37d by Jakub Jelinek Committed by Jakub Jelinek

dwarf2out.c (output_fde): When doing hot/cold partitioning...

	* dwarf2out.c (output_fde): When doing hot/cold partitioning, use
	fde->dw_fde_begin as begin label instead of hot/cold label.
	Use LLSDAC label instead of LLSDA for second section lsda.
	(dwarf2out_do_cfi_startproc): Add SECOND argument.  Use LLSDAC
	label instead of LLSDA if it is true.
	(dwarf2out_begin_prologue, dwarf2out_switch_text_section): Adjust
	callers.
	* except.c (add_call_site, dw2_size_of_call_site_table): Add
	SECTION argument.  Use it as index into crtl->eh.call_site_record
	array.
	(dw2_output_call_site_table): Likewise.  Add CS_FORMAT argument,
	use it to determine how to print table entries instead of using
	#ifdef HAVE_AS_LEB128.  For SECTION > 0 use hot resp. cold
	label instead of normal begin label as base.
	(sjlj_assign_call_site_values): Adjust add_call_site caller.
	(convert_to_eh_region_ranges): When doing hot/cold partitioning,
	ensure no EH range spans between sections and that landing pads
	are always in the corresponding section.
	(sjlj_size_of_call_site_table, sjlj_output_call_site_table): Adjust
	for crtl->eh.call_site_record being an array rather than scalar.
	(output_one_function_exception_table): New function, copied
	from output_function_exception_table.  Adjust
	dw2_size_of_call_site_table, dw2_output_call_site_table
	callers.  For SECOND section use *C suffixed labels.
	(output_function_exception_table): Call
	output_one_function_exception_table and, when doing hot/cold
	partitioning, also another time for the second section.
	* opts.c: Include except.h.
	(decode_options): Allow -freorder-blocks-and-partition with
	exceptions, unless SJLJ or TARGET_UNWIND_INFO.
	* Makefile.in (opts.o): Depend on $(EXCEPT_H).
	* function.h (struct rtl_eh): Change call_site_record from
	scalar into array of 2 elements.

	* g++.dg/tree-prof/partition1.C: New test.

From-SVN: r150553
parent 3f84bf08
2009-08-07 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (output_fde): When doing hot/cold partitioning, use
fde->dw_fde_begin as begin label instead of hot/cold label.
Use LLSDAC label instead of LLSDA for second section lsda.
(dwarf2out_do_cfi_startproc): Add SECOND argument. Use LLSDAC
label instead of LLSDA if it is true.
(dwarf2out_begin_prologue, dwarf2out_switch_text_section): Adjust
callers.
* except.c (add_call_site, dw2_size_of_call_site_table): Add
SECTION argument. Use it as index into crtl->eh.call_site_record
array.
(dw2_output_call_site_table): Likewise. Add CS_FORMAT argument,
use it to determine how to print table entries instead of using
#ifdef HAVE_AS_LEB128. For SECTION > 0 use hot resp. cold
label instead of normal begin label as base.
(sjlj_assign_call_site_values): Adjust add_call_site caller.
(convert_to_eh_region_ranges): When doing hot/cold partitioning,
ensure no EH range spans between sections and that landing pads
are always in the corresponding section.
(sjlj_size_of_call_site_table, sjlj_output_call_site_table): Adjust
for crtl->eh.call_site_record being an array rather than scalar.
(output_one_function_exception_table): New function, copied
from output_function_exception_table. Adjust
dw2_size_of_call_site_table, dw2_output_call_site_table
callers. For SECOND section use *C suffixed labels.
(output_function_exception_table): Call
output_one_function_exception_table and, when doing hot/cold
partitioning, also another time for the second section.
* opts.c: Include except.h.
(decode_options): Allow -freorder-blocks-and-partition with
exceptions, unless SJLJ or TARGET_UNWIND_INFO.
* Makefile.in (opts.o): Depend on $(EXCEPT_H).
* function.h (struct rtl_eh): Change call_site_record from
scalar into array of 2 elements.
2009-08-07 Martin Jambor <mjambor@suse.cz> 2009-08-07 Martin Jambor <mjambor@suse.cz>
* ipa-prop.c (count_formal_params_1): New function. * ipa-prop.c (count_formal_params_1): New function.
......
...@@ -2595,7 +2595,7 @@ opts.o : opts.c opts.h options.h $(TOPLEV_H) $(CONFIG_H) $(SYSTEM_H) \ ...@@ -2595,7 +2595,7 @@ opts.o : opts.c opts.h options.h $(TOPLEV_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \ coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \
output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \ output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
$(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h varray.h \ $(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h varray.h \
$(PLUGIN_H) $(PLUGIN_H) $(EXCEPT_H)
opts-common.o : opts-common.c opts.h $(CONFIG_H) $(SYSTEM_H) \ opts-common.o : opts-common.c opts.h $(CONFIG_H) $(SYSTEM_H) \
coretypes.h intl.h coretypes.h intl.h
targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
......
...@@ -3429,15 +3429,22 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second, ...@@ -3429,15 +3429,22 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
begin = fde->dw_fde_begin; begin = fde->dw_fde_begin;
end = fde->dw_fde_end; end = fde->dw_fde_end;
} }
else if (second ^ fde->dw_fde_switched_cold_to_hot)
{
begin = fde->dw_fde_unlikely_section_label;
end = fde->dw_fde_unlikely_section_end_label;
}
else else
{ {
begin = fde->dw_fde_hot_section_label; /* For the first section, prefer dw_fde_begin over
end = fde->dw_fde_hot_section_end_label; dw_fde_{hot,cold}_section_label, as the latter
might be separated from the real start of the
function by alignment padding. */
if (!second)
begin = fde->dw_fde_begin;
else if (fde->dw_fde_switched_cold_to_hot)
begin = fde->dw_fde_hot_section_label;
else
begin = fde->dw_fde_unlikely_section_label;
if (second ^ fde->dw_fde_switched_cold_to_hot)
end = fde->dw_fde_unlikely_section_end_label;
else
end = fde->dw_fde_hot_section_end_label;
} }
if (for_eh) if (for_eh)
...@@ -3477,7 +3484,8 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second, ...@@ -3477,7 +3484,8 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
if (fde->uses_eh_lsda) if (fde->uses_eh_lsda)
{ {
ASM_GENERATE_INTERNAL_LABEL (l1, "LLSDA", fde->funcdef_number); ASM_GENERATE_INTERNAL_LABEL (l1, second ? "LLSDAC" : "LLSDA",
fde->funcdef_number);
dw2_asm_output_encoded_addr_rtx (lsda_encoding, dw2_asm_output_encoded_addr_rtx (lsda_encoding,
gen_rtx_SYMBOL_REF (Pmode, l1), gen_rtx_SYMBOL_REF (Pmode, l1),
false, false,
...@@ -3781,7 +3789,7 @@ output_call_frame_info (int for_eh) ...@@ -3781,7 +3789,7 @@ output_call_frame_info (int for_eh)
/* Emit .cfi_startproc and .cfi_personality/.cfi_lsda if needed. */ /* Emit .cfi_startproc and .cfi_personality/.cfi_lsda if needed. */
static void static void
dwarf2out_do_cfi_startproc (void) dwarf2out_do_cfi_startproc (bool second)
{ {
int enc; int enc;
rtx ref; rtx ref;
...@@ -3810,7 +3818,7 @@ dwarf2out_do_cfi_startproc (void) ...@@ -3810,7 +3818,7 @@ dwarf2out_do_cfi_startproc (void)
char lab[20]; char lab[20];
enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/0); enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/0);
ASM_GENERATE_INTERNAL_LABEL (lab, "LLSDA", ASM_GENERATE_INTERNAL_LABEL (lab, second ? "LLSDAC" : "LLSDA",
current_function_funcdef_no); current_function_funcdef_no);
ref = gen_rtx_SYMBOL_REF (Pmode, lab); ref = gen_rtx_SYMBOL_REF (Pmode, lab);
SYMBOL_REF_FLAGS (ref) = SYMBOL_FLAG_LOCAL; SYMBOL_REF_FLAGS (ref) = SYMBOL_FLAG_LOCAL;
...@@ -3929,7 +3937,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED, ...@@ -3929,7 +3937,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
#endif #endif
if (dwarf2out_do_cfi_asm ()) if (dwarf2out_do_cfi_asm ())
dwarf2out_do_cfi_startproc (); dwarf2out_do_cfi_startproc (false);
} }
/* Output a marker (i.e. a label) for the absolute end of the generated code /* Output a marker (i.e. a label) for the absolute end of the generated code
...@@ -4038,7 +4046,7 @@ dwarf2out_switch_text_section (void) ...@@ -4038,7 +4046,7 @@ dwarf2out_switch_text_section (void)
if (dwarf2out_do_cfi_asm ()) if (dwarf2out_do_cfi_asm ())
{ {
dwarf2out_do_cfi_startproc (); 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_cfis (fde->dw_fde_cfi, true, fde, true);
......
...@@ -156,7 +156,7 @@ struct GTY(()) rtl_eh { ...@@ -156,7 +156,7 @@ struct GTY(()) rtl_eh {
varray_type ehspec_data; varray_type ehspec_data;
varray_type action_record_data; varray_type action_record_data;
VEC(call_site_record,gc) *call_site_record; VEC(call_site_record,gc) *call_site_record[2];
}; };
#define pending_stack_adjust (crtl->expr.x_pending_stack_adjust) #define pending_stack_adjust (crtl->expr.x_pending_stack_adjust)
......
...@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h" #include "dbgcnt.h"
#include "debug.h" #include "debug.h"
#include "plugin.h" #include "plugin.h"
#include "except.h"
/* Value of the -G xx switch, and whether it was passed or not. */ /* Value of the -G xx switch, and whether it was passed or not. */
unsigned HOST_WIDE_INT g_switch_value; unsigned HOST_WIDE_INT g_switch_value;
...@@ -1036,10 +1037,15 @@ decode_options (unsigned int argc, const char **argv) ...@@ -1036,10 +1037,15 @@ decode_options (unsigned int argc, const char **argv)
generating unwind info. If flag_exceptions is turned on we need to generating unwind info. If flag_exceptions is turned on we need to
turn off the partitioning optimization. */ turn off the partitioning optimization. */
if (flag_exceptions && flag_reorder_blocks_and_partition) if (flag_exceptions && flag_reorder_blocks_and_partition
&& (USING_SJLJ_EXCEPTIONS
#ifdef TARGET_UNWIND_INFO
|| 1
#endif
))
{ {
inform (input_location, inform (input_location,
"-freorder-blocks-and-partition does not work with exceptions"); "-freorder-blocks-and-partition does not work with exceptions on this architecture");
flag_reorder_blocks_and_partition = 0; flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1; flag_reorder_blocks = 1;
} }
...@@ -1048,9 +1054,15 @@ decode_options (unsigned int argc, const char **argv) ...@@ -1048,9 +1054,15 @@ decode_options (unsigned int argc, const char **argv)
optimization. */ optimization. */
if (flag_unwind_tables && ! targetm.unwind_tables_default if (flag_unwind_tables && ! targetm.unwind_tables_default
&& flag_reorder_blocks_and_partition) && flag_reorder_blocks_and_partition
&& (USING_SJLJ_EXCEPTIONS
#ifdef TARGET_UNWIND_INFO
|| 1
#endif
))
{ {
inform (input_location, "-freorder-blocks-and-partition does not support unwind info"); inform (input_location,
"-freorder-blocks-and-partition does not support unwind info on this architecture");
flag_reorder_blocks_and_partition = 0; flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1; flag_reorder_blocks = 1;
} }
...@@ -1061,7 +1073,12 @@ decode_options (unsigned int argc, const char **argv) ...@@ -1061,7 +1073,12 @@ decode_options (unsigned int argc, const char **argv)
if (flag_reorder_blocks_and_partition if (flag_reorder_blocks_and_partition
&& (!targetm.have_named_sections && (!targetm.have_named_sections
|| (flag_unwind_tables && targetm.unwind_tables_default))) || (flag_unwind_tables && targetm.unwind_tables_default
&& (USING_SJLJ_EXCEPTIONS
#ifdef TARGET_UNWIND_INFO
|| 1
#endif
))))
{ {
inform (input_location, inform (input_location,
"-freorder-blocks-and-partition does not work on this architecture"); "-freorder-blocks-and-partition does not work on this architecture");
......
2009-08-07 Jakub Jelinek <jakub@redhat.com>
* g++.dg/tree-prof/partition1.C: New test.
2009-08-06 Richard Earnshaw <rearnsha@arm.com> 2009-08-06 Richard Earnshaw <rearnsha@arm.com>
* gcc.target/arm/abitest.h: Allow the test function to have a PCS * gcc.target/arm/abitest.h: Allow the test function to have a PCS
......
/* { dg-require-effective-target freorder } */
/* { dg-options "-O2 -freorder-blocks-and-partition" } */
struct A { A () __attribute__((noinline)); ~A () __attribute__((noinline)); };
A::A () { asm volatile ("" : : : "memory"); }
A::~A () { asm volatile ("" : : : "memory"); }
int bar () __attribute__((noinline));
void foo () __attribute__((noinline));
volatile int k, l;
int bar (int i)
{
void *p = __builtin_alloca (i);
asm volatile ("" : : "r" (i), "r" (p) : "memory");
if (k) throw 6;
return ++l;
}
void foo ()
{
A a;
try {
A b;
int i = bar (5);
try { throw 6; } catch (int) {}
if (__builtin_expect (i < 4500, 0)) {
bar (7);
try { bar (8); } catch (long) {}
bar (10);
if (__builtin_expect (i < 0, 0)) {
try { bar (12); } catch (...) {}
bar (16);
bar (122);
} else {
try { bar (bar (7)); } catch (int) {}
}
} else {
try { bar (bar (bar (9))); } catch (...) {}
bar (5);
}
} catch (...) {
}
}
int
main ()
{
int i;
for (i = 0; i < 10000; i++)
foo ();
}
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