Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
2
2022fall-Compiler_CMinus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李晓奇
2022fall-Compiler_CMinus
Commits
29b9788b
Commit
29b9788b
authored
Mar 02, 2023
by
lxq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start loop analysis
parent
56317aae
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
13 deletions
+5
-13
src/codegen/liverange.cpp
src/codegen/liverange.cpp
+0
-7
src/optimization/CMakeLists.txt
src/optimization/CMakeLists.txt
+2
-2
src/optimization/ExceptCallMerge.cpp
src/optimization/ExceptCallMerge.cpp
+1
-2
src/optimization/LoopUnroll.cpp
src/optimization/LoopUnroll.cpp
+2
-2
No files found.
src/codegen/liverange.cpp
View file @
29b9788b
...
@@ -27,11 +27,8 @@ LiveRangeAnalyzer::joinFor(BasicBlock *bb) {
...
@@ -27,11 +27,8 @@ LiveRangeAnalyzer::joinFor(BasicBlock *bb) {
for
(
auto
succ
:
bb
->
get_succ_basic_blocks
())
{
for
(
auto
succ
:
bb
->
get_succ_basic_blocks
())
{
auto
&
irs
=
succ
->
get_instructions
();
auto
&
irs
=
succ
->
get_instructions
();
auto
it
=
irs
.
begin
();
auto
it
=
irs
.
begin
();
cout
<<
succ
->
get_name
()
<<
endl
;
while
(
it
!=
irs
.
end
()
and
it
->
is_phi
())
while
(
it
!=
irs
.
end
()
and
it
->
is_phi
())
++
it
;
++
it
;
/* if (it == irs.end())
* cout << succ->print() << endl; */
assert
(
it
!=
irs
.
end
()
&&
"need to find first_ir from copy-stmt"
);
assert
(
it
!=
irs
.
end
()
&&
"need to find first_ir from copy-stmt"
);
union_ip
(
out
,
IN
[
instr_id
.
at
(
&
(
*
it
))]);
union_ip
(
out
,
IN
[
instr_id
.
at
(
&
(
*
it
))]);
// cout << "# " + it->print() << endl;
// cout << "# " + it->print() << endl;
...
@@ -85,10 +82,6 @@ LiveRangeAnalyzer::get_dfs_order(Function *func) {
...
@@ -85,10 +82,6 @@ LiveRangeAnalyzer::get_dfs_order(Function *func) {
for
(
auto
succ
:
bb
->
get_succ_basic_blocks
())
for
(
auto
succ
:
bb
->
get_succ_basic_blocks
())
Q
.
push_front
(
succ
);
Q
.
push_front
(
succ
);
}
}
cout
<<
func
->
get_name
()
<<
"'s dfs order:
\n\t
"
;
for
(
auto
bb
:
BB_DFS_Order
)
cout
<<
bb
->
get_name
()
<<
" "
;
cout
<<
endl
;
}
}
void
void
...
...
src/optimization/CMakeLists.txt
View file @
29b9788b
add_library
(
add_library
(
OP_lib STATIC
OP_lib STATIC
LoopUnroll.cpp
ExceptCallMerge.cpp
Dominators.cpp
Dominators.cpp
Mem2Reg.cpp
Mem2Reg.cpp
GVN.cpp
GVN.cpp
LoopUnroll.cpp
ExceptCallMerge.cpp
)
)
src/optimization/ExceptCallMerge.cpp
View file @
29b9788b
...
@@ -51,11 +51,10 @@ NegCallMerge::run(Function *func) {
...
@@ -51,11 +51,10 @@ NegCallMerge::run(Function *func) {
}
}
}
}
// remove useless BasicBlocks
// remove useless BasicBlocks
cout
<<
"remove blocks for function "
<<
func
->
get_name
()
<<
endl
;
for
(
auto
_bb
:
calls
)
{
for
(
auto
_bb
:
calls
)
{
auto
bb
=
static_cast
<
BasicBlock
*>
(
_bb
);
auto
bb
=
static_cast
<
BasicBlock
*>
(
_bb
);
if
(
bb
!=
reserved
)
{
if
(
bb
!=
reserved
)
{
cout
<<
"remove block "
<<
bb
->
get_name
()
<<
endl
;
cout
<<
"remove block "
<<
bb
->
get_name
()
<<
" in function "
<<
func
->
get_name
()
<<
endl
;
auto
it
=
blocks
.
begin
();
auto
it
=
blocks
.
begin
();
for
(;
&*
it
!=
bb
;
++
it
)
for
(;
&*
it
!=
bb
;
++
it
)
;
;
...
...
src/optimization/LoopUnroll.cpp
View file @
29b9788b
...
@@ -29,8 +29,8 @@ struct BackEdgeSearcher {
...
@@ -29,8 +29,8 @@ struct BackEdgeSearcher {
type
=
"back-edge"
;
type
=
"back-edge"
;
edges
.
push_back
(
edge
);
edges
.
push_back
(
edge
);
}
}
cout
<<
"find "
<<
type
<<
": "
<<
LoopUnroll
::
str
(
edge
)
/*
cout << "find " << type << ": " << LoopUnroll::str(edge)
<<
"
\n
"
;
* << "\n"; */
}
else
}
else
dfsrun
(
succ
);
dfsrun
(
succ
);
}
}
...
...
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