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
992c31e6
Commit
992c31e6
authored
Nov 11, 2006
by
Jan Hubicka
Committed by
Jan Hubicka
Nov 11, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* predict.c (predict_loops): Kill RTL variant.
From-SVN: r118694
parent
6039a0c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
64 deletions
+32
-64
gcc/ChangeLog
+5
-1
gcc/predict.c
+27
-63
No files found.
gcc/ChangeLog
View file @
992c31e6
2006
-
11
-
11
Jan
Hubicka
<
jh
@suse
.
cz
>
2006
-
11
-
11
Jan
Hubicka
<
jh
@suse
.
cz
>
*
predict
.
c
(
predict_loops
)
:
Kill
RTL
variant
.
2006
-
11
-
11
Jan
Hubicka
<
jh
@suse
.
cz
>
*
tree
-
pass
.
h
(
pass_purge_lineno_notes
)
:
Remove
declaration
.
*
tree
-
pass
.
h
(
pass_purge_lineno_notes
)
:
Remove
declaration
.
*
modulo
-
sched
.
c
(
find_line_note
)
:
Remove
.
*
modulo
-
sched
.
c
(
find_line_note
)
:
Remove
.
(
loop_canon_p
)
:
Do
not
worry
about
line
number
notes
.
(
loop_canon_p
)
:
Do
not
worry
about
line
number
notes
.
...
@@ -98,7 +102,7 @@
...
@@ -98,7 +102,7 @@
*
local
-
alloc
.
c
(
update_equiv_regs
)
:
Copy
the
memory
RTX
to
be
used
*
local
-
alloc
.
c
(
update_equiv_regs
)
:
Copy
the
memory
RTX
to
be
used
in
REG_EQUIV
notes
.
in
REG_EQUIV
notes
.
*
gcse
.
c
(
try_replace_reg
)
:
Copy
the
replacement
.
*
gcse
.
c
(
try_replace_reg
)
:
Copy
the
replacement
.
*
i386
.
c
(
emit_i387_cw_initialization
)
:
Copy
stored_mode
*
i386
.
c
(
emit_i387_cw_initialization
)
:
Copy
stored_mode
.
(
assign_386_stack_local
)
:
Always
return
copied
memory
expression
(
assign_386_stack_local
)
:
Always
return
copied
memory
expression
*
function
.
c
(
instantiate_virtual_regs_in_insn
)
:
Copy
the
operand
*
function
.
c
(
instantiate_virtual_regs_in_insn
)
:
Copy
the
operand
duplicates
.
duplicates
.
...
...
gcc/predict.c
View file @
992c31e6
...
@@ -631,12 +631,11 @@ combine_predictions_for_bb (basic_block bb)
...
@@ -631,12 +631,11 @@ combine_predictions_for_bb (basic_block bb)
When RTLSIMPLELOOPS is set, attempt to count number of iterations by analyzing
When RTLSIMPLELOOPS is set, attempt to count number of iterations by analyzing
RTL otherwise use tree based approach. */
RTL otherwise use tree based approach. */
static
void
static
void
predict_loops
(
struct
loops
*
loops_info
,
bool
rtlsimpleloops
)
predict_loops
(
struct
loops
*
loops_info
)
{
{
unsigned
i
;
unsigned
i
;
if
(
!
rtlsimpleloops
)
scev_initialize
(
loops_info
);
scev_initialize
(
loops_info
);
/* Try to predict out blocks in a loop that are not part of a
/* Try to predict out blocks in a loop that are not part of a
natural loop. */
natural loop. */
...
@@ -646,69 +645,38 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
...
@@ -646,69 +645,38 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
unsigned
j
;
unsigned
j
;
unsigned
n_exits
;
unsigned
n_exits
;
struct
loop
*
loop
=
loops_info
->
parray
[
i
];
struct
loop
*
loop
=
loops_info
->
parray
[
i
];
struct
niter_desc
desc
;
unsigned
HOST_WIDE_INT
niter
;
edge
*
exits
;
edge
*
exits
;
struct
tree_niter_desc
niter_desc
;
exits
=
get_loop_exit_edges
(
loop
,
&
n_exits
);
exits
=
get_loop_exit_edges
(
loop
,
&
n_exits
);
if
(
rtlsimpleloops
)
{
iv_analysis_loop_init
(
loop
);
find_simple_exit
(
loop
,
&
desc
);
if
(
desc
.
simple_p
&&
desc
.
const_iter
)
for
(
j
=
0
;
j
<
n_exits
;
j
++
)
{
int
prob
;
niter
=
desc
.
niter
+
1
;
if
(
niter
==
0
)
/* We might overflow here. */
niter
=
desc
.
niter
;
if
(
niter
>
(
unsigned
int
)
PARAM_VALUE
(
PARAM_MAX_PREDICTED_ITERATIONS
))
niter
=
PARAM_VALUE
(
PARAM_MAX_PREDICTED_ITERATIONS
);
prob
=
(
REG_BR_PROB_BASE
-
(
REG_BR_PROB_BASE
+
niter
/
2
)
/
niter
);
/* Branch prediction algorithm gives 0 frequency for everything
after the end of loop for loop having 0 probability to finish. */
if
(
prob
==
REG_BR_PROB_BASE
)
prob
=
REG_BR_PROB_BASE
-
1
;
predict_edge
(
desc
.
in_edge
,
PRED_LOOP_ITERATIONS
,
prob
);
}
}
else
{
{
struct
tree_niter_desc
niter_desc
;
tree
niter
=
NULL
;
for
(
j
=
0
;
j
<
n_exits
;
j
++
)
{
tree
niter
=
NULL
;
if
(
number_of_iterations_exit
(
loop
,
exits
[
j
],
&
niter_desc
,
false
))
if
(
number_of_iterations_exit
(
loop
,
exits
[
j
],
&
niter_desc
,
false
))
niter
=
niter_desc
.
niter
;
niter
=
niter_desc
.
niter
;
if
(
!
niter
||
TREE_CODE
(
niter_desc
.
niter
)
!=
INTEGER_CST
)
if
(
!
niter
||
TREE_CODE
(
niter_desc
.
niter
)
!=
INTEGER_CST
)
niter
=
loop_niter_by_eval
(
loop
,
exits
[
j
]);
niter
=
loop_niter_by_eval
(
loop
,
exits
[
j
]);
if
(
TREE_CODE
(
niter
)
==
INTEGER_CST
)
if
(
TREE_CODE
(
niter
)
==
INTEGER_CST
)
{
int
probability
;
int
max
=
PARAM_VALUE
(
PARAM_MAX_PREDICTED_ITERATIONS
);
if
(
host_integerp
(
niter
,
1
)
&&
tree_int_cst_lt
(
niter
,
build_int_cstu
(
NULL_TREE
,
max
-
1
)))
{
{
int
probability
;
HOST_WIDE_INT
nitercst
=
tree_low_cst
(
niter
,
1
)
+
1
;
int
max
=
PARAM_VALUE
(
PARAM_MAX_PREDICTED_ITERATIONS
);
probability
=
((
REG_BR_PROB_BASE
+
nitercst
/
2
)
if
(
host_integerp
(
niter
,
1
)
/
nitercst
);
&&
tree_int_cst_lt
(
niter
,
build_int_cstu
(
NULL_TREE
,
max
-
1
)))
{
HOST_WIDE_INT
nitercst
=
tree_low_cst
(
niter
,
1
)
+
1
;
probability
=
((
REG_BR_PROB_BASE
+
nitercst
/
2
)
/
nitercst
);
}
else
probability
=
((
REG_BR_PROB_BASE
+
max
/
2
)
/
max
);
predict_edge
(
exits
[
j
],
PRED_LOOP_ITERATIONS
,
probability
);
}
}
}
else
probability
=
((
REG_BR_PROB_BASE
+
max
/
2
)
/
max
);
predict_edge
(
exits
[
j
],
PRED_LOOP_ITERATIONS
,
probability
);
}
}
}
free
(
exits
);
free
(
exits
);
...
@@ -726,8 +694,7 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
...
@@ -726,8 +694,7 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
statements construct loops via "non-loop" constructs
statements construct loops via "non-loop" constructs
in the source language and are better to be handled
in the source language and are better to be handled
separately. */
separately. */
if
((
rtlsimpleloops
&&
!
can_predict_insn_p
(
BB_END
(
bb
)))
if
(
predicted_by_p
(
bb
,
PRED_CONTINUE
))
||
predicted_by_p
(
bb
,
PRED_CONTINUE
))
continue
;
continue
;
/* Loop branch heuristics - predict an edge back to a
/* Loop branch heuristics - predict an edge back to a
...
@@ -776,11 +743,8 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
...
@@ -776,11 +743,8 @@ predict_loops (struct loops *loops_info, bool rtlsimpleloops)
free
(
bbs
);
free
(
bbs
);
}
}
if
(
!
rtlsimpleloops
)
scev_finalize
();
{
current_loops
=
NULL
;
scev_finalize
();
current_loops
=
NULL
;
}
}
}
/* Attempt to predict probabilities of BB outgoing edges using local
/* Attempt to predict probabilities of BB outgoing edges using local
...
@@ -1303,7 +1267,7 @@ tree_estimate_probability (void)
...
@@ -1303,7 +1267,7 @@ tree_estimate_probability (void)
tree_bb_level_predictions
();
tree_bb_level_predictions
();
mark_irreducible_loops
(
&
loops_info
);
mark_irreducible_loops
(
&
loops_info
);
predict_loops
(
&
loops_info
,
false
);
predict_loops
(
&
loops_info
);
FOR_EACH_BB
(
bb
)
FOR_EACH_BB
(
bb
)
{
{
...
...
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