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
1306a415
Commit
1306a415
authored
Oct 31, 2022
by
李晓奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update report
parent
698a4326
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
138 additions
and
125 deletions
+138
-125
README.md
README.md
+3
-19
Reports/.gitignore
Reports/.gitignore
+1
-0
Reports/3-ir-gen/report.md
Reports/3-ir-gen/report.md
+134
-98
src/cminusfc/cminusf_builder.cpp
src/cminusfc/cminusf_builder.cpp
+0
-8
No files found.
README.md
View file @
1306a415
# 重现问题
> 这个在运行py脚本或者gdb运行时不会出现。
>
> 只有单独使用`cminusfc`生成可执行文件会出错。
-
构建
`cminusfc`
-
```
$ # at path `2022fall-compiler_cminus`
$ cd tests/3-ir-gen/testcases/lv3/
$ cminusfc complex4.cminus
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::erase: __pos (which is 18446744073709551615) > this->size() (which is 8)
[1] 22357 IOT instruction (core dumped) cminusfc complex4.cminus
```
# 实验说明
# 实验说明
请 fork 此 repo 到自己的仓库下,随后在自己的仓库中完成实验,请确保自己的 repo 为 Private。
## 目前已布置的实验
## 目前已布置的实验
*
[
lab1
](
./Documentations/1-parser/
)
*
[
lab1
](
./Documentations/1-parser/
)
+
DDL:2022-10-03 23:59:59 (UTC+8)
+
DDL:2022-10-03 23:59:59 (UTC+8)
-
[
report
](
./report/1-parser/
)
*
[
lab2
](
./Documentations/2-ir-gen-warmup/
)
*
[
lab2
](
./Documentations/2-ir-gen-warmup/
)
+
DDL:2022-10-23 23:59:59 (UTC+8)
+
DDL:2022-10-23 23:59:59 (UTC+8)
-
[
report
](
./report/2-ir-gen-warmup/report.md
)
*
[
lab3
](
./Documentations/3-ir-gen/
)
*
[
lab3
](
./Documentations/3-ir-gen/
)
+
DDL:2022-11-07 23:59:59 (UTC+8)
+
DDL:2022-11-07 23:59:59 (UTC+8)
-
[
report
](
./report/3-ir-gen/report.md
)
## FAQ: How to merge upstream remote branches
## FAQ: How to merge upstream remote branches
...
...
Reports/.gitignore
View file @
1306a415
1-parser/*.pdf
1-parser/*.pdf
2-ir-gen-warmup/*.pdf
2-ir-gen-warmup/*.pdf
3-ir-gen/*.pdf
Reports/3-ir-gen/report.md
View file @
1306a415
This diff is collapsed.
Click to expand it.
src/cminusfc/cminusf_builder.cpp
View file @
1306a415
...
@@ -313,9 +313,6 @@ void CminusfBuilder::visit(ASTCompoundStmt &node) {
...
@@ -313,9 +313,6 @@ void CminusfBuilder::visit(ASTCompoundStmt &node) {
// You may need to add some code here
// You may need to add some code here
// to deal with complex statements.
// to deal with complex statements.
/* auto bb = BasicBlock::create(builder->get_module(), "", cur_fun);
* builder->create_br(bb);
* builder->set_insert_point(bb); */
scope
.
enter
();
scope
.
enter
();
for
(
auto
&
decl
:
node
.
local_declarations
)
{
for
(
auto
&
decl
:
node
.
local_declarations
)
{
...
@@ -714,11 +711,6 @@ void CminusfBuilder::visit(ASTCall &node) {
...
@@ -714,11 +711,6 @@ void CminusfBuilder::visit(ASTCall &node) {
else
else
error_exit
(
"BUG HERE: function param needs weird pointer type"
);
error_exit
(
"BUG HERE: function param needs weird pointer type"
);
/* if (not Type::is_eq_type(param_type->get_pointer_element_type(),
* cur_value->get_type()->get_pointer_element_type()->get_array_element_type()))
* error_exit("expected right pointer type");
* // int[] to int* or float[] to flot*
* cur_value = builder->create_gep(cur_value, {CONST_INT(0), CONST_INT(0)}); */
}
else
if
(
param_type
->
is_integer_type
()
or
param_type
->
is_float_type
())
{
}
else
if
(
param_type
->
is_integer_type
()
or
param_type
->
is_float_type
())
{
// need type cast between int and float
// need type cast between int and float
if
(
not
cur_value
->
get_type
()
->
is_integer_type
()
and
not
cur_value
->
get_type
()
->
is_float_type
())
if
(
not
cur_value
->
get_type
()
->
is_integer_type
()
and
not
cur_value
->
get_type
()
->
is_float_type
())
...
...
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