This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by anirudhp on Apr 21 2021, 12:05 PM.

Details

Summary
  • 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)

Diff Detail

Event Timeline

anirudhp created this revision.Apr 21 2021, 12:05 PM
anirudhp requested review of this revision.Apr 21 2021, 12:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2021, 12:05 PM
anirudhp retitled this revision from [AsmParser][SystemZ][z/OS] Implement location counter syntax ("*") for Z PC-relative instructions. to [AsmParser][SystemZ][z/OS] Implement HLASM location counter syntax ("*") for Z PC-relative instructions..Apr 22 2021, 8:21 AM
anirudhp updated this revision to Diff 339657.Apr 22 2021, 8:30 AM
  • Rebase on latest master
Kai accepted this revision.Apr 22 2021, 12:06 PM

LGTM.

This revision is now accepted and ready to land.Apr 22 2021, 12:06 PM
anirudhp updated this revision to Diff 339754.Apr 22 2021, 12:18 PM
  • Rebasing on latest.
anirudhp updated this revision to Diff 341543.Apr 29 2021, 9:13 AM
  • Rebase on latest + moving the StarIsPC field in SystemZMCAsmInfo.cpp to below DotIsPC
anirudhp updated this revision to Diff 342446.May 3 2021, 10:27 AM
  • Rebase on latest