[all-commits] [llvm/llvm-project] 158401: [RISCV] Check that the stack adjust immediate for ...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Mar 26 13:31:43 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 158401493a42014947ef2fb64ca761b57741815a
      https://github.com/llvm/llvm-project/commit/158401493a42014947ef2fb64ca761b57741815a
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-03-26 (Tue, 26 Mar 2024)

  Changed paths:
    M llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
    M llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h
    M llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
    M llvm/test/MC/RISCV/rv32zcmp-invalid.s
    M llvm/test/MC/RISCV/rv64zcmp-invalid.s

  Log Message:
  -----------
  [RISCV] Check that the stack adjust immediate for cm.push/pop* has the correct sign and is divisible by 16. (#85295)

To do this I've added a new AsmOperand for cm.push to expect a negative
value. We also use that to customize the print function so that we don't
need to detect cm.push opcode to add the negative sign.

I've renamed some places that used Spimm to be StackAdj since that's
what is being parsed. I'm still not about where we should use Spimm or
StackAdj.

I've removed the printSpimm helper function which in one usage printed
the sp[5:4]<<4 value and the other usage printed the full stack
adjustment. There wasn't anything interesting about how it was printed
it just passed the value to the raw_stream. If there was something
special needed, it's unclear whether it would be the same for the two
different usages so I inlined it.

One open question is whether we need to support stack adjustments
expressed as an expression rather than a literal integer.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list