1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00
llvm-mirror/lib/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] Untangle MCContext and MCObjectFileInfo 2021-05-05 10:03:02 -07:00
MCParser [AsmParser][SystemZ][z/OS] Introducing HLASM Parser support to AsmParser - Part 1 2021-05-19 11:05:30 -04:00
CMakeLists.txt [CSSPGO] Pseudo probe encoding and emission. 2020-12-10 17:29:28 -08:00
ConstantPools.cpp
ELFObjectWriter.cpp Reland "[MC][ELF] Work around R_MIPS_LO16 relocation handling problem" 2021-05-04 18:16:09 +02:00
MachObjectWriter.cpp
MCAsmBackend.cpp Support dwarf fission for wasm object files 2020-09-17 14:42:41 -07:00
MCAsmInfo.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
MCAsmInfoCOFF.cpp
MCAsmInfoDarwin.cpp
MCAsmInfoELF.cpp
MCAsmInfoWasm.cpp
MCAsmInfoXCOFF.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
MCAsmMacro.cpp [ms] [llvm-ml] Enable support for MASM-style macro procedures 2020-11-04 10:29:57 -05:00
MCAsmStreamer.cpp [XCOFF] handle string constants generation for AIX 2021-05-07 06:43:36 +00:00
MCAssembler.cpp MCDwarf: Delete uneeded parameter 2021-01-21 00:55:07 -08:00
MCCodeEmitter.cpp
MCCodeView.cpp [CodeView] Fix inline sites that are missing code offsets. 2020-12-07 13:01:53 -08:00
MCContext.cpp Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
MCDwarf.cpp [Debug-Info] Add names for the debug line prologue. 2021-03-12 04:45:08 +00:00
MCELFObjectTargetWriter.cpp
MCELFStreamer.cpp [MC] Change ELFOSABI_NONE to ELFOSABI_GNU for SHF_GNU_RETAIN 2021-03-09 09:59:47 -08:00
MCExpr.cpp [AIX][TLS] Add ASM portion changes to support TLSGD relocations to XCOFF objects 2021-04-29 13:18:59 -05:00
MCFragment.cpp [CSSPGO] Pseudo probe encoding and emission. 2020-12-10 17:29:28 -08:00
MCInst.cpp [MC] Add the ability to pass MCRegisterInfo to dump_pretty. 2021-05-14 18:21:57 -07:00
MCInstPrinter.cpp
MCInstrAnalysis.cpp
MCInstrDesc.cpp
MCInstrInfo.cpp
MCLabel.cpp
MCLinkerOptimizationHint.cpp
MCMachObjectTargetWriter.cpp
MCMachOStreamer.cpp [MC] Untangle MCContext and MCObjectFileInfo 2021-05-05 10:03:02 -07:00
MCNullStreamer.cpp [MC] Make MCStreamer aware of AsmParser's StartTokLoc 2020-11-02 12:32:07 -08:00
MCObjectFileInfo.cpp [lld][WebAssembly] Enable string tail merging in debug sections 2021-05-18 12:25:39 -07:00
MCObjectStreamer.cpp [XCOFF][DebugInfo] support DWARF for XCOFF for assembly output. 2021-03-04 21:07:52 -05:00
MCObjectWriter.cpp
MCPseudoProbe.cpp [CSSPGO] Pseudo probe encoding and emission. 2020-12-10 17:29:28 -08:00
MCRegisterInfo.cpp
MCSchedule.cpp [ARM][SchedModels] Convert IsPredicatedPred to MCSchedPredicate 2020-10-19 11:37:54 +03:00
MCSection.cpp [llvm] Use llvm::lower_bound and llvm::upper_bound (NFC) 2021-01-29 23:23:36 -08:00
MCSectionCOFF.cpp
MCSectionELF.cpp [MC][ELF] Support for zero flag section groups 2021-02-16 14:23:40 -08:00
MCSectionMachO.cpp Support #pragma clang section directives on MachO targets 2021-02-25 09:30:10 -08:00
MCSectionWasm.cpp [WebAssembly] Add TLS data segment flag: WASM_SEG_FLAG_TLS 2021-05-12 13:31:02 -07:00
MCSectionXCOFF.cpp [XCOFF][AIX] Add Global Variables Directly to TOC for 32 bit AIX 2021-04-30 14:48:02 +00:00
MCStreamer.cpp [MC] Untangle MCContext and MCObjectFileInfo 2021-05-05 10:03:02 -07:00
MCSubtargetInfo.cpp AMDGPU: Add target id and code object v4 support 2021-03-24 11:54:05 -04:00
MCSymbol.cpp
MCSymbolELF.cpp
MCSymbolXCOFF.cpp [XCOFF][DebugInfo] support DWARF for XCOFF for assembly output. 2021-03-04 21:07:52 -05:00
MCTargetOptions.cpp
MCTargetOptionsCommandFlags.cpp
MCValue.cpp
MCWasmObjectTargetWriter.cpp
MCWasmStreamer.cpp [WebAssembly][MC] Remove useless overrides in MCWasmStreamer 2020-11-17 07:09:49 -08:00
MCWin64EH.cpp Reapply "[CodeGen] [WinException] Only produce handler data at the end of the function if needed" 2020-11-23 23:17:03 +02:00
MCWinCOFFStreamer.cpp [MC] Untangle MCContext and MCObjectFileInfo 2021-05-05 10:03:02 -07:00
MCWinEH.cpp
MCXCOFFObjectTargetWriter.cpp
MCXCOFFStreamer.cpp [MC] Make MCStreamer aware of AsmParser's StartTokLoc 2020-11-02 12:32:07 -08:00
StringTableBuilder.cpp [MC] Adjust StringTableBuilder for linked Mach-O binaries 2020-10-22 19:19:41 -07:00
SubtargetFeature.cpp
WasmObjectWriter.cpp Reland: "[lld][WebAssembly] Initial support merging string data" 2021-05-10 16:03:38 -07:00
WinCOFFObjectWriter.cpp [COFF] Fix ARM and ARM64 REL32 relocations to be relative to the end of the relocation 2021-05-12 09:53:43 +03:00
XCOFFObjectWriter.cpp [AIX][TLS] Add support for TLSGD relocations to XCOFF objects 2021-05-06 09:01:47 -05:00