Skip to content

Tracking issue for refactoring the way we represent function call ABIs #119183

Open
@RalfJung

Description

@RalfJung

This is the issue tracking implementation of rust-lang/compiler-team#672. Note that we do not have a final design yet; the best way to represent call ABI, and to disentangle it from the "storage kind" of a type (which is what the Abi type currently largely represents) is yet to be determined.

Note that for the purposes of this, by "call ABI" I mean "the target-independent information that is necessary and sufficient to compute how arguments and returns values are passed between caller and callee". The perfect end state (that we may or may not ever reach) for this would be to say that two types are ABI compatible if and only if the computed call ABI information for them is the same -- that would be very nice for the spec and for MiniRust, anyway.

I do not mean "the target-specific information saying which arguments are passed in which register / on the stack, which are copied and which are passed indirectly". This already exists to some extend as a concept in rustc, called PassMode. It may need some reforming, but that would be a separate discussion.

  • The core need is that a Rust type must have its ABI computed in a manner that is not reimplemented for every target and every codegen backend. e.g. the traversal over types should skip repr(transparent) in essentially every case. Then every target architecture must be ported to it:
    • aarch64
    • arm
    • csky
    • loongarch
    • loongarch64
    • mips
    • mips64
    • powerpc
    • powerpc64
    • riscv32
    • riscv64
    • sparc
    • sparc64
    • x86
    • x86_64
  • layout.abi is not about actual ABI, but only about IR codegen: handling the types as SSA values versus handling them as memory locations.

See in particular this comment.

Implementation history

Metadata

Metadata

Labels

A-ABIArea: Concerning the application binary interface (ABI)C-cleanupCategory: PRs that clean code up or issues documenting cleanup.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions