Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
e5e625da
Commit
e5e625da
authored
Apr 09, 2005
by
Caroline Tice
Committed by
Caroline Tice
Apr 09, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problems with labels with hot/cold partitioning.
From-SVN: r97928
parent
bd0e28a2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
184 additions
and
99 deletions
+184
-99
gcc/ChangeLog
+69
-0
gcc/bb-reorder.c
+37
-50
gcc/dbxout.c
+6
-3
gcc/dwarf2out.c
+49
-36
gcc/function.h
+14
-0
gcc/opts.c
+9
-0
gcc/output.h
+0
-5
gcc/passes.c
+0
-5
gcc/varasm.c
+0
-0
No files found.
gcc/ChangeLog
View file @
e5e625da
2005-04-09 Caroline Tice <ctice@apple.com>
* bb-reorder.c (find_rarely_executed_basic_blocks_and_crossing_edges):
Remove targetm.have_named_sections test.
(fix_edges_for_rarely_executed_code): Likewise.
(insert_section_boundary_note): Likewise.
(reorder_basic_blocks): Check partitioning flag before calling
verify_hot_cold_block_grouping.
* dbxout.c (dbxout_function_end): Get hot/cold section labels from
the function struct rather than global variables.
* dwarf2out.c (COLD_TEXT_SECTION_LABEL): New macro.
(COLD_END_LABEL): Likewise
(cold_text_section_label): New static global variable.
(cold_end_label): Likewise.
(dwarf2out_switch_text_section): Get hot/cold section labels from
the function struct rather than global variables.
(output_aranges): Use cold_text_section_label and cold_end_label;
check partitioning flag before putting out delta.
(output_ranges): Remove incorrect code attempting to use
hot/cold labels.
(output_line_info): Get cold section label from function struct.
(add_location_or_const_value_attribute): Likewise.
(get_subprogram_die): Get hot/cold section labels from function struct.
(dwarf2out_var_location): Likewise.
(dwarf2out_init): Generate cold_text_section_label and cold_end_label;
write out cold_text_section_label if partition flag is set.
(dwarf2out_finish): Write out cold_end_label if partition flag is set;
* function.h (struct function): Add new fields to point to hot/cold
section labels: hot_section_label, cold_section_label,
hot_section_end_label and cold_section_end_label; also add new field
for cold text section name, unlikely_text_section_name.
* opts.c (decode_options): Turn off partitioning flag if
!targetm.have_named_sections.
* output.h (hot_section_label): Remove.
(hot_section_end_label): Remove.
(cold_section_end_label): Remove.
(unlikely_section_label): Remove.
(unlikely_text_section_name): Remove.
* passes.c (rest_of_handle_final): Remove code that frees
unlikely_text_section_name.
* varasm.c (unlikely_section_label): Remove.
(hot_section_label): Remove.
(hot_section_end_label): Remove.
(cold_section_end_label): Remove.
(unlikely_text_section_name): Remove.
(initialize_cold_section_name): Modify to call
targetm.strip_name_encoding; to store cold section name in current
function struct, if it exists; and to only use the decl_section_name
if flag_named_sections is true.
(unlikely_text_section): Modify to get section name out of current
function struct, if there is one; otherwise build it from
UNLIKELY_EXECUTED_TEXT_SECTION_NAME.
(in_unlikely_text_section): Likewise.
(named_section): Modify to get/put cold section name in current function
struct, if there is one.
(function_section): Change 'bool unlikely' to 'int reloc'; check
targetm.have_named_sections before calling named_section.
(current_function_section): Likewise.
(assemble_start_function): Modify to get/put unlikely_text_section_name
in current function struct; modify to get hot/cold section labels
from function struct; initialize labels using
ASM_GENERATE_INTERNAL_LABEL;
test partitioning flag before writing out hot section label.
(assemble_end_function): Test partitioning flag before writing out
hot/cold section labels.
(default_section_type_flags_1): Modify to use array instead of
char* for unlikely_text_section_name; set flags correctly for
cold text section if there is not a current function decl.
2005-04-09 Jakub Jelinek <jakub@redhat.com>
* tree.h (enum tree_index): Add TI_VA_LIST_GPR_COUNTER_FIELD
...
...
gcc/bb-reorder.c
View file @
e5e625da
...
...
@@ -1241,27 +1241,24 @@ find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
/* Mark every edge that crosses between sections. */
i
=
0
;
if
(
targetm
.
have_named_sections
)
FOR_EACH_BB
(
bb
)
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
{
FOR_EACH_BB
(
bb
)
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
{
if
(
e
->
src
!=
ENTRY_BLOCK_PTR
&&
e
->
dest
!=
EXIT_BLOCK_PTR
&&
BB_PARTITION
(
e
->
src
)
!=
BB_PARTITION
(
e
->
dest
))
{
e
->
flags
|=
EDGE_CROSSING
;
if
(
i
==
*
max_idx
)
{
*
max_idx
*=
2
;
crossing_edges
=
xrealloc
(
crossing_edges
,
(
*
max_idx
)
*
sizeof
(
edge
));
}
crossing_edges
[
i
++
]
=
e
;
}
else
e
->
flags
&=
~
EDGE_CROSSING
;
}
if
(
e
->
src
!=
ENTRY_BLOCK_PTR
&&
e
->
dest
!=
EXIT_BLOCK_PTR
&&
BB_PARTITION
(
e
->
src
)
!=
BB_PARTITION
(
e
->
dest
))
{
e
->
flags
|=
EDGE_CROSSING
;
if
(
i
==
*
max_idx
)
{
*
max_idx
*=
2
;
crossing_edges
=
xrealloc
(
crossing_edges
,
(
*
max_idx
)
*
sizeof
(
edge
));
}
crossing_edges
[
i
++
]
=
e
;
}
else
e
->
flags
&=
~
EDGE_CROSSING
;
}
*
n_crossing_edges
=
i
;
}
...
...
@@ -1825,36 +1822,26 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges,
fix_up_fall_thru_edges
();
/* Only do the parts necessary for writing separate sections if
the target architecture has the ability to write separate sections
(i.e. it has named sections). Otherwise, the hot/cold partitioning
information will be used when reordering blocks to try to put all
the hot blocks together, then all the cold blocks, but no actual
section partitioning will be done. */
if
(
targetm
.
have_named_sections
)
{
/* If the architecture does not have conditional branches that can
span all of memory, convert crossing conditional branches into
crossing unconditional branches. */
/* If the architecture does not have conditional branches that can
span all of memory, convert crossing conditional branches into
crossing unconditional branches. */
if
(
!
HAS_LONG_COND_BRANCH
)
fix_crossing_conditional_branches
();
if
(
!
HAS_LONG_COND_BRANCH
)
fix_crossing_conditional_branches
();
/* If the architecture does not have unconditional branches that
can span all of memory, convert crossing unconditional branches
into indirect jumps. Since adding an indirect jump also adds
a new register usage, update the register usage information as
well. */
if
(
!
HAS_LONG_UNCOND_BRANCH
)
{
fix_crossing_unconditional_branches
();
reg_scan
(
get_insns
(),
max_reg_num
());
}
add_reg_crossing_jump_notes
();
/* If the architecture does not have unconditional branches that
can span all of memory, convert crossing unconditional branches
into indirect jumps. Since adding an indirect jump also adds
a new register usage, update the register usage information as
well. */
if
(
!
HAS_LONG_UNCOND_BRANCH
)
{
fix_crossing_unconditional_branches
();
reg_scan
(
get_insns
(),
max_reg_num
());
}
add_reg_crossing_jump_notes
();
}
/* Verify, in the basic block chain, that there is at most one switch
...
...
@@ -1946,7 +1933,8 @@ reorder_basic_blocks (unsigned int flags)
dump_flow_info
(
dump_file
);
cfg_layout_finalize
();
verify_hot_cold_block_grouping
();
if
(
flag_reorder_blocks_and_partition
)
verify_hot_cold_block_grouping
();
timevar_pop
(
TV_REORDER_BLOCKS
);
}
...
...
@@ -1966,8 +1954,7 @@ insert_section_boundary_note (void)
rtx
new_note
;
int
first_partition
=
0
;
if
(
flag_reorder_blocks_and_partition
&&
targetm
.
have_named_sections
)
if
(
flag_reorder_blocks_and_partition
)
FOR_EACH_BB
(
bb
)
{
if
(
!
first_partition
)
...
...
gcc/dbxout.c
View file @
e5e625da
...
...
@@ -938,11 +938,14 @@ dbxout_function_end (tree decl)
#else
if
(
flag_reorder_blocks_and_partition
)
{
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
decl
);
dbxout_begin_empty_stabs
(
N_FUN
);
dbxout_stab_value_label_diff
(
hot_section_end_label
,
hot_section_label
);
dbxout_stab_value_label_diff
(
cfun
->
hot_section_end_label
,
cfun
->
hot_section_label
);
dbxout_begin_empty_stabs
(
N_FUN
);
dbxout_stab_value_label_diff
(
cold_section_end_label
,
unlikely
_section_label
);
dbxout_stab_value_label_diff
(
c
fun
->
c
old_section_end_label
,
cfun
->
cold
_section_label
);
}
else
{
...
...
gcc/dwarf2out.c
View file @
e5e625da
...
...
@@ -4122,6 +4122,9 @@ static int maybe_emit_file (int);
#ifndef TEXT_SECTION_LABEL
#define TEXT_SECTION_LABEL "Ltext"
#endif
#ifndef COLD_TEXT_SECTION_LABEL
#define COLD_TEXT_SECTION_LABEL "Ltext_cold"
#endif
#ifndef DEBUG_LINE_SECTION_LABEL
#define DEBUG_LINE_SECTION_LABEL "Ldebug_line"
#endif
...
...
@@ -4149,6 +4152,8 @@ static int maybe_emit_file (int);
static
char
text_end_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
text_section_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
cold_text_section_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
cold_end_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
abbrev_section_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
debug_info_section_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
debug_line_section_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
...
...
@@ -4159,6 +4164,9 @@ static char ranges_section_label[2 * MAX_ARTIFICIAL_LABEL_BYTES];
#ifndef TEXT_END_LABEL
#define TEXT_END_LABEL "Letext"
#endif
#ifndef COLD_END_LABEL
#define COLD_END_LABEL "Letext_cold"
#endif
#ifndef BLOCK_BEGIN_LABEL
#define BLOCK_BEGIN_LABEL "LBB"
#endif
...
...
@@ -6799,13 +6807,14 @@ static void
dwarf2out_switch_text_section
(
void
)
{
dw_fde_ref
fde
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
fde
=
&
fde_table
[
fde_table_in_use
-
1
];
fde
->
dw_fde_switched_sections
=
true
;
fde
->
dw_fde_hot_section_label
=
xstrdup
(
hot_section_label
)
;
fde
->
dw_fde_hot_section_end_label
=
xstrdup
(
hot_section_end_label
)
;
fde
->
dw_fde_unlikely_section_label
=
xstrdup
(
unlikely_section_label
)
;
fde
->
dw_fde_unlikely_section_end_label
=
xstrdup
(
cold_section_end_label
)
;
fde
->
dw_fde_hot_section_label
=
cfun
->
hot_section_label
;
fde
->
dw_fde_hot_section_end_label
=
cfun
->
hot_section_end_label
;
fde
->
dw_fde_unlikely_section_label
=
cfun
->
cold_section_label
;
fde
->
dw_fde_unlikely_section_end_label
=
cfun
->
cold_section_end_label
;
separate_line_info_table_in_use
++
;
}
...
...
@@ -7235,14 +7244,15 @@ output_aranges (void)
}
dw2_asm_output_addr
(
DWARF2_ADDR_SIZE
,
text_section_label
,
"Address"
);
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
unlikely_text_section_name
))
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
text_end_label
,
unlikely_section_label
,
"Length"
);
else
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
text_end_label
,
text_section_label
,
"Length"
);
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
text_end_label
,
text_section_label
,
"Length"
);
if
(
flag_reorder_blocks_and_partition
)
{
dw2_asm_output_addr
(
DWARF2_ADDR_SIZE
,
cold_text_section_label
,
"Address"
);
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
cold_end_label
,
cold_text_section_label
,
"Length"
);
}
for
(
i
=
0
;
i
<
arange_table_in_use
;
i
++
)
{
...
...
@@ -7332,24 +7342,11 @@ output_ranges (void)
base of the text section. */
if
(
separate_line_info_table_in_use
==
0
)
{
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
unlikely_text_section_name
))
{
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
blabel
,
unlikely_section_label
,
fmt
,
i
*
2
*
DWARF2_ADDR_SIZE
);
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
elabel
,
unlikely_section_label
,
NULL
);
}
else
{
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
blabel
,
text_section_label
,
fmt
,
i
*
2
*
DWARF2_ADDR_SIZE
);
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
elabel
,
text_section_label
,
NULL
);
}
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
blabel
,
text_section_label
,
fmt
,
i
*
2
*
DWARF2_ADDR_SIZE
);
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
elabel
,
text_section_label
,
NULL
);
}
/* Otherwise, we add a DW_AT_entry_pc attribute to force the
...
...
@@ -7665,6 +7662,7 @@ output_line_info (void)
long
line_delta
;
unsigned
long
current_file
;
unsigned
long
function
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
ASM_GENERATE_INTERNAL_LABEL
(
l1
,
LINE_NUMBER_BEGIN_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
l2
,
LINE_NUMBER_END_LABEL
,
0
);
...
...
@@ -7736,8 +7734,8 @@ output_line_info (void)
current_line
=
1
;
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
unlikely_text_section_name
))
strcpy
(
prev_line_label
,
unlikely
_section_label
);
&&
last_text_section_name
==
cfun
->
unlikely_text_section_name
))
strcpy
(
prev_line_label
,
cfun
->
cold
_section_label
);
else
strcpy
(
prev_line_label
,
text_section_label
);
for
(
lt_index
=
1
;
lt_index
<
line_info_table_in_use
;
++
lt_index
)
...
...
@@ -10110,6 +10108,7 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
const
char
*
endname
;
dw_loc_list_ref
list
;
rtx
varloc
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
/* We need to figure out what section we should use as the base
...
...
@@ -10135,8 +10134,8 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
}
else
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
unlikely_text_section_name
))
secname
=
unlikely
_section_label
;
&&
last_text_section_name
==
cfun
->
unlikely_text_section_name
))
secname
=
cfun
->
cold
_section_label
;
else
secname
=
text_section_label
;
...
...
@@ -13229,6 +13228,7 @@ dwarf2out_var_location (rtx loc_note)
static
rtx
last_insn
;
static
const
char
*
last_label
;
tree
decl
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
if
(
!
DECL_P
(
NOTE_VAR_LOCATION_DECL
(
loc_note
)))
return
;
...
...
@@ -13257,8 +13257,8 @@ dwarf2out_var_location (rtx loc_note)
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
unlikely_text_section_name
))
newloc
->
section_label
=
unlikely
_section_label
;
&&
last_text_section_name
==
cfun
->
unlikely_text_section_name
))
newloc
->
section_label
=
cfun
->
cold
_section_label
;
else
newloc
->
section_label
=
text_section_label
;
...
...
@@ -13496,6 +13496,9 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
ASM_GENERATE_INTERNAL_LABEL
(
abbrev_section_label
,
DEBUG_ABBREV_SECTION_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
text_section_label
,
TEXT_SECTION_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
cold_text_section_label
,
COLD_TEXT_SECTION_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
cold_end_label
,
COLD_END_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
debug_info_section_label
,
DEBUG_INFO_SECTION_LABEL
,
0
);
...
...
@@ -13520,6 +13523,11 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
text_section
();
ASM_OUTPUT_LABEL
(
asm_out_file
,
text_section_label
);
if
(
flag_reorder_blocks_and_partition
)
{
unlikely_text_section
();
ASM_OUTPUT_LABEL
(
asm_out_file
,
cold_text_section_label
);
}
}
/* A helper function for dwarf2out_finish called through
...
...
@@ -13851,6 +13859,11 @@ dwarf2out_finish (const char *filename)
/* Output a terminator label for the .text section. */
text_section
();
targetm
.
asm_out
.
internal_label
(
asm_out_file
,
TEXT_END_LABEL
,
0
);
if
(
flag_reorder_blocks_and_partition
)
{
unlikely_text_section
();
targetm
.
asm_out
.
internal_label
(
asm_out_file
,
COLD_END_LABEL
,
0
);
}
/* Output the source line correspondence table. We must do this
even if there is no line information. Otherwise, on an empty
...
...
gcc/function.h
View file @
e5e625da
...
...
@@ -349,6 +349,20 @@ struct function GTY(())
/* The variables unexpanded so far. */
tree
unexpanded_var_list
;
/* Assembly labels for the hot and cold text sections, to
be used by debugger functions for determining the size of text
sections. */
const
char
*
hot_section_label
;
const
char
*
cold_section_label
;
const
char
*
hot_section_end_label
;
const
char
*
cold_section_end_label
;
/* String to be used for name of cold text sections, via
targetm.asm_out.named_section. */
const
char
*
unlikely_text_section_name
;
/* Collected bit flags. */
/* Nonzero if function being compiled needs to be given an address
...
...
gcc/opts.c
View file @
e5e625da
...
...
@@ -678,6 +678,15 @@ decode_options (unsigned int argc, const char **argv)
flag_reorder_blocks_and_partition
=
0
;
flag_reorder_blocks
=
1
;
}
if
(
flag_reorder_blocks_and_partition
&&
!
targetm
.
have_named_sections
)
{
inform
(
"-freorder-blocks-and-partition does not work on this architecture."
);
flag_reorder_blocks_and_partition
=
0
;
flag_reorder_blocks
=
1
;
}
}
/* Handle target- and language-independent options. Return zero to
...
...
gcc/output.h
View file @
e5e625da
...
...
@@ -453,11 +453,6 @@ enum in_section { no_section, in_text, in_unlikely_executed_text, in_data,
#endif
};
extern
char
*
unlikely_section_label
;
extern
char
*
hot_section_label
;
extern
char
*
hot_section_end_label
;
extern
char
*
cold_section_end_label
;
extern
char
*
unlikely_text_section_name
;
extern
const
char
*
last_text_section_name
;
extern
enum
in_section
last_text_section
;
extern
bool
first_function_block_is_cold
;
...
...
gcc/passes.c
View file @
e5e625da
...
...
@@ -329,11 +329,6 @@ rest_of_handle_final (void)
timevar_push
(
TV_SYMOUT
);
(
*
debug_hooks
->
function_decl
)
(
current_function_decl
);
if
(
unlikely_text_section_name
)
{
free
(
unlikely_text_section_name
);
unlikely_text_section_name
=
NULL
;
}
timevar_pop
(
TV_SYMOUT
);
ggc_collect
();
...
...
gcc/varasm.c
View file @
e5e625da
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment