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

[RISCV][ISel] Ensure 'in X' Constraints prevent X0 #112563

Merged
merged 3 commits into from
Oct 18, 2024

Commits on Oct 16, 2024

  1. [RISCV] Inline Assembly: RVC constraint and N modifier

    This change implements support for the `cr` and `cf` register
    constraints (which allocate a RVC GPR or RVC FPR respectively), and the
    `N` modifier (which prints the raw encoding of a register rather than the
    name).
    
    The intention behind these additions is to make it easier to use inline
    assembly when assembling raw instructions that are not supported by the
    compiler, for instance when experimenting with new instructions or when
    supporting proprietary extensions outside the toolchain.
    
    These implement part of my proposal in riscv-non-isa/riscv-c-api-doc#92
    
    As part of the implementation, I felt there was not enough coverage of
    inline assembly and the "in X" floating-point extensions, so I have
    added more regression tests around these configurations.
    lenary committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    bbf0b88 View commit details
    Browse the repository at this point in the history
  2. [RISCV][ISel] Ensure 'in X' Constraints prevent X0

    I'm not sure if this fix is required, but I've written the patch anyway.
    We can drop this commit if we don't think it's a bug. This does not
    cause test changes, but we haven't got tests that try to use all 32
    registers in inline assembly.
    
    Broadly, for GPRs, we made the explicit choice that `r` constraints
    would never attempt to use `x0`, because `x0` isn't really usable like
    the other GPRs. I believe the same thing applies to `Zhinx`, `Zfinx` and
    `Zdinx` because they should not be allocating operands to `x0` either,
    so this patch introduces new `NoX0` classes for `GPRF16` and `GPRF32`
    registers, and uses them with inline assembly. There is also a
    `GPRPairNoX0` for the `Zdinx` case on rv32, avoiding use of the `x0`
    pair which has different behaviour to the other GPR pairs.
    lenary committed Oct 16, 2024
    Configuration menu
    Copy the full SHA
    99a232d View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2024

  1. Configuration menu
    Copy the full SHA
    d17364b View commit details
    Browse the repository at this point in the history