-
Notifications
You must be signed in to change notification settings - Fork 30
Lower Swiftcc by LLVM #371
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
Lower Swiftcc by LLVM #371
Conversation
3dfec77
to
a54d888
Compare
a54d888
to
a4814df
Compare
lib/IRGen/GenBuiltin.cpp
Outdated
call->setAttributes(attrs); | ||
// Remove swiftself and swifterror attribute to match signature generated from | ||
// RuntimeFunctions.def. These two parameters are passed using swifterror and swiftself, | ||
// but the definition of swift_willThrow generated from the def file doesn't has those |
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.
// but the definition of swift_willThrow generated from the def file doesn't has those | |
// but the definition of swift_willThrow generated from the def file doesn't have those |
stdlib/public/runtime/ErrorObject.h
Outdated
// Notes: | ||
// Remove swiftself and swifterror attribute to match signature generated from | ||
// RuntimeFunctions.def. These two parameters are passed using swifterror and swiftself, | ||
// but the definition of swift_willThrow generated from the def file doesn't has those |
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.
// but the definition of swift_willThrow generated from the def file doesn't has those | |
// but the definition of swift_willThrow generated from the def file doesn't have those |
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.
Seems legit, just a minor comment typo
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.
Ready to merge 👍
Revert "Revert "[Build] Make cmark build a build-script product (#371…
This PR is based on swiftwasm/llvm-project#3 and reviews.llvm.org/D76049
Changes
Revert thin-to-thick forwarder things
As @jckarter said, I changed LLVM to add extra swiftself and swifterror arguments while lowering LLVM IR into WebAssembly binary.
After this change, thin-to-thick forwarder is not necessary anymore, so I reverted #186 .
Actually thin-to-thick forwarder has reference counting bug which causes #331 issue. This new strategy resolves the issue also.
Add
swiftcc
attribute to runtime functions called from Swift codeAfter the LLVM change, all functions declared in Swift code always has
swiftself
andswifterror
because they useswiftcc
. But this causes type mismatch while linking because C++ side function declaration didn't haveswiftcc
attribute.For example,
This Swift function is lowered as
(i32, i32, i32) -> i32
function but the C++ side runtime function is lowered as(i32) -> i32
. So I addedswiftcc
attribute to runtime functions linked with Swift using@_silgen_name
.