-
Notifications
You must be signed in to change notification settings - Fork 164
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
Compile pattern match statements into conditional statements #2705
Conversation
256188d
to
3b6de18
Compare
gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (patterns_mergeable): Remove. (struct PatternMerge): Remove. (sort_tuple_patterns): Remove. (simplify_tuple_match): Remove. (CompileExpr::visit): Modify compilation of MatchExpr. * backend/rust-compile-pattern.cc (CompilePatternCaseLabelExpr::visit): Replace with... (CompilePatternCheckExpr::visit): ...this. * backend/rust-compile-pattern.h (class CompilePatternCaseLabelExpr): Replace with... (class CompilePatternCheckExpr): ...this. * backend/rust-compile-type.cc (TyTyResolveCompile::get_implicit_enumeral_node_type): Make enumeral type equivalent to isize. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
3b6de18
to
d7b637f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reallly good! There is an optimization in gimple to turn conditionals into switches I am wondering if this is getting triggered? You should be able to do -fdump-tree-all and take a look on some of the simple examples to see if this is happening. I will finish the review over the course of the day.
We really need this so thanks for doing it!
pub fn main() -> i32 {
0
}
pub fn foo(v: i32) -> i32 {
match (v) {
0 => 2,
1 => 3,
2 => 5,
3 => 7,
4 => 11,
5 => 13,
6 => 17,
7 => 19
}
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM lets go for this i am very excited and happy to see this go in!
No description provided.