Skip to content

LLVM-reserved registers can't be used in inline assembly #85056

Open

Description

On several architectures, some registers are considered reserved by LLVM. These registers effectively can't be used by LLVM's inline assembly instruction as in input/output/clobber.

rustc currently disallows using these registers in asm!. This seems to be in contradiction with a stated goal in the RFC:

The intent is that support for asm! should be independent of the rustc back-end used

As such, I'd expect there to be no backend-specific limitations on inline assembly.

Current LLVM-reserved registers are:

  • x86: esi
  • x86-64: rbx
  • ARM: r7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-inline-assemblyArea: Inline assembly (`asm!(…)`)F-asm`#![feature(asm)]` (not `llvm_asm`)T-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