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
c736471e
Commit
c736471e
authored
Jan 23, 2023
by
甘文迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cminusfc.cpp
parent
258a7391
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
src/cminusfc/cminusfc.cpp
src/cminusfc/cminusfc.cpp
+15
-13
No files found.
src/cminusfc/cminusfc.cpp
View file @
c736471e
#include "ActiveVars.hpp"
#include "ConstPropagation.hpp"
#include "DeadCode.h"
#include "Dominators.h"
#include "GVN.h"
#include "LoopInvHoist.hpp"
#include "LoopSearch.hpp"
#include "Mem2Reg.hpp"
#include "PassManager.hpp"
#include "cminusf_builder.hpp"
...
...
@@ -18,8 +14,9 @@
using
namespace
std
::
literals
::
string_literals
;
void
print_help
(
std
::
string
exe_name
)
{
std
::
cout
<<
"Usage: "
<<
exe_name
<<
" [ -h | --help ] [ -o <target-file> ] [ -emit-llvm ] [-mem2reg] [-gvn] [-dump-json] <input-file>"
std
::
cout
<<
"Usage: "
<<
exe_name
<<
" [ -h | --help ] [ -o <target-file> ] [ -emit-llvm ] [ -S ] [-mem2reg] [-gvn] [-dump-json] <input-file>"
<<
std
::
endl
;
}
...
...
@@ -31,6 +28,7 @@ int main(int argc, char **argv) {
bool
gvn
=
false
;
bool
dump_json
=
false
;
bool
emit
=
false
;
bool
assembly
=
false
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
argv
[
i
]
==
"-h"
s
||
argv
[
i
]
==
"--help"
s
)
{
...
...
@@ -48,6 +46,8 @@ int main(int argc, char **argv) {
emit
=
true
;
}
else
if
(
argv
[
i
]
==
"-mem2reg"
s
)
{
mem2reg
=
true
;
}
else
if
(
argv
[
i
]
==
"-S"
s
)
{
assembly
=
true
;
}
else
if
(
argv
[
i
]
==
"-gvn"
s
)
{
gvn
=
true
;
}
else
if
(
argv
[
i
]
==
"-dump-json"
s
)
{
...
...
@@ -105,12 +105,14 @@ int main(int argc, char **argv) {
auto
IR
=
m
->
print
();
if
(
assembly
)
{
CodeGen
codegen
(
m
.
get
());
codegen
.
run
();
std
::
ofstream
target_file
(
target_path
+
".s"
);
target_file
<<
codegen
.
print
();
target_file
.
close
();
return
0
;
}
std
::
ofstream
output_stream
;
auto
output_file
=
target_path
+
".ll"
;
...
...
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