[PATCH] D100987: [AsmParser][SystemZ][z/OS] Implement location counter syntax ("*") for Z PC-relative instructions.

Anirudh Prasad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 21 12:05:32 PDT 2021


anirudhp created this revision.
Herald added a subscriber: hiraditya.
anirudhp requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

- This patch attempts to implement the location counter syntax (*) for the HLASM variant for PC-relative instructions.
- In the HLASM variant, for purely constant relocatable values, we expect a * token preceding it, with special support for " *" which is parsed as "<pc-rel-insn 0>"
- For combinations of absolute values and relocatable values, we don't expect the "*" preceding the token.

When you have a " * "  what’s accepted is:

  *<space>.*{.*} -> <pc-rel-insn> 0
  *[+|-][constant-value] -> <pc-rel-insn> [+|-]constant-value

When you don’t have a " * " what’s accepted is:

  brasl  1,func           is allowed (MCSymbolRef type)
  brasl  1,func+4         is allowed (MCBinary type)
  brasl  1,4+func         is allowed (MCBinary type)
  brasl  1,-4+func        is allowed (MCBinary type)
  brasl  1,func-4         is allowed (MCBinary type)
  brasl  1,*func          is not allowed (* cannot be used for non-MCConstantExprs)
  brasl  1,*+func         is not allowed (* cannot be used for non-MCConstantExprs)
  brasl  1,*+func+4       is not allowed (* cannot be used for non-MCConstantExprs)
  brasl  1,*+4+func       is not allowed (* cannot be used for non-MCConstantExprs)
  brasl  1,*-4+8+func     is not allowed (* cannot be used for non-MCConstantExprs)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100987

Files:
  llvm/include/llvm/MC/MCAsmInfo.h
  llvm/lib/MC/MCParser/AsmParser.cpp
  llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp
  llvm/test/MC/AsmParser/directive_rept-diagnostics.s
  llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100987.339339.patch
Type: text/x-patch
Size: 5579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210421/40919a40/attachment.bin>


More information about the llvm-commits mailing list