mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
14e90c0414
The current table-generated assembly instruction matcher returns a 64-bit error code when matching fails. Since multiple instruction encodings with the same mnemonic can fail for different reasons, it uses some heuristics to decide which message is important. This heuristic does not work well for targets that have many encodings with the same mnemonic but different operands, or which have different versions of instructions controlled by subtarget features, as it is hard to know which encoding the user was intending to use. Instead of trying to improve the heuristic in the table-generated matcher, this patch changes it to report a list of near-miss encodings. This list contains an entry for each encoding with the correct mnemonic, but with exactly one thing preventing it from being valid. This thing could be a single invalid operand, a missing target feature or a failed target-specific validation function. The target-specific assembly parser can then report an error message giving multiple options for instruction variants that the user may have been trying to use. For example, I am working on a patch to use this for ARM, which can give this error for an invalid instruction for ARMv6-M: <stdin>:8:3: error: invalid instruction, multiple near-miss encodings found adds r0, r1, #0x8 ^ <stdin>:8:3: note: for one encoding: instruction requires: thumb2 adds r0, r1, #0x8 ^ <stdin>:8:16: note: for one encoding: expected an integer in range [0, 7] adds r0, r1, #0x8 ^ <stdin>:8:16: note: for one encoding: expected a register in range [r0, r7] adds r0, r1, #0x8 ^ This also allows the target-specific assembly parser to apply its own heuristics to suppress some errors. For example, the error "instruction requires: arm-mode" is never going to be useful when targeting an M-profile architecture (which does not have ARM mode). This patch just adds the target-independent mechanism for doing this, all targets still use the old mechanism. I've added a bit in the AsmParser tablegen class to allow targets to switch to this new mechanism. To use this, the target-specific assembly parser will have to be modified for the change in signature of MatchInstructionImpl, and to report errors based on the list of near-misses. Differential revision: https://reviews.llvm.org/D27620 llvm-svn: 314774 |
||
---|---|---|
.. | ||
MCDisassembler | ||
MCParser | ||
ConstantPools.h | ||
LaneBitmask.h | ||
MachineLocation.h | ||
MCAsmBackend.h | ||
MCAsmInfo.h | ||
MCAsmInfoCOFF.h | ||
MCAsmInfoDarwin.h | ||
MCAsmInfoELF.h | ||
MCAsmInfoWasm.h | ||
MCAsmLayout.h | ||
MCAssembler.h | ||
MCCodeEmitter.h | ||
MCCodeView.h | ||
MCContext.h | ||
MCDirectives.h | ||
MCDwarf.h | ||
MCELFObjectWriter.h | ||
MCELFStreamer.h | ||
MCExpr.h | ||
MCFixedLenDisassembler.h | ||
MCFixup.h | ||
MCFixupKindInfo.h | ||
MCFragment.h | ||
MCInst.h | ||
MCInstBuilder.h | ||
MCInstPrinter.h | ||
MCInstrAnalysis.h | ||
MCInstrDesc.h | ||
MCInstrInfo.h | ||
MCInstrItineraries.h | ||
MCLabel.h | ||
MCLinkerOptimizationHint.h | ||
MCMachObjectWriter.h | ||
MCObjectFileInfo.h | ||
MCObjectStreamer.h | ||
MCObjectWriter.h | ||
MCRegisterInfo.h | ||
MCSchedule.h | ||
MCSection.h | ||
MCSectionCOFF.h | ||
MCSectionELF.h | ||
MCSectionMachO.h | ||
MCSectionWasm.h | ||
MCStreamer.h | ||
MCSubtargetInfo.h | ||
MCSymbol.h | ||
MCSymbolCOFF.h | ||
MCSymbolELF.h | ||
MCSymbolMachO.h | ||
MCSymbolWasm.h | ||
MCTargetOptions.h | ||
MCTargetOptionsCommandFlags.h | ||
MCValue.h | ||
MCWasmObjectWriter.h | ||
MCWasmStreamer.h | ||
MCWin64EH.h | ||
MCWinCOFFObjectWriter.h | ||
MCWinCOFFStreamer.h | ||
MCWinEH.h | ||
SectionKind.h | ||
StringTableBuilder.h | ||
SubtargetFeature.h |