Skip to content

Commit

Permalink
Merge pull request #977 from veryl-lang/enable_lto
Browse files Browse the repository at this point in the history
Add workaround for long compile time and enable LTO
  • Loading branch information
dalance authored Sep 29, 2024
2 parents f374b7e + 975eefd commit e2a5862
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,5 @@ opt-level = 3
[profile.release.build-override]
opt-level = 3

[profile.release]
# Workaround for long time compilation
# https://github.com/rust-lang/rust/issues/129776
codegen-units = 1

[profile.bench]
debug = true
13 changes: 13 additions & 0 deletions crates/emitter/src/aligner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression'
// Add `#[inline(never)]` to `expression*` as a workaround for long time compilation
// https://github.com/rust-lang/rust/issues/106211
#[inline(never)]
fn expression(&mut self, arg: &Expression) {
self.expression01(&arg.expression01);
for x in &arg.expression_list {
Expand All @@ -372,6 +375,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression01'
#[inline(never)]
fn expression01(&mut self, arg: &Expression01) {
self.expression02(&arg.expression02);
for x in &arg.expression01_list {
Expand All @@ -383,6 +387,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression02'
#[inline(never)]
fn expression02(&mut self, arg: &Expression02) {
self.expression03(&arg.expression03);
for x in &arg.expression02_list {
Expand All @@ -394,6 +399,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression03'
#[inline(never)]
fn expression03(&mut self, arg: &Expression03) {
self.expression04(&arg.expression04);
for x in &arg.expression03_list {
Expand All @@ -405,6 +411,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression04'
#[inline(never)]
fn expression04(&mut self, arg: &Expression04) {
self.expression05(&arg.expression05);
for x in &arg.expression04_list {
Expand All @@ -416,6 +423,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression05'
#[inline(never)]
fn expression05(&mut self, arg: &Expression05) {
self.expression06(&arg.expression06);
for x in &arg.expression05_list {
Expand All @@ -427,6 +435,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression06'
#[inline(never)]
fn expression06(&mut self, arg: &Expression06) {
self.expression07(&arg.expression07);
for x in &arg.expression06_list {
Expand All @@ -438,6 +447,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression07'
#[inline(never)]
fn expression07(&mut self, arg: &Expression07) {
self.expression08(&arg.expression08);
for x in &arg.expression07_list {
Expand All @@ -449,6 +459,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression08'
#[inline(never)]
fn expression08(&mut self, arg: &Expression08) {
self.expression09(&arg.expression09);
for x in &arg.expression08_list {
Expand All @@ -460,6 +471,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression09'
#[inline(never)]
fn expression09(&mut self, arg: &Expression09) {
self.expression10(&arg.expression10);
for x in &arg.expression09_list {
Expand All @@ -474,6 +486,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression10'
#[inline(never)]
fn expression10(&mut self, arg: &Expression10) {
self.expression11(&arg.expression11);
for x in &arg.expression10_list {
Expand Down
14 changes: 14 additions & 0 deletions crates/formatter/src/aligner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression'
// Add `#[inline(never)]` to `expression*` as a workaround for long time compilation
// https://github.com/rust-lang/rust/issues/106211
#[inline(never)]
fn expression(&mut self, arg: &Expression) {
self.expression01(&arg.expression01);
for x in &arg.expression_list {
Expand All @@ -183,6 +186,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression01'
#[inline(never)]
fn expression01(&mut self, arg: &Expression01) {
self.expression02(&arg.expression02);
for x in &arg.expression01_list {
Expand All @@ -194,6 +198,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression02'
#[inline(never)]
fn expression02(&mut self, arg: &Expression02) {
self.expression03(&arg.expression03);
for x in &arg.expression02_list {
Expand All @@ -205,6 +210,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression03'
#[inline(never)]
fn expression03(&mut self, arg: &Expression03) {
self.expression04(&arg.expression04);
for x in &arg.expression03_list {
Expand All @@ -216,6 +222,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression04'
#[inline(never)]
fn expression04(&mut self, arg: &Expression04) {
self.expression05(&arg.expression05);
for x in &arg.expression04_list {
Expand All @@ -227,6 +234,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression05'
#[inline(never)]
fn expression05(&mut self, arg: &Expression05) {
self.expression06(&arg.expression06);
for x in &arg.expression05_list {
Expand All @@ -238,6 +246,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression06'
#[inline(never)]
fn expression06(&mut self, arg: &Expression06) {
self.expression07(&arg.expression07);
for x in &arg.expression06_list {
Expand All @@ -249,6 +258,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression07'
#[inline(never)]
fn expression07(&mut self, arg: &Expression07) {
self.expression08(&arg.expression08);
for x in &arg.expression07_list {
Expand All @@ -260,6 +270,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression08'
#[inline(never)]
fn expression08(&mut self, arg: &Expression08) {
self.expression09(&arg.expression09);
for x in &arg.expression08_list {
Expand All @@ -271,6 +282,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression09'
#[inline(never)]
fn expression09(&mut self, arg: &Expression09) {
self.expression10(&arg.expression10);
for x in &arg.expression09_list {
Expand All @@ -285,6 +297,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression10'
#[inline(never)]
fn expression10(&mut self, arg: &Expression10) {
self.expression11(&arg.expression11);
for x in &arg.expression10_list {
Expand All @@ -296,6 +309,7 @@ impl VerylWalker for Aligner {
}

/// Semantic action for non-terminal 'Expression11'
#[inline(never)]
fn expression11(&mut self, arg: &Expression11) {
self.expression12(&arg.expression12);
if let Some(x) = &arg.expression11_opt {
Expand Down
15 changes: 15 additions & 0 deletions crates/formatter/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression'
// Add `#[inline(never)]` to `expression*` as a workaround for long time compilation
// https://github.com/rust-lang/rust/issues/106211
#[inline(never)]
fn expression(&mut self, arg: &Expression) {
self.expression01(&arg.expression01);
for x in &arg.expression_list {
Expand All @@ -218,6 +221,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression01'
#[inline(never)]
fn expression01(&mut self, arg: &Expression01) {
self.expression02(&arg.expression02);
for x in &arg.expression01_list {
Expand All @@ -229,6 +233,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression02'
#[inline(never)]
fn expression02(&mut self, arg: &Expression02) {
self.expression03(&arg.expression03);
for x in &arg.expression02_list {
Expand All @@ -240,6 +245,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression03'
#[inline(never)]
fn expression03(&mut self, arg: &Expression03) {
self.expression04(&arg.expression04);
for x in &arg.expression03_list {
Expand All @@ -251,6 +257,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression04'
#[inline(never)]
fn expression04(&mut self, arg: &Expression04) {
self.expression05(&arg.expression05);
for x in &arg.expression04_list {
Expand All @@ -262,6 +269,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression05'
#[inline(never)]
fn expression05(&mut self, arg: &Expression05) {
self.expression06(&arg.expression06);
for x in &arg.expression05_list {
Expand All @@ -273,6 +281,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression06'
#[inline(never)]
fn expression06(&mut self, arg: &Expression06) {
self.expression07(&arg.expression07);
for x in &arg.expression06_list {
Expand All @@ -284,6 +293,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression07'
#[inline(never)]
fn expression07(&mut self, arg: &Expression07) {
self.expression08(&arg.expression08);
for x in &arg.expression07_list {
Expand All @@ -295,6 +305,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression08'
#[inline(never)]
fn expression08(&mut self, arg: &Expression08) {
self.expression09(&arg.expression09);
for x in &arg.expression08_list {
Expand All @@ -306,6 +317,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression09'
#[inline(never)]
fn expression09(&mut self, arg: &Expression09) {
self.expression10(&arg.expression10);
for x in &arg.expression09_list {
Expand All @@ -320,6 +332,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression10'
#[inline(never)]
fn expression10(&mut self, arg: &Expression10) {
self.expression11(&arg.expression11);
for x in &arg.expression10_list {
Expand All @@ -331,6 +344,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'Expression11'
#[inline(never)]
fn expression11(&mut self, arg: &Expression11) {
self.expression12(&arg.expression12);
if let Some(x) = &arg.expression11_opt {
Expand All @@ -342,6 +356,7 @@ impl VerylWalker for Formatter {
}

/// Semantic action for non-terminal 'ArgumentList'
#[inline(never)]
fn argument_list(&mut self, arg: &ArgumentList) {
self.argument_item(&arg.argument_item);
for x in &arg.argument_list_list {
Expand Down

0 comments on commit e2a5862

Please sign in to comment.