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
000051e1
Commit
000051e1
authored
Oct 02, 2015
by
Aditya Kumar
Committed by
Sebastian Pop
Oct 02, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reject loops early where ivs cannot be represented
From-SVN: r228403
parent
cce7865c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
59 deletions
+58
-59
gcc/ChangeLog
+14
-0
gcc/graphite-scop-detection.c
+28
-0
gcc/graphite-sese-to-poly.c
+16
-59
No files found.
gcc/ChangeLog
View file @
000051e1
2015
-
10
-
02
Aditya
Kumar
<
aditya
.
k7
@
samsung
.
com
>
*
graphite
-
scop
-
detection
.
c
(
loop_ivs_can_be_represented
):
New
.
(
loop_body_is_valid_scop
):
Call
loop_ivs_can_be_represented
.
*
graphite
-
sese
-
to
-
poly
.
c
(
new_gimple_bb
):
Renamed
new_gimple_poly_bb
.
(
free_gimple_bb
):
Renamed
free_gimple_poly_bb
.
(
try_generate_gimple_bb
):
Hoist
loop
invariant
code
.
(
analyze_drs_in_stmts
):
Same
.
(
build_scop_drs
):
Call
renamed
functions
.
(
new_pbb_from_pbb
):
Same
.
(
scop_ivs_can_be_represented
):
Delete
as
functionality
now
moved
to
graphite
-
scop
-
detection
.
c
(
build_poly_scop
):
Remove
call
to
scop_ivs_can_be_represented
.
2015
-
10
-
02
Aditya
Kumar
<
hiraditya
@
msn
.
com
>
2015
-
10
-
02
Aditya
Kumar
<
hiraditya
@
msn
.
com
>
*
graphite
-
scop
-
detection
.
c
(
stmt_has_side_effects
):
New
function
*
graphite
-
scop
-
detection
.
c
(
stmt_has_side_effects
):
New
function
gcc/graphite-scop-detection.c
View file @
000051e1
...
@@ -811,12 +811,40 @@ dot_scop (scop_p scop)
...
@@ -811,12 +811,40 @@ dot_scop (scop_p scop)
#endif
#endif
}
}
/* Can all ivs be represented by a signed integer?
As ISL might generate negative values in its expressions, signed loop ivs
are required in the backend. */
static
bool
loop_ivs_can_be_represented
(
loop_p
loop
)
{
for
(
gphi_iterator
psi
=
gsi_start_phis
(
loop
->
header
);
!
gsi_end_p
(
psi
);
gsi_next
(
&
psi
))
{
gphi
*
phi
=
psi
.
phi
();
tree
res
=
PHI_RESULT
(
phi
);
tree
type
=
TREE_TYPE
(
res
);
if
(
TYPE_UNSIGNED
(
type
)
&&
TYPE_PRECISION
(
type
)
>=
TYPE_PRECISION
(
long_long_integer_type_node
))
return
false
;
}
return
true
;
}
/* Return true when the body of LOOP has statements that can be represented as a
/* Return true when the body of LOOP has statements that can be represented as a
valid scop. */
valid scop. */
static
bool
static
bool
loop_body_is_valid_scop
(
loop_p
loop
,
sese_l
scop
)
loop_body_is_valid_scop
(
loop_p
loop
,
sese_l
scop
)
{
{
if
(
!
loop_ivs_can_be_represented
(
loop
))
{
DEBUG_PRINT
(
dp
<<
"[scop-detection-fail] loop_"
<<
loop
->
num
<<
"IV cannot be represented.
\n
"
);
return
false
;
}
if
(
!
loop_nest_has_data_refs
(
loop
))
if
(
!
loop_nest_has_data_refs
(
loop
))
{
{
DEBUG_PRINT
(
dp
<<
"[scop-detection-fail] loop_"
DEBUG_PRINT
(
dp
<<
"[scop-detection-fail] loop_"
...
...
gcc/graphite-sese-to-poly.c
View file @
000051e1
...
@@ -199,7 +199,7 @@ reduction_phi_p (sese region, gphi_iterator *psi)
...
@@ -199,7 +199,7 @@ reduction_phi_p (sese region, gphi_iterator *psi)
/* Store the GRAPHITE representation of BB. */
/* Store the GRAPHITE representation of BB. */
static
gimple_poly_bb_p
static
gimple_poly_bb_p
new_gimple_bb
(
basic_block
bb
,
vec
<
data_reference_p
>
drs
)
new_gimple_
poly_
bb
(
basic_block
bb
,
vec
<
data_reference_p
>
drs
)
{
{
gimple_poly_bb_p
gbb
;
gimple_poly_bb_p
gbb
;
...
@@ -233,7 +233,7 @@ free_data_refs_aux (vec<data_reference_p> datarefs)
...
@@ -233,7 +233,7 @@ free_data_refs_aux (vec<data_reference_p> datarefs)
/* Frees GBB. */
/* Frees GBB. */
static
void
static
void
free_gimple_bb
(
gimple_poly_bb_p
gbb
)
free_gimple_
poly_
bb
(
gimple_poly_bb_p
gbb
)
{
{
free_data_refs_aux
(
GBB_DATA_REFS
(
gbb
));
free_data_refs_aux
(
GBB_DATA_REFS
(
gbb
));
free_data_refs
(
GBB_DATA_REFS
(
gbb
));
free_data_refs
(
GBB_DATA_REFS
(
gbb
));
...
@@ -253,7 +253,7 @@ remove_gbbs_in_scop (scop_p scop)
...
@@ -253,7 +253,7 @@ remove_gbbs_in_scop (scop_p scop)
poly_bb_p
pbb
;
poly_bb_p
pbb
;
FOR_EACH_VEC_ELT
(
SCOP_BBS
(
scop
),
i
,
pbb
)
FOR_EACH_VEC_ELT
(
SCOP_BBS
(
scop
),
i
,
pbb
)
free_gimple_bb
(
PBB_BLACK_BOX
(
pbb
));
free_gimple_
poly_
bb
(
PBB_BLACK_BOX
(
pbb
));
}
}
/* Deletes all scops in SCOPS. */
/* Deletes all scops in SCOPS. */
...
@@ -283,25 +283,23 @@ try_generate_gimple_bb (scop_p scop, basic_block bb)
...
@@ -283,25 +283,23 @@ try_generate_gimple_bb (scop_p scop, basic_block bb)
vec
<
data_reference_p
>
drs
;
vec
<
data_reference_p
>
drs
;
drs
.
create
(
5
);
drs
.
create
(
5
);
sese
region
=
SCOP_REGION
(
scop
);
sese
region
=
SCOP_REGION
(
scop
);
loop_p
nest
=
outermost_loop_in_sese
(
region
,
bb
);
loop_p
nest
=
outermost_loop_in_sese
(
region
,
bb
);
gimple_stmt_iterator
gsi
;
loop_p
loop
=
bb
->
loop_father
;
if
(
!
loop_in_sese_p
(
loop
,
region
))
loop
=
nest
;
gimple_stmt_iterator
gsi
;
for
(
gsi
=
gsi_start_bb
(
bb
);
!
gsi_end_p
(
gsi
);
gsi_next
(
&
gsi
))
for
(
gsi
=
gsi_start_bb
(
bb
);
!
gsi_end_p
(
gsi
);
gsi_next
(
&
gsi
))
{
{
gimple
*
stmt
=
gsi_stmt
(
gsi
);
gimple
*
stmt
=
gsi_stmt
(
gsi
);
loop_p
loop
;
if
(
is_gimple_debug
(
stmt
))
if
(
is_gimple_debug
(
stmt
))
continue
;
continue
;
loop
=
loop_containing_stmt
(
stmt
);
if
(
!
loop_in_sese_p
(
loop
,
region
))
loop
=
nest
;
graphite_find_data_references_in_stmt
(
nest
,
loop
,
stmt
,
&
drs
);
graphite_find_data_references_in_stmt
(
nest
,
loop
,
stmt
,
&
drs
);
}
}
return
new_gimple_bb
(
bb
,
drs
);
return
new_gimple_
poly_
bb
(
bb
,
drs
);
}
}
/* Returns true if all predecessors of BB, that are not dominated by BB, are
/* Returns true if all predecessors of BB, that are not dominated by BB, are
...
@@ -1861,7 +1859,7 @@ build_scop_drs (scop_p scop)
...
@@ -1861,7 +1859,7 @@ build_scop_drs (scop_p scop)
for
(
i
=
0
;
SCOP_BBS
(
scop
).
iterate
(
i
,
&
pbb
);
i
++
)
for
(
i
=
0
;
SCOP_BBS
(
scop
).
iterate
(
i
,
&
pbb
);
i
++
)
if
(
GBB_DATA_REFS
(
PBB_BLACK_BOX
(
pbb
)).
is_empty
())
if
(
GBB_DATA_REFS
(
PBB_BLACK_BOX
(
pbb
)).
is_empty
())
{
{
free_gimple_bb
(
PBB_BLACK_BOX
(
pbb
));
free_gimple_
poly_
bb
(
PBB_BLACK_BOX
(
pbb
));
free_poly_bb
(
pbb
);
free_poly_bb
(
pbb
);
SCOP_BBS
(
scop
).
ordered_remove
(
i
);
SCOP_BBS
(
scop
).
ordered_remove
(
i
);
i
--
;
i
--
;
...
@@ -1909,19 +1907,18 @@ analyze_drs_in_stmts (scop_p scop, basic_block bb, vec<gimple *> stmts)
...
@@ -1909,19 +1907,18 @@ analyze_drs_in_stmts (scop_p scop, basic_block bb, vec<gimple *> stmts)
return
;
return
;
nest
=
outermost_loop_in_sese
(
region
,
bb
);
nest
=
outermost_loop_in_sese
(
region
,
bb
);
loop_p
loop
=
bb
->
loop_father
;
if
(
!
loop_in_sese_p
(
loop
,
region
))
loop
=
nest
;
gbb
=
gbb_from_bb
(
bb
);
gbb
=
gbb_from_bb
(
bb
);
FOR_EACH_VEC_ELT
(
stmts
,
i
,
stmt
)
FOR_EACH_VEC_ELT
(
stmts
,
i
,
stmt
)
{
{
loop_p
loop
;
if
(
is_gimple_debug
(
stmt
))
if
(
is_gimple_debug
(
stmt
))
continue
;
continue
;
loop
=
loop_containing_stmt
(
stmt
);
if
(
!
loop_in_sese_p
(
loop
,
region
))
loop
=
nest
;
graphite_find_data_references_in_stmt
(
nest
,
loop
,
stmt
,
graphite_find_data_references_in_stmt
(
nest
,
loop
,
stmt
,
&
GBB_DATA_REFS
(
gbb
));
&
GBB_DATA_REFS
(
gbb
));
}
}
...
@@ -1983,7 +1980,7 @@ new_pbb_from_pbb (scop_p scop, poly_bb_p pbb, basic_block bb)
...
@@ -1983,7 +1980,7 @@ new_pbb_from_pbb (scop_p scop, poly_bb_p pbb, basic_block bb)
vec
<
data_reference_p
>
drs
;
vec
<
data_reference_p
>
drs
;
drs
.
create
(
3
);
drs
.
create
(
3
);
gimple_poly_bb_p
gbb
=
PBB_BLACK_BOX
(
pbb
);
gimple_poly_bb_p
gbb
=
PBB_BLACK_BOX
(
pbb
);
gimple_poly_bb_p
gbb1
=
new_gimple_bb
(
bb
,
drs
);
gimple_poly_bb_p
gbb1
=
new_gimple_
poly_
bb
(
bb
,
drs
);
poly_bb_p
pbb1
=
new_poly_bb
(
scop
,
gbb1
);
poly_bb_p
pbb1
=
new_poly_bb
(
scop
,
gbb1
);
int
index
,
n
=
SCOP_BBS
(
scop
).
length
();
int
index
,
n
=
SCOP_BBS
(
scop
).
length
();
...
@@ -2473,43 +2470,6 @@ nb_pbbs_in_loops (scop_p scop)
...
@@ -2473,43 +2470,6 @@ nb_pbbs_in_loops (scop_p scop)
return
res
;
return
res
;
}
}
/* Can all ivs be represented by a signed integer?
As ISL might generate negative values in its expressions, signed loop ivs
are required in the backend. */
static
bool
scop_ivs_can_be_represented
(
scop_p
scop
)
{
loop_p
loop
;
gphi_iterator
psi
;
bool
result
=
true
;
FOR_EACH_LOOP
(
loop
,
0
)
{
if
(
!
loop_in_sese_p
(
loop
,
SCOP_REGION
(
scop
)))
continue
;
for
(
psi
=
gsi_start_phis
(
loop
->
header
);
!
gsi_end_p
(
psi
);
gsi_next
(
&
psi
))
{
gphi
*
phi
=
psi
.
phi
();
tree
res
=
PHI_RESULT
(
phi
);
tree
type
=
TREE_TYPE
(
res
);
if
(
TYPE_UNSIGNED
(
type
)
&&
TYPE_PRECISION
(
type
)
>=
TYPE_PRECISION
(
long_long_integer_type_node
))
{
result
=
false
;
break
;
}
}
if
(
!
result
)
break
;
}
return
result
;
}
/* Builds the polyhedral representation for a SESE region. */
/* Builds the polyhedral representation for a SESE region. */
void
void
...
@@ -2525,9 +2485,6 @@ build_poly_scop (scop_p scop)
...
@@ -2525,9 +2485,6 @@ build_poly_scop (scop_p scop)
if
(
nb_pbbs_in_loops
(
scop
)
==
0
)
if
(
nb_pbbs_in_loops
(
scop
)
==
0
)
return
;
return
;
if
(
!
scop_ivs_can_be_represented
(
scop
))
return
;
build_sese_loop_nests
(
region
);
build_sese_loop_nests
(
region
);
/* Record all conditions in REGION. */
/* Record all conditions in REGION. */
sese_dom_walker
(
CDI_DOMINATORS
,
region
).
walk
(
cfun
->
cfg
->
x_entry_block_ptr
);
sese_dom_walker
(
CDI_DOMINATORS
,
region
).
walk
(
cfun
->
cfg
->
x_entry_block_ptr
);
...
...
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