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
c3c822d5
Commit
c3c822d5
authored
Apr 12, 2005
by
Caroline Tice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert patch from April 9.
From-SVN: r98039
parent
b0d9bc9b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
193 additions
and
252 deletions
+193
-252
gcc/bb-reorder.c
+50
-37
gcc/dbxout.c
+3
-6
gcc/dwarf2out.c
+36
-53
gcc/function.h
+0
-14
gcc/opts.c
+0
-9
gcc/output.h
+5
-0
gcc/passes.c
+2
-0
gcc/varasm.c
+97
-133
No files found.
gcc/bb-reorder.c
View file @
c3c822d5
...
@@ -1241,24 +1241,27 @@ find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
...
@@ -1241,24 +1241,27 @@ find_rarely_executed_basic_blocks_and_crossing_edges (edge *crossing_edges,
/* Mark every edge that crosses between sections. */
/* Mark every edge that crosses between sections. */
i
=
0
;
i
=
0
;
FOR_EACH_BB
(
bb
)
if
(
targetm
.
have_named_sections
)
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
{
{
if
(
e
->
src
!=
ENTRY_BLOCK_PTR
FOR_EACH_BB
(
bb
)
&&
e
->
dest
!=
EXIT_BLOCK_PTR
FOR_EACH_EDGE
(
e
,
ei
,
bb
->
succs
)
&&
BB_PARTITION
(
e
->
src
)
!=
BB_PARTITION
(
e
->
dest
))
{
{
if
(
e
->
src
!=
ENTRY_BLOCK_PTR
e
->
flags
|=
EDGE_CROSSING
;
&&
e
->
dest
!=
EXIT_BLOCK_PTR
if
(
i
==
*
max_idx
)
&&
BB_PARTITION
(
e
->
src
)
!=
BB_PARTITION
(
e
->
dest
))
{
{
*
max_idx
*=
2
;
e
->
flags
|=
EDGE_CROSSING
;
crossing_edges
=
xrealloc
(
crossing_edges
,
if
(
i
==
*
max_idx
)
(
*
max_idx
)
*
sizeof
(
edge
));
{
}
*
max_idx
*=
2
;
crossing_edges
[
i
++
]
=
e
;
crossing_edges
=
xrealloc
(
crossing_edges
,
}
(
*
max_idx
)
*
sizeof
(
edge
));
else
}
e
->
flags
&=
~
EDGE_CROSSING
;
crossing_edges
[
i
++
]
=
e
;
}
else
e
->
flags
&=
~
EDGE_CROSSING
;
}
}
}
*
n_crossing_edges
=
i
;
*
n_crossing_edges
=
i
;
}
}
...
@@ -1822,26 +1825,36 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges,
...
@@ -1822,26 +1825,36 @@ fix_edges_for_rarely_executed_code (edge *crossing_edges,
fix_up_fall_thru_edges
();
fix_up_fall_thru_edges
();
/* If the architecture does not have conditional branches that can
/* Only do the parts necessary for writing separate sections if
span all of memory, convert crossing conditional branches into
the target architecture has the ability to write separate sections
crossing unconditional branches. */
(i.e. it has named sections). Otherwise, the hot/cold partitioning
information will be used when reordering blocks to try to put all
if
(
!
HAS_LONG_COND_BRANCH
)
the hot blocks together, then all the cold blocks, but no actual
fix_crossing_conditional_branches
();
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 unconditional branches that
if
(
!
HAS_LONG_COND_BRANCH
)
can span all of memory, convert crossing unconditional branches
fix_crossing_conditional_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
)
/* If the architecture does not have unconditional branches that
{
can span all of memory, convert crossing unconditional branches
fix_crossing_unconditional_branches
();
into indirect jumps. Since adding an indirect jump also adds
reg_scan
(
get_insns
(),
max_reg_num
());
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
();
}
}
add_reg_crossing_jump_notes
();
}
}
/* Verify, in the basic block chain, that there is at most one switch
/* Verify, in the basic block chain, that there is at most one switch
...
@@ -1933,8 +1946,7 @@ reorder_basic_blocks (unsigned int flags)
...
@@ -1933,8 +1946,7 @@ reorder_basic_blocks (unsigned int flags)
dump_flow_info
(
dump_file
);
dump_flow_info
(
dump_file
);
cfg_layout_finalize
();
cfg_layout_finalize
();
if
(
flag_reorder_blocks_and_partition
)
verify_hot_cold_block_grouping
();
verify_hot_cold_block_grouping
();
timevar_pop
(
TV_REORDER_BLOCKS
);
timevar_pop
(
TV_REORDER_BLOCKS
);
}
}
...
@@ -1954,7 +1966,8 @@ insert_section_boundary_note (void)
...
@@ -1954,7 +1966,8 @@ insert_section_boundary_note (void)
rtx
new_note
;
rtx
new_note
;
int
first_partition
=
0
;
int
first_partition
=
0
;
if
(
flag_reorder_blocks_and_partition
)
if
(
flag_reorder_blocks_and_partition
&&
targetm
.
have_named_sections
)
FOR_EACH_BB
(
bb
)
FOR_EACH_BB
(
bb
)
{
{
if
(
!
first_partition
)
if
(
!
first_partition
)
...
...
gcc/dbxout.c
View file @
c3c822d5
...
@@ -938,14 +938,11 @@ dbxout_function_end (tree decl)
...
@@ -938,14 +938,11 @@ dbxout_function_end (tree decl)
#else
#else
if
(
flag_reorder_blocks_and_partition
)
if
(
flag_reorder_blocks_and_partition
)
{
{
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
decl
);
dbxout_begin_empty_stabs
(
N_FUN
);
dbxout_begin_empty_stabs
(
N_FUN
);
dbxout_stab_value_label_diff
(
cfun
->
hot_section_end_label
,
dbxout_stab_value_label_diff
(
hot_section_end_label
,
hot_section_label
);
cfun
->
hot_section_label
);
dbxout_begin_empty_stabs
(
N_FUN
);
dbxout_begin_empty_stabs
(
N_FUN
);
dbxout_stab_value_label_diff
(
c
fun
->
c
old_section_end_label
,
dbxout_stab_value_label_diff
(
cold_section_end_label
,
cfun
->
cold
_section_label
);
unlikely
_section_label
);
}
}
else
else
{
{
...
...
gcc/dwarf2out.c
View file @
c3c822d5
...
@@ -4122,9 +4122,6 @@ static int maybe_emit_file (int);
...
@@ -4122,9 +4122,6 @@ static int maybe_emit_file (int);
#ifndef TEXT_SECTION_LABEL
#ifndef TEXT_SECTION_LABEL
#define TEXT_SECTION_LABEL "Ltext"
#define TEXT_SECTION_LABEL "Ltext"
#endif
#endif
#ifndef COLD_TEXT_SECTION_LABEL
#define COLD_TEXT_SECTION_LABEL "Ltext_cold"
#endif
#ifndef DEBUG_LINE_SECTION_LABEL
#ifndef DEBUG_LINE_SECTION_LABEL
#define DEBUG_LINE_SECTION_LABEL "Ldebug_line"
#define DEBUG_LINE_SECTION_LABEL "Ldebug_line"
#endif
#endif
...
@@ -4152,8 +4149,6 @@ static int maybe_emit_file (int);
...
@@ -4152,8 +4149,6 @@ static int maybe_emit_file (int);
static
char
text_end_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
text_end_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
text_section_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
abbrev_section_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
static
char
debug_info_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
];
static
char
debug_line_section_label
[
MAX_ARTIFICIAL_LABEL_BYTES
];
...
@@ -4164,9 +4159,6 @@ static char ranges_section_label[2 * MAX_ARTIFICIAL_LABEL_BYTES];
...
@@ -4164,9 +4159,6 @@ static char ranges_section_label[2 * MAX_ARTIFICIAL_LABEL_BYTES];
#ifndef TEXT_END_LABEL
#ifndef TEXT_END_LABEL
#define TEXT_END_LABEL "Letext"
#define TEXT_END_LABEL "Letext"
#endif
#endif
#ifndef COLD_END_LABEL
#define COLD_END_LABEL "Letext_cold"
#endif
#ifndef BLOCK_BEGIN_LABEL
#ifndef BLOCK_BEGIN_LABEL
#define BLOCK_BEGIN_LABEL "LBB"
#define BLOCK_BEGIN_LABEL "LBB"
#endif
#endif
...
@@ -6807,14 +6799,13 @@ static void
...
@@ -6807,14 +6799,13 @@ static void
dwarf2out_switch_text_section
(
void
)
dwarf2out_switch_text_section
(
void
)
{
{
dw_fde_ref
fde
;
dw_fde_ref
fde
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
fde
=
&
fde_table
[
fde_table_in_use
-
1
];
fde
=
&
fde_table
[
fde_table_in_use
-
1
];
fde
->
dw_fde_switched_sections
=
true
;
fde
->
dw_fde_switched_sections
=
true
;
fde
->
dw_fde_hot_section_label
=
cfun
->
hot_section_label
;
fde
->
dw_fde_hot_section_label
=
xstrdup
(
hot_section_label
)
;
fde
->
dw_fde_hot_section_end_label
=
cfun
->
hot_section_end_label
;
fde
->
dw_fde_hot_section_end_label
=
xstrdup
(
hot_section_end_label
)
;
fde
->
dw_fde_unlikely_section_label
=
cfun
->
cold_section_label
;
fde
->
dw_fde_unlikely_section_label
=
xstrdup
(
unlikely_section_label
)
;
fde
->
dw_fde_unlikely_section_end_label
=
cfun
->
cold_section_end_label
;
fde
->
dw_fde_unlikely_section_end_label
=
xstrdup
(
cold_section_end_label
)
;
separate_line_info_table_in_use
++
;
separate_line_info_table_in_use
++
;
}
}
...
@@ -7244,15 +7235,14 @@ output_aranges (void)
...
@@ -7244,15 +7235,14 @@ output_aranges (void)
}
}
dw2_asm_output_addr
(
DWARF2_ADDR_SIZE
,
text_section_label
,
"Address"
);
dw2_asm_output_addr
(
DWARF2_ADDR_SIZE
,
text_section_label
,
"Address"
);
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
text_end_label
,
if
(
last_text_section
==
in_unlikely_executed_text
text_section_label
,
"Length"
);
||
(
last_text_section
==
in_named
if
(
flag_reorder_blocks_and_partition
)
&&
last_text_section_name
==
unlikely_text_section_name
))
{
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
text_end_label
,
dw2_asm_output_addr
(
DWARF2_ADDR_SIZE
,
cold_text_section_label
,
unlikely_section_label
,
"Length"
);
"Address"
);
else
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
cold_end_label
,
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
text_end_label
,
cold_text_section_label
,
"Length"
);
text_section_label
,
"Length"
);
}
for
(
i
=
0
;
i
<
arange_table_in_use
;
i
++
)
for
(
i
=
0
;
i
<
arange_table_in_use
;
i
++
)
{
{
...
@@ -7342,11 +7332,24 @@ output_ranges (void)
...
@@ -7342,11 +7332,24 @@ output_ranges (void)
base of the text section. */
base of the text section. */
if
(
separate_line_info_table_in_use
==
0
)
if
(
separate_line_info_table_in_use
==
0
)
{
{
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
blabel
,
if
(
last_text_section
==
in_unlikely_executed_text
text_section_label
,
||
(
last_text_section
==
in_named
fmt
,
i
*
2
*
DWARF2_ADDR_SIZE
);
&&
last_text_section_name
==
unlikely_text_section_name
))
dw2_asm_output_delta
(
DWARF2_ADDR_SIZE
,
elabel
,
{
text_section_label
,
NULL
);
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
);
}
}
}
/* Otherwise, we add a DW_AT_entry_pc attribute to force the
/* Otherwise, we add a DW_AT_entry_pc attribute to force the
...
@@ -7662,7 +7665,6 @@ output_line_info (void)
...
@@ -7662,7 +7665,6 @@ output_line_info (void)
long
line_delta
;
long
line_delta
;
unsigned
long
current_file
;
unsigned
long
current_file
;
unsigned
long
function
;
unsigned
long
function
;
struct
function
*
cfun
;
ASM_GENERATE_INTERNAL_LABEL
(
l1
,
LINE_NUMBER_BEGIN_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
l1
,
LINE_NUMBER_BEGIN_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
l2
,
LINE_NUMBER_END_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
l2
,
LINE_NUMBER_END_LABEL
,
0
);
...
@@ -7733,14 +7735,10 @@ output_line_info (void)
...
@@ -7733,14 +7735,10 @@ output_line_info (void)
current_file
=
1
;
current_file
=
1
;
current_line
=
1
;
current_line
=
1
;
if
(
current_function_decl
)
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
else
cfun
=
NULL
;
if
(
last_text_section
==
in_unlikely_executed_text
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
cfun
->
unlikely_text_section_name
))
&&
last_text_section_name
==
unlikely_text_section_name
))
strcpy
(
prev_line_label
,
cfun
->
cold
_section_label
);
strcpy
(
prev_line_label
,
unlikely
_section_label
);
else
else
strcpy
(
prev_line_label
,
text_section_label
);
strcpy
(
prev_line_label
,
text_section_label
);
for
(
lt_index
=
1
;
lt_index
<
line_info_table_in_use
;
++
lt_index
)
for
(
lt_index
=
1
;
lt_index
<
line_info_table_in_use
;
++
lt_index
)
...
@@ -10113,7 +10111,6 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
...
@@ -10113,7 +10111,6 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
const
char
*
endname
;
const
char
*
endname
;
dw_loc_list_ref
list
;
dw_loc_list_ref
list
;
rtx
varloc
;
rtx
varloc
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
/* We need to figure out what section we should use as the base
/* We need to figure out what section we should use as the base
...
@@ -10139,8 +10136,8 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
...
@@ -10139,8 +10136,8 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
}
}
else
if
(
last_text_section
==
in_unlikely_executed_text
else
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
cfun
->
unlikely_text_section_name
))
&&
last_text_section_name
==
unlikely_text_section_name
))
secname
=
cfun
->
cold
_section_label
;
secname
=
unlikely
_section_label
;
else
else
secname
=
text_section_label
;
secname
=
text_section_label
;
...
@@ -13233,7 +13230,6 @@ dwarf2out_var_location (rtx loc_note)
...
@@ -13233,7 +13230,6 @@ dwarf2out_var_location (rtx loc_note)
static
rtx
last_insn
;
static
rtx
last_insn
;
static
const
char
*
last_label
;
static
const
char
*
last_label
;
tree
decl
;
tree
decl
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
if
(
!
DECL_P
(
NOTE_VAR_LOCATION_DECL
(
loc_note
)))
if
(
!
DECL_P
(
NOTE_VAR_LOCATION_DECL
(
loc_note
)))
return
;
return
;
...
@@ -13262,8 +13258,8 @@ dwarf2out_var_location (rtx loc_note)
...
@@ -13262,8 +13258,8 @@ dwarf2out_var_location (rtx loc_note)
if
(
last_text_section
==
in_unlikely_executed_text
if
(
last_text_section
==
in_unlikely_executed_text
||
(
last_text_section
==
in_named
||
(
last_text_section
==
in_named
&&
last_text_section_name
==
cfun
->
unlikely_text_section_name
))
&&
last_text_section_name
==
unlikely_text_section_name
))
newloc
->
section_label
=
cfun
->
cold
_section_label
;
newloc
->
section_label
=
unlikely
_section_label
;
else
else
newloc
->
section_label
=
text_section_label
;
newloc
->
section_label
=
text_section_label
;
...
@@ -13501,9 +13497,6 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
...
@@ -13501,9 +13497,6 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
ASM_GENERATE_INTERNAL_LABEL
(
abbrev_section_label
,
ASM_GENERATE_INTERNAL_LABEL
(
abbrev_section_label
,
DEBUG_ABBREV_SECTION_LABEL
,
0
);
DEBUG_ABBREV_SECTION_LABEL
,
0
);
ASM_GENERATE_INTERNAL_LABEL
(
text_section_label
,
TEXT_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
,
ASM_GENERATE_INTERNAL_LABEL
(
debug_info_section_label
,
DEBUG_INFO_SECTION_LABEL
,
0
);
DEBUG_INFO_SECTION_LABEL
,
0
);
...
@@ -13528,11 +13521,6 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
...
@@ -13528,11 +13521,6 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
text_section
();
text_section
();
ASM_OUTPUT_LABEL
(
asm_out_file
,
text_section_label
);
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
/* A helper function for dwarf2out_finish called through
...
@@ -13864,11 +13852,6 @@ dwarf2out_finish (const char *filename)
...
@@ -13864,11 +13852,6 @@ dwarf2out_finish (const char *filename)
/* Output a terminator label for the .text section. */
/* Output a terminator label for the .text section. */
text_section
();
text_section
();
targetm
.
asm_out
.
internal_label
(
asm_out_file
,
TEXT_END_LABEL
,
0
);
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
/* Output the source line correspondence table. We must do this
even if there is no line information. Otherwise, on an empty
even if there is no line information. Otherwise, on an empty
...
...
gcc/function.h
View file @
c3c822d5
...
@@ -349,20 +349,6 @@ struct function GTY(())
...
@@ -349,20 +349,6 @@ struct function GTY(())
/* The variables unexpanded so far. */
/* The variables unexpanded so far. */
tree
unexpanded_var_list
;
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. */
/* Collected bit flags. */
/* Nonzero if function being compiled needs to be given an address
/* Nonzero if function being compiled needs to be given an address
...
...
gcc/opts.c
View file @
c3c822d5
...
@@ -678,15 +678,6 @@ decode_options (unsigned int argc, const char **argv)
...
@@ -678,15 +678,6 @@ decode_options (unsigned int argc, const char **argv)
flag_reorder_blocks_and_partition
=
0
;
flag_reorder_blocks_and_partition
=
0
;
flag_reorder_blocks
=
1
;
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
/* Handle target- and language-independent options. Return zero to
...
...
gcc/output.h
View file @
c3c822d5
...
@@ -453,6 +453,11 @@ enum in_section { no_section, in_text, in_unlikely_executed_text, in_data,
...
@@ -453,6 +453,11 @@ enum in_section { no_section, in_text, in_unlikely_executed_text, in_data,
#endif
#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
const
char
*
last_text_section_name
;
extern
enum
in_section
last_text_section
;
extern
enum
in_section
last_text_section
;
extern
bool
first_function_block_is_cold
;
extern
bool
first_function_block_is_cold
;
...
...
gcc/passes.c
View file @
c3c822d5
...
@@ -329,6 +329,8 @@ rest_of_handle_final (void)
...
@@ -329,6 +329,8 @@ rest_of_handle_final (void)
timevar_push
(
TV_SYMOUT
);
timevar_push
(
TV_SYMOUT
);
(
*
debug_hooks
->
function_decl
)
(
current_function_decl
);
(
*
debug_hooks
->
function_decl
)
(
current_function_decl
);
if
(
unlikely_text_section_name
)
free
(
unlikely_text_section_name
);
timevar_pop
(
TV_SYMOUT
);
timevar_pop
(
TV_SYMOUT
);
ggc_collect
();
ggc_collect
();
...
...
gcc/varasm.c
View file @
c3c822d5
...
@@ -101,6 +101,40 @@ tree last_assemble_variable_decl;
...
@@ -101,6 +101,40 @@ tree last_assemble_variable_decl;
bool
first_function_block_is_cold
;
bool
first_function_block_is_cold
;
/* The following global variable indicates the label name to be put at
the start of the first cold section within each function, when
partitioning basic blocks into hot and cold sections. Used for
debug info. */
char
*
unlikely_section_label
;
/* The following global variable indicates the label name to be put at
the start of the first hot section within each function, when
partitioning basic blocks into hot and cold sections. Used for
debug info. */
char
*
hot_section_label
;
/* The following global variable indicates the label name to be put at
the end of the last hot section within each function, when
partitioning basic blocks into hot and cold sections. Used for
debug info. */
char
*
hot_section_end_label
;
/* The following global variable indicates the label name to be put at
the end of the last cold section within each function, when
partitioning basic blocks into hot and cold sections. Used for
debug info.*/
char
*
cold_section_end_label
;
/* The following global variable indicates the seciton name to be used
for the current cold section, when partitiong hot and cold basic
blocks into separate sections. */
char
*
unlikely_text_section_name
;
/* We give all constants their own alias set. Perhaps redundant with
/* We give all constants their own alias set. Perhaps redundant with
MEM_READONLY_P, but pre-dates it. */
MEM_READONLY_P, but pre-dates it. */
...
@@ -177,37 +211,28 @@ static void
...
@@ -177,37 +211,28 @@ static void
initialize_cold_section_name
(
void
)
initialize_cold_section_name
(
void
)
{
{
const
char
*
name
;
const
char
*
name
;
const
char
*
stripped_name
;
char
*
buffer
;
int
len
;
int
len
;
struct
function
*
cfun
;
if
(
current_function_decl
)
if
(
!
unlikely_text_section_name
)
{
{
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
if
(
DECL_SECTION_NAME
(
current_function_decl
)
if
(
!
cfun
->
unlikely_text_section_name
)
&&
(
strcmp
(
TREE_STRING_POINTER
(
DECL_SECTION_NAME
(
current_function_decl
)),
HOT_TEXT_SECTION_NAME
)
!=
0
)
&&
(
strcmp
(
TREE_STRING_POINTER
(
DECL_SECTION_NAME
(
current_function_decl
)),
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
)
!=
0
))
{
{
if
(
flag_function_sections
name
=
TREE_STRING_POINTER
(
DECL_SECTION_NAME
&&
DECL_SECTION_NAME
(
current_function_decl
))
(
current_function_decl
));
{
len
=
strlen
(
name
);
name
=
xstrdup
(
TREE_STRING_POINTER
(
DECL_SECTION_NAME
unlikely_text_section_name
=
xmalloc
(
len
+
10
);
(
current_function_decl
)));
sprintf
(
unlikely_text_section_name
,
"%s%s"
,
name
,
"_unlikely"
);
stripped_name
=
targetm
.
strip_name_encoding
(
name
);
len
=
strlen
(
stripped_name
);
buffer
=
(
char
*
)
xmalloc
(
len
+
10
);
sprintf
(
buffer
,
"%s%s"
,
stripped_name
,
"_unlikely"
);
cfun
->
unlikely_text_section_name
=
ggc_strdup
(
buffer
);
free
(
buffer
);
free
((
char
*
)
name
);
}
else
cfun
->
unlikely_text_section_name
=
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
;
}
}
else
unlikely_text_section_name
=
xstrdup
(
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
);
}
}
else
internal_error
(
"initialize_cold_section_name called without valid current_function_decl."
);
}
}
/* Tell assembler to switch to text section. */
/* Tell assembler to switch to text section. */
...
@@ -228,25 +253,14 @@ text_section (void)
...
@@ -228,25 +253,14 @@ text_section (void)
void
void
unlikely_text_section
(
void
)
unlikely_text_section
(
void
)
{
{
if
(
current_function_decl
)
if
(
!
unlikely_text_section_name
)
{
initialize_cold_section_name
();
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
if
(
!
cfun
->
unlikely_text_section_name
)
if
((
in_section
!=
in_unlikely_executed_text
)
initialize_cold_section_name
();
&&
(
in_section
!=
in_named
||
strcmp
(
in_named_name
,
unlikely_text_section_name
)
!=
0
))
if
((
in_section
!=
in_unlikely_executed_text
)
&&
(
in_section
!=
in_named
||
strcmp
(
in_named_name
,
cfun
->
unlikely_text_section_name
)
!=
0
))
{
named_section
(
NULL_TREE
,
cfun
->
unlikely_text_section_name
,
0
);
in_section
=
in_unlikely_executed_text
;
last_text_section
=
in_unlikely_executed_text
;
}
}
else
{
{
named_section
(
NULL_TREE
,
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
,
0
);
named_section
(
NULL_TREE
,
unlikely_text_section_name
,
0
);
in_section
=
in_unlikely_executed_text
;
in_section
=
in_unlikely_executed_text
;
last_text_section
=
in_unlikely_executed_text
;
last_text_section
=
in_unlikely_executed_text
;
}
}
...
@@ -300,25 +314,11 @@ int
...
@@ -300,25 +314,11 @@ int
in_unlikely_text_section
(
void
)
in_unlikely_text_section
(
void
)
{
{
bool
ret_val
;
bool
ret_val
;
struct
function
*
cfun
;
if
(
current_function_decl
)
{
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
ret_val
=
((
in_section
==
in_unlikely_executed_text
)
ret_val
=
((
in_section
==
in_unlikely_executed_text
)
||
(
in_section
==
in_named
||
(
in_section
==
in_named
&&
cfun
->
unlikely_text_section_name
&&
unlikely_text_section_name
&&
strcmp
(
in_named_name
,
&&
strcmp
(
in_named_name
,
unlikely_text_section_name
)
==
0
));
cfun
->
unlikely_text_section_name
)
==
0
));
}
else
{
ret_val
=
((
in_section
==
in_unlikely_executed_text
)
||
(
in_section
==
in_named
&&
strcmp
(
in_named_name
,
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
)
==
0
));
}
return
ret_val
;
return
ret_val
;
}
}
...
@@ -463,12 +463,9 @@ named_section (tree decl, const char *name, int reloc)
...
@@ -463,12 +463,9 @@ named_section (tree decl, const char *name, int reloc)
name
=
TREE_STRING_POINTER
(
DECL_SECTION_NAME
(
decl
));
name
=
TREE_STRING_POINTER
(
DECL_SECTION_NAME
(
decl
));
if
(
strcmp
(
name
,
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
)
==
0
if
(
strcmp
(
name
,
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
)
==
0
&&
current_function_decl
&&
!
unlikely_text_section_name
)
&&
!
(
DECL_STRUCT_FUNCTION
(
current_function_decl
))
->
unlikely_text_section_name
)
unlikely_text_section_name
=
{
xstrdup
(
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
);
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
cfun
->
unlikely_text_section_name
=
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
;
}
flags
=
targetm
.
section_type_flags
(
decl
,
name
,
reloc
);
flags
=
targetm
.
section_type_flags
(
decl
,
name
,
reloc
);
...
@@ -577,17 +574,16 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
...
@@ -577,17 +574,16 @@ asm_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
void
void
function_section
(
tree
decl
)
function_section
(
tree
decl
)
{
{
int
reloc
=
0
;
bool
unlikely
=
false
;
if
(
first_function_block_is_cold
)
if
(
first_function_block_is_cold
)
reloc
=
1
;
unlikely
=
true
;
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
targetm
.
asm_out
.
select_section
(
decl
,
reloc
,
DECL_ALIGN
(
decl
));
targetm
.
asm_out
.
select_section
(
decl
,
unlikely
,
DECL_ALIGN
(
decl
));
#else
#else
if
(
decl
!=
NULL_TREE
if
(
decl
!=
NULL_TREE
&&
DECL_SECTION_NAME
(
decl
)
!=
NULL_TREE
&&
DECL_SECTION_NAME
(
decl
)
!=
NULL_TREE
)
&&
targetm
.
have_named_sections
)
named_section
(
decl
,
(
char
*
)
0
,
0
);
named_section
(
decl
,
(
char
*
)
0
,
0
);
else
else
text_section
();
text_section
();
...
@@ -598,20 +594,16 @@ void
...
@@ -598,20 +594,16 @@ void
current_function_section
(
tree
decl
)
current_function_section
(
tree
decl
)
{
{
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
#ifdef USE_SELECT_SECTION_FOR_FUNCTIONS
int
reloc
=
0
;
bool
unlikely
=
(
in_unlikely_text_section
()
||
(
last_text_section
==
in_unlikely_executed_text
));
if
(
in_unlikely_text_section
()
||
last_text_section
==
in_unlikely_executed_text
)
targetm
.
asm_out
.
select_section
(
decl
,
unlikely
,
DECL_ALIGN
(
decl
));
reloc
=
1
;
targetm
.
asm_out
.
select_section
(
decl
,
reloc
,
DECL_ALIGN
(
decl
));
#else
#else
if
(
last_text_section
==
in_unlikely_executed_text
)
if
(
last_text_section
==
in_unlikely_executed_text
)
unlikely_text_section
();
unlikely_text_section
();
else
if
(
last_text_section
==
in_text
)
else
if
(
last_text_section
==
in_text
)
text_section
();
text_section
();
else
if
(
last_text_section
==
in_named
else
if
(
last_text_section
==
in_named
)
&&
targetm
.
have_named_sections
)
named_section
(
NULL_TREE
,
last_text_section_name
,
0
);
named_section
(
NULL_TREE
,
last_text_section_name
,
0
);
else
else
function_section
(
decl
);
function_section
(
decl
);
...
@@ -1232,32 +1224,18 @@ void
...
@@ -1232,32 +1224,18 @@ void
assemble_start_function
(
tree
decl
,
const
char
*
fnname
)
assemble_start_function
(
tree
decl
,
const
char
*
fnname
)
{
{
int
align
;
int
align
;
char
tmp_label
[
100
];
bool
hot_label_written
=
false
;
bool
hot_label_written
=
false
;
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
decl
);
cfun
->
unlikely_text_section_name
=
NULL
;
unlikely_text_section_name
=
NULL
;
first_function_block_is_cold
=
false
;
first_function_block_is_cold
=
false
;
if
(
flag_reorder_blocks_and_partition
)
hot_section_label
=
reconcat
(
hot_section_label
,
fnname
,
".hot_section"
,
NULL
);
{
unlikely_section_label
=
reconcat
(
unlikely_section_label
,
ASM_GENERATE_INTERNAL_LABEL
(
tmp_label
,
"HOTB"
,
const_labelno
);
fnname
,
".unlikely_section"
,
NULL
);
cfun
->
hot_section_label
=
ggc_strdup
(
tmp_label
);
hot_section_end_label
=
reconcat
(
hot_section_end_label
,
ASM_GENERATE_INTERNAL_LABEL
(
tmp_label
,
"COLDB"
,
const_labelno
);
fnname
,
".end"
,
NULL
);
cfun
->
cold_section_label
=
ggc_strdup
(
tmp_label
);
cold_section_end_label
=
reconcat
(
cold_section_end_label
,
ASM_GENERATE_INTERNAL_LABEL
(
tmp_label
,
"HOTE"
,
const_labelno
);
fnname
,
".end.cold"
,
NULL
);
cfun
->
hot_section_end_label
=
ggc_strdup
(
tmp_label
);
ASM_GENERATE_INTERNAL_LABEL
(
tmp_label
,
"COLDE"
,
const_labelno
);
cfun
->
cold_section_end_label
=
ggc_strdup
(
tmp_label
);
const_labelno
++
;
}
else
{
cfun
->
hot_section_label
=
NULL
;
cfun
->
cold_section_label
=
NULL
;
cfun
->
hot_section_end_label
=
NULL
;
cfun
->
cold_section_end_label
=
NULL
;
}
/* The following code does not need preprocessing in the assembler. */
/* The following code does not need preprocessing in the assembler. */
...
@@ -1275,7 +1253,7 @@ assemble_start_function (tree decl, const char *fnname)
...
@@ -1275,7 +1253,7 @@ assemble_start_function (tree decl, const char *fnname)
{
{
unlikely_text_section
();
unlikely_text_section
();
assemble_align
(
FUNCTION_BOUNDARY
);
assemble_align
(
FUNCTION_BOUNDARY
);
ASM_OUTPUT_LABEL
(
asm_out_file
,
cfun
->
cold
_section_label
);
ASM_OUTPUT_LABEL
(
asm_out_file
,
unlikely
_section_label
);
if
(
BB_PARTITION
(
ENTRY_BLOCK_PTR
->
next_bb
)
==
BB_COLD_PARTITION
)
if
(
BB_PARTITION
(
ENTRY_BLOCK_PTR
->
next_bb
)
==
BB_COLD_PARTITION
)
{
{
/* Since the function starts with a cold section, we need to
/* Since the function starts with a cold section, we need to
...
@@ -1283,7 +1261,7 @@ assemble_start_function (tree decl, const char *fnname)
...
@@ -1283,7 +1261,7 @@ assemble_start_function (tree decl, const char *fnname)
section label. */
section label. */
text_section
();
text_section
();
assemble_align
(
FUNCTION_BOUNDARY
);
assemble_align
(
FUNCTION_BOUNDARY
);
ASM_OUTPUT_LABEL
(
asm_out_file
,
cfun
->
hot_section_label
);
ASM_OUTPUT_LABEL
(
asm_out_file
,
hot_section_label
);
hot_label_written
=
true
;
hot_label_written
=
true
;
first_function_block_is_cold
=
true
;
first_function_block_is_cold
=
true
;
}
}
...
@@ -1313,8 +1291,8 @@ assemble_start_function (tree decl, const char *fnname)
...
@@ -1313,8 +1291,8 @@ assemble_start_function (tree decl, const char *fnname)
s
[
i
]
=
(
TREE_STRING_POINTER
(
DECL_SECTION_NAME
(
decl
)))[
i
];
s
[
i
]
=
(
TREE_STRING_POINTER
(
DECL_SECTION_NAME
(
decl
)))[
i
];
s
[
len
]
=
'\0'
;
s
[
len
]
=
'\0'
;
if
(
cfun
->
unlikely_text_section_name
if
(
unlikely_text_section_name
&&
(
strcmp
(
s
,
cfun
->
unlikely_text_section_name
)
==
0
))
&&
(
strcmp
(
s
,
unlikely_text_section_name
)
==
0
))
first_function_block_is_cold
=
true
;
first_function_block_is_cold
=
true
;
}
}
...
@@ -1325,8 +1303,8 @@ assemble_start_function (tree decl, const char *fnname)
...
@@ -1325,8 +1303,8 @@ assemble_start_function (tree decl, const char *fnname)
/* Switch to the correct text section for the start of the function. */
/* Switch to the correct text section for the start of the function. */
function_section
(
decl
);
function_section
(
decl
);
if
(
flag_reorder_blocks_and_partition
&&
!
hot_label_written
)
if
(
!
hot_label_written
)
ASM_OUTPUT_LABEL
(
asm_out_file
,
cfun
->
hot_section_label
);
ASM_OUTPUT_LABEL
(
asm_out_file
,
hot_section_label
);
/* Tell assembler to move to target machine's alignment for functions. */
/* Tell assembler to move to target machine's alignment for functions. */
align
=
floor_log2
(
FUNCTION_BOUNDARY
/
BITS_PER_UNIT
);
align
=
floor_log2
(
FUNCTION_BOUNDARY
/
BITS_PER_UNIT
);
...
@@ -1388,6 +1366,7 @@ assemble_start_function (tree decl, const char *fnname)
...
@@ -1388,6 +1366,7 @@ assemble_start_function (tree decl, const char *fnname)
void
void
assemble_end_function
(
tree
decl
,
const
char
*
fnname
)
assemble_end_function
(
tree
decl
,
const
char
*
fnname
)
{
{
enum
in_section
save_text_section
;
#ifdef ASM_DECLARE_FUNCTION_SIZE
#ifdef ASM_DECLARE_FUNCTION_SIZE
ASM_DECLARE_FUNCTION_SIZE
(
asm_out_file
,
fnname
,
decl
);
ASM_DECLARE_FUNCTION_SIZE
(
asm_out_file
,
fnname
,
decl
);
#endif
#endif
...
@@ -1398,19 +1377,13 @@ assemble_end_function (tree decl, const char *fnname)
...
@@ -1398,19 +1377,13 @@ assemble_end_function (tree decl, const char *fnname)
}
}
/* Output labels for end of hot/cold text sections (to be used by
/* Output labels for end of hot/cold text sections (to be used by
debug info.) */
debug info.) */
if
(
flag_reorder_blocks_and_partition
)
save_text_section
=
in_section
;
{
unlikely_text_section
();
enum
in_section
save_text_section
;
ASM_OUTPUT_LABEL
(
asm_out_file
,
cold_section_end_label
);
struct
function
*
cfun
=
DECL_STRUCT_FUNCTION
(
decl
);
text_section
();
ASM_OUTPUT_LABEL
(
asm_out_file
,
hot_section_end_label
);
save_text_section
=
in_section
;
if
(
save_text_section
==
in_unlikely_executed_text
)
unlikely_text_section
();
unlikely_text_section
();
ASM_OUTPUT_LABEL
(
asm_out_file
,
cfun
->
cold_section_end_label
);
text_section
();
ASM_OUTPUT_LABEL
(
asm_out_file
,
cfun
->
hot_section_end_label
);
if
(
save_text_section
==
in_unlikely_executed_text
)
unlikely_text_section
();
}
}
}
/* Assemble code to leave SIZE bytes of zeros. */
/* Assemble code to leave SIZE bytes of zeros. */
...
@@ -4793,23 +4766,14 @@ default_section_type_flags_1 (tree decl, const char *name, int reloc,
...
@@ -4793,23 +4766,14 @@ default_section_type_flags_1 (tree decl, const char *name, int reloc,
int
shlib
)
int
shlib
)
{
{
unsigned
int
flags
;
unsigned
int
flags
;
struct
function
*
cfun
=
NULL
;
if
(
current_function_decl
)
cfun
=
DECL_STRUCT_FUNCTION
(
current_function_decl
);
if
(
decl
&&
TREE_CODE
(
decl
)
==
FUNCTION_DECL
)
if
(
decl
&&
TREE_CODE
(
decl
)
==
FUNCTION_DECL
)
flags
=
SECTION_CODE
;
flags
=
SECTION_CODE
;
else
if
(
decl
&&
decl_readonly_section_1
(
decl
,
reloc
,
shlib
))
else
if
(
decl
&&
decl_readonly_section_1
(
decl
,
reloc
,
shlib
))
flags
=
0
;
flags
=
0
;
else
if
(
current_function_decl
else
if
(
unlikely_text_section_name
&&
cfun
->
unlikely_text_section_name
&&
strcmp
(
name
,
unlikely_text_section_name
)
==
0
)
&&
strcmp
(
name
,
cfun
->
unlikely_text_section_name
)
==
0
)
flags
=
SECTION_CODE
;
flags
=
SECTION_CODE
;
else
if
(
!
decl
&&
!
current_function_decl
&&
strcmp
(
name
,
UNLIKELY_EXECUTED_TEXT_SECTION_NAME
)
==
0
)
flags
=
SECTION_CODE
;
else
else
flags
=
SECTION_WRITE
;
flags
=
SECTION_WRITE
;
...
...
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