1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/include/llvm/MC
Anirudh Prasad 5ae5cfdb6b [AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 1
- This patch (is one in a series of patches) which introduces HLASM Parser support (for the first parameter of inline asm statements) to LLVM ([[ https://lists.llvm.org/pipermail/llvm-dev/2021-January/147686.html | main RFC here ]])
- This patch in particular introduces HLASM Parser support for Z machine instructions.
- The approach taken here was to subclass `AsmParser`, and make various functions and variables as "protected" wherever appropriate.
- The `HLASMAsmParser` class overrides the `parseStatement` function. Two new private functions `parseAsHLASMLabel` and `parseAsMachineInstruction` are introduced as well.

The general syntax is laid out as follows (more information available in [[ https://www.ibm.com/support/knowledgecenter/SSENW6_1.6.0/com.ibm.hlasm.v1r6.asm/asmr1023.pdf | HLASM V1R6 Language Reference Manual ]] - Chapter 2 - Instruction Statement Format):

```
<TokA><spaces.*><TokB><spaces.*><TokC><spaces.*><TokD>
```

1. TokA is referred to as the Name Entry. This token is optional
2. TokB is referred to as the Operation Entry. This token is mandatory.
3. TokC is referred to as the Operand Entry. This token is mandatory
4. TokD is referred to as the Remarks Entry. This token is optional

- If TokA is provided, then we either parse TokA as a possible comment or as a label (Name Entry), Tok B as the Operation Entry and so on.
- If TokA is not provided (i.e. we have one or more spaces and then the first token), then we will parse the first token (i.e TokB) as a possible Z machine instruction, TokC as the operands to the Z machine instruction and TokD as a possible Remark field
- TokC (Operand Entry), no spaces are allowed between OperandEntries. If a space occurs it is classified as an error.
- TokD if provided is taken as is, and emitted as a comment.

The following additional approach was examined, but not taken:

- Adding custom private only functions to base AsmParser class, and only invoking them for z/OS. While this would eliminate the need for another child class, these private functions would be of non-use to every other target. Similarly, adding any pure virtual functions to the base MCAsmParser class and overriding them in AsmParser would also have the same disadvantage.

Testing:

- This patch doesn't have tests added with it, for the sole reason that MCStreamer Support and Object File support hasn't been added for the z/OS target (yet). Hence, it's not possible generate code outright for the z/OS target. They are in the process of being committed / process of being worked on.

- Any comments / feedback on how to combat this "lack of testing" due to other missing required features is appreciated.

Reviewed By: Kai, uweigand

Differential Revision: https://reviews.llvm.org/D98276
2021-05-19 11:05:30 -04:00
..
MCDisassembler [MC][AMDGPU][llvm-objdump] Synthesized local labels in disassembly 2021-04-26 13:56:36 +01:00
MCParser [AsmParser][SystemZ][z/OS] Reject character and string literals for HLASM 2021-05-05 10:21:55 -04:00
ConstantPools.h
LaneBitmask.h
MachineLocation.h
MCAsmBackend.h
MCAsmInfo.h [AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 1 2021-05-19 11:05:30 -04:00
MCAsmInfoCOFF.h
MCAsmInfoDarwin.h
MCAsmInfoELF.h
MCAsmInfoWasm.h
MCAsmInfoXCOFF.h
MCAsmLayout.h
MCAsmMacro.h
MCAssembler.h [MC] Support .symver *, *, remove 2021-03-06 15:23:02 -08:00
MCCodeEmitter.h
MCCodeView.h
MCContext.h [lld][WebAssembly] Enable string tail merging in debug sections 2021-05-18 12:25:39 -07:00
MCDirectives.h
MCDwarf.h [XCOFF][DebugInfo] support DWARF for XCOFF for assembly output. 2021-03-04 21:07:52 -05:00
MCELFObjectWriter.h
MCELFStreamer.h [MC] Support .symver *, *, remove 2021-03-06 15:23:02 -08:00
MCExpr.h [AIX][TLS] Add ASM portion changes to support TLSGD relocations to XCOFF objects 2021-04-29 13:18:59 -05:00
MCFixedLenDisassembler.h
MCFixup.h
MCFixupKindInfo.h
MCFragment.h
MCInst.h [MC] Add the ability to pass MCRegisterInfo to dump_pretty. 2021-05-14 18:21:57 -07:00
MCInstBuilder.h
MCInstPrinter.h
MCInstrAnalysis.h
MCInstrDesc.h [MC] MCInstrDesc.h - remove unnecessary <string> include. NFCI. 2021-04-21 15:07:00 +01:00
MCInstrInfo.h
MCInstrItineraries.h
MCLabel.h
MCLinkerOptimizationHint.h
MCMachObjectWriter.h
MCObjectFileInfo.h [MC] Untangle MCContext and MCObjectFileInfo 2021-05-05 10:03:02 -07:00
MCObjectStreamer.h [XCOFF][DebugInfo] support DWARF for XCOFF for assembly output. 2021-03-04 21:07:52 -05:00
MCObjectWriter.h [MC] Change ELFOSABI_NONE to ELFOSABI_GNU for SHF_GNU_RETAIN 2021-03-09 09:59:47 -08:00
MCPseudoProbe.h [CSSPGO][llvm-profgen] Always report dangling probes for frames with real samples. 2021-04-21 18:07:58 -07:00
MCRegister.h
MCRegisterInfo.h Add register size info back to MCRegisterClass 2021-03-23 15:04:44 -07:00
MCSchedule.h [MCA] Add support for in-order CPUs 2021-03-04 14:08:19 +03:00
MCSection.h
MCSectionCOFF.h
MCSectionELF.h
MCSectionMachO.h Support #pragma clang section directives on MachO targets 2021-02-25 09:30:10 -08:00
MCSectionWasm.h Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
MCSectionXCOFF.h [AIX][TLS] Add assert check of valid csect type for the storage mapping class XCOFF::XMC_UL 2021-03-08 14:18:57 -06:00
MCStreamer.h fix comment typos to cycle bots 2021-04-14 22:12:56 -04:00
MCSubtargetInfo.h AMDGPU: Add target id and code object v4 support 2021-03-24 11:54:05 -04:00
MCSymbol.h
MCSymbolCOFF.h
MCSymbolELF.h
MCSymbolMachO.h
MCSymbolWasm.h [WebAssembly][MC] Record limit constraints for table sizes 2021-03-24 09:44:22 +01:00
MCSymbolXCOFF.h
MCTargetOptions.h
MCTargetOptionsCommandFlags.h
MCValue.h
MCWasmObjectWriter.h [WebAssembly] Add new relocation for location relative data 2021-03-08 11:34:10 -08:00
MCWasmStreamer.h
MCWin64EH.h
MCWinCOFFObjectWriter.h
MCWinCOFFStreamer.h
MCWinEH.h
MCXCOFFObjectWriter.h
MCXCOFFStreamer.h
SectionKind.h [AIX][TLS] Generate TLS variables in assembly files 2021-03-02 18:22:48 -06:00
StringTableBuilder.h
SubtargetFeature.h