Skip to content
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

Cranelift: implement Windows(Fastcall) in VCode #2372

Closed
yurydelendik opened this issue Nov 6, 2020 · 7 comments
Closed

Cranelift: implement Windows(Fastcall) in VCode #2372

yurydelendik opened this issue Nov 6, 2020 · 7 comments

Comments

@yurydelendik
Copy link
Contributor

yurydelendik commented Nov 6, 2020

The issue is a part of #2079 (and possibly #1642 ?). The issue needs to be extended to all new backends (x64 and aarch64). This will require implementing the win64 fastcall ABI (or "mostly AArch64 EABI") support in cranelift/codegen/src/machinst/ to fix e.g. tests/all/traps.rs tests.

@cfallin
Copy link
Member

cfallin commented Nov 6, 2020

AFAIK, aarch64 doesn't have a separate fastcall ABI (at least according to this doc) -- @peterhuene can you confirm?

@yurydelendik
Copy link
Contributor Author

aarch64 doesn't have a separate fastcall ABI

MS docs refer it as "mostly AArch64 EABI". Will we call it CallConv::SystemV or will add different values?

@cfallin
Copy link
Member

cfallin commented Nov 6, 2020

I read through the doc and compared it to the standard AArch64 ABI; it seems that all of the basic details are the same (register roles, stack requirements, etc.). The only differences I spotted were that the AArch64 ABI specifies FPCR (FPU control register) is undefined and must not be modified, while Windows specifies it is callee-save; and that Windows has its own exception unwind, of course. The FPCR difference shouldn't matter as we never modify the register.

So as far as I can tell, we can just use the SystemV ABI for Windows on AArch64, but others please do say something if that's wrong!

@peterhuene
Copy link
Member

peterhuene commented Nov 6, 2020

I believe your assessment of the calling convention is correct: it won't differ from the AArch64 ABI in ways that concern Cranelift.

However, I think we'll need a different CallConv value for Windows "ARM64" to differentiate the unwind information.

While we're there, I would love for us to stop calling it "Windows fastcall" instead of "Windows x64" in Cranelift, but that ship has probably sailed.

@peterhuene
Copy link
Member

I guess we could also just rename WindowsFastcall to simply Windows and use the same value for both x64 and ARM backends for unwind information generation. "Fastcall" just leaves a x86 taste in my mouth.

@yurydelendik
Copy link
Contributor Author

I guess we could also just rename WindowsFastcall to simply Windows

Yeah, I am counting we will do just that.

@yurydelendik yurydelendik changed the title Cranelift: implement WindowsFastcall in VCode Cranelift: implement Windows(Fastcall) in VCode Nov 6, 2020
@alexcrichton
Copy link
Member

I believe fastcall is now implemented, so I think this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants