-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
pref: cleanup Backend
and CompilerType
functions, make minor performance adjustments
#21389
Conversation
@@ -846,13 +846,12 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin | |||
b := backend_from_string(sbackend) or { | |||
eprintln_exit('Unknown V backend: ${sbackend}\nValid -backend choices are: c, go, interpret, js, js_node, js_browser, js_freestanding, native, wasm') | |||
} | |||
if b.is_js() { | |||
res.output_cross_c = true | |||
} | |||
if b == .wasm { |
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.
Need a b.is_wasm()
to align with the other backends.
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.
Good point.
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.
Okay checking, it's correct as it is. For the backends there only is .wasm
. For the oses there is:
.wasm32,
.wasm32_emscripten,
.wasm32_wasi,
// Native wasm options:
.wasi,
.browser,
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.
There are several js output variations as well...
Note that `js` defaults to the `node` codegen backend but it's also possible to
pick another:
* `js_browser` - V outputs JS source code ready for the browser.
* `js_node` - V outputs JS source code to run with nodejs.
* `js_freestanding` - V outputs JS source code with no hard runtime dependency.
wasm is definitely set up different from the others, if it differentiates via os
rather than backend
.
Co-authored-by: Delyan Angelov <[email protected]>
The PR does a cleanup and makes minor adjustments. E.g., sorting match arms for more relevant matches first, adding a
gcc
arm instead of using it only in the fallback.