Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor]: re-structure the test flow of ir optimizer #23

Merged
merged 7 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/rustyc-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Basic Test For RustyC crates"
on: ["pull_request"]

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo fmt --check --verbose
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo test
working-directory: "compilers/rustyc/optimizer"
13 changes: 13 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

10 changes: 0 additions & 10 deletions assets/c/ir_convert/basic_type_expr.c

This file was deleted.

29 changes: 0 additions & 29 deletions assets/c/ir_convert/complex_struct_expr.c

This file was deleted.

13 changes: 0 additions & 13 deletions assets/c/ir_convert/fun-call/call_by_function_pointer.c

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions assets/c/ir_convert/fun-call/struct_type_return_with_pointer.c

This file was deleted.

2 changes: 0 additions & 2 deletions compilers/rustyc/frontend/src/parser/declar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ impl<'a> Parser<'a> {
}
}
_ => {
println!("{:?}, {:?}", value_type, self.get_token());
expect_token!(TokenKind::Semi, self);
ParserResult::Ok(Declaration::ValueType(value_type))
}
Expand Down Expand Up @@ -449,7 +448,6 @@ impl<'a> Parser<'a> {
fn parse_strute_declarator(&mut self) -> ParserResult<StructDeclarator<'a>> {
let mut value_type = self.parse_value_type(None)?;
value_type = self.parse_type_with_pointer_type(value_type);
println!("{:?}", value_type);
let id = match &value_type {
ValueType::FunctionPointer { id, .. } => id.clone(),
_ => self.parse_identifier()?,
Expand Down
6 changes: 1 addition & 5 deletions compilers/rustyc/frontend/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,10 @@ impl<'a> Parser<'a> {
value_type: self.cache_type_name.take(),
designators: self.parse_designator_list()?,
}));
println!("s:{:?}, next_token {:?}", s, self.get_token());
s
}
}
_ => {
println!("{:?}", self.get_token());
ParserResult::Err(String::from("there"))
}
_ => ParserResult::Err(String::from("there")),
}
}
pub(super) fn parse_designator_list(&mut self) -> ParserResult<Vec<Designator<'a>>> {
Expand Down
8 changes: 8 additions & 0 deletions compilers/rustyc/optimizer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
colored = "2.1.0"
rustyc-frontend = {version = "*", path = "../frontend"}
serde = { version ="1.0.193", features = ["derive"] }
serde_json = "1.0.108"

[[test]]
name="rustyc-converter-test-runner"
path='tests/rustyc_converter_test_runner/main.rs'
harness= false
18 changes: 18 additions & 0 deletions compilers/rustyc/optimizer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# RustyC IR

This crate contain IR definition of RustyC, IR Converter and Optimizer.


### IR Structure



### Test Runner Structure

Since we need traversal all folder for reading C code of test case, i create a custom test runner that
can traverse folder and test all test structure according to folder structure.

In the other hand, because some of test case need using function to create IR for optimizer, IR optimizer
test runner still using rust build-in test runner.


145 changes: 0 additions & 145 deletions compilers/rustyc/optimizer/file.table

This file was deleted.

Loading
Loading