[all-commits] [llvm/llvm-project] a0eee6: [SystemZ] Allow symbols in immediate asm operands

Ilya Leoshkevich via All-commits all-commits at lists.llvm.org
Fri Jul 21 02:09:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a0eee6c971878b1f2edcc34fb2513e12a04a29ba
      https://github.com/llvm/llvm-project/commit/a0eee6c971878b1f2edcc34fb2513e12a04a29ba
  Author: Ilya Leoshkevich <iii at linux.ibm.com>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:
    M llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCFixups.h
    M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
    M llvm/lib/Target/SystemZ/SystemZOperands.td
    A llvm/test/MC/SystemZ/fixups-bad-z13.s
    M llvm/test/MC/SystemZ/fixups.s
    M llvm/test/MC/SystemZ/insn-bad-z196.s
    M llvm/test/MC/SystemZ/insn-bad.s
    M llvm/test/MC/SystemZ/insn-good-z196.s
    M llvm/test/MC/SystemZ/insn-good.s
    M llvm/test/MC/SystemZ/reloc-absolute.s

  Log Message:
  -----------
  [SystemZ] Allow symbols in immediate asm operands

Currently mentioning any symbols in immediate asm operands is not
supported, for example:

    error: invalid operand for instruction
    lghi %r4,foo_end-foo

The immediate problem is that is*Imm() and print*Operand() functions do
not accept MCExprs, but simply relaxing these checks is not enough:
after symbol addresses are computed, range checks need to run against
resolved values.

Add a number of SystemZ::FixupKind members for each kind of immediate
value and process them in SystemZMCAsmBackend::applyFixup(). Only
perform the range checks, do not change anything.

Adjust the tests: move previously failing cases like the one shown
above out of insn-bad.s.

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D154899




More information about the All-commits mailing list