[all-commits] [llvm/llvm-project] ca02fa: [AsmParser][SystemZ][z/OS] Implement HLASM locatio...

Anirudh Prasad via All-commits all-commits at lists.llvm.org
Mon May 3 11:58:45 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca02fab7e7b677f77e2c6e3dec172a3bb0a0b1c0
      https://github.com/llvm/llvm-project/commit/ca02fab7e7b677f77e2c6e3dec172a3bb0a0b1c0
  Author: Anirudh Prasad <anirudh_prasad at hotmail.com>
  Date:   2021-05-03 (Mon, 03 May 2021)

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

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

- 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)
```

Reviewed By: Kai

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




More information about the All-commits mailing list