Skip to content

Conversation

jakobbotsch
Copy link
Member

While trying to implement struct support for Swift reverse pinvokes I ended up having to factor the ABI classification out of lvaInitUserArgs to be able to invoke it multiple times for structs. In the end that led me to do the work to split out the ABI classification into a different classifier for each ABI.

ARM32, LA64 and RV64 still need to be split out.

We still don't actually use this information for anything, but it's asserted that it is correct. We are going to be using it in the backend for Swift reverse pinvokes, and I expect to move more and more things to use it and get completely rid of the ABI classification within lvaInitUserArgs (and in the long run hopefully CallArgs::AddFinalArgsAndDetermineABIInfo).

Another todo: this classification should be where we determine whether something is passed implicit by reference instead of doing that in lvaSetStruct/getArgTypeForStruct.

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 26, 2024
@jakobbotsch jakobbotsch changed the title JIT: Add separate ABI classifiers for x86/win-x64/SysV x64/ARM64 JIT: Add separate ABI classifiers for x86/win-x64/SysV-x64/ARM64 Mar 26, 2024
bool HasRetBuff = false;
};

class X86Classifier
Copy link
Contributor

@SingleAccretion SingleAccretion Mar 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about having target-specific classifiers in target-specific files (targetXYZ.cpp, which we already have but don't really use)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that idea. They'll probably have to stay as being defined in abi.h, but I'll try moving the classification Implementation into those target specific files.

@jakobbotsch
Copy link
Member Author

jakobbotsch commented Mar 26, 2024

cc @dotnet/jit-contrib PTAL @AndyAyersMS

No diffs. Some TP regressions, with some MinOpts outliers in the collections that don't have a lot of MinOpts collections.

@jakobbotsch jakobbotsch requested a review from AndyAyersMS March 26, 2024 18:43
@jakobbotsch jakobbotsch marked this pull request as ready for review March 26, 2024 18:44
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
…net#100276)

While trying to implement struct support for Swift reverse pinvokes I ended up
having to factor the ABI classification out of `lvaInitUserArgs` to be able to
invoke it multiple times for structs. In the end that led me to do the work to
split out the ABI classification into a different classifier for each ABI.

ARM32, LA64 and RV64 still need to be split out.

We still don't actually use this information for anything, but it's asserted
that it is correct. We are going to be using it in the backend for Swift reverse
pinvokes, and I expect to move more and more things to use it and get completely
rid of the ABI classification within `lvaInitUserArgs` (and in the long run
hopefully `CallArgs::AddFinalArgsAndDetermineABIInfo`).

Another todo: this classification should be where we determine whether something
is passed implicit by reference instead of doing that in
`lvaSetStruct`/`getArgTypeForStruct`.
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants