-
Notifications
You must be signed in to change notification settings - Fork 31
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
Optimization techniques #81
Comments
What is the state of PTC support on mutual recursive calls? |
A function call is flattened if it occurs in a PTC context, regardless of being recursive or not. Examples: func foo() {
if(something)
return other(1, 2, 3); // PTC by value (the result is an rvalue or void)
if(something)
return& other(4, 5, 6); // PTC by reference (the result is forwarded as is)
if(something) {
other(true, false); // PTC by voidification (the result is discarded)
return;
}
other("hello"); // PTC by voidification, too
} |
info: According to profiling results by callgrind, the most hot piece of code seems to be copying |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Optimizer Wish List
Tail and Sibling Call Optimization (abbr. mistakenly TCO)
Note that proper tail calls are a core language feature that cannot be disabled.
Dead Code Elimination (abbr. DCE)
This had been implemented naively but was withdrawn. It can be added back easily. But before that, rather than having individual interfaces for varieties of optimization techniques, I would prefer to have a uniformed interface for
cow_vector<AIR_Node>
, which may be invoked recursively.Constant Folding
Ideally this pass should precede DCE. We may also support constant expressions (such as
1+2*3
) in the future. Arithmetic overflows (such as1<<100
), if not folded, result in exceptions, so we must not fold such expressions.Constant Propagation #137
The text was updated successfully, but these errors were encountered: