1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 12:43:36 +01:00
llvm-mirror/utils/TableGen
Sameer AbuAsal 9cc166efe6 [RISCV] Tablegen-driven Instruction Compression.
Summary:

    This patch implements a tablegen-driven Instruction Compression
    mechanism for generating RISCV compressed instructions
    (C Extension) from the expanded instruction form.

    This tablegen backend processes CompressPat declarations in a
    td file and generates all the compile-time and runtime checks
    required to validate the declarations, validate the input
    operands and generate correct instructions.

    The checks include validating register operands, immediate
    operands, fixed register operands and fixed immediate operands.

    Example:
      class CompressPat<dag input, dag output> {
        dag Input  = input;
        dag Output    = output;
        list<Predicate> Predicates = [];
      }

      let Predicates = [HasStdExtC] in {
      def : CompressPat<(ADD GPRNoX0:$rs1, GPRNoX0:$rs1, GPRNoX0:$rs2),
                        (C_ADD GPRNoX0:$rs1, GPRNoX0:$rs2)>;
      }

    The result is an auto-generated header file
    'RISCVGenCompressEmitter.inc' which exports two functions for
    compressing/uncompressing MCInst instructions, plus
    some helper functions:

      bool compressInst(MCInst& OutInst, const MCInst &MI,
                        const MCSubtargetInfo &STI,
                        MCContext &Context);

      bool uncompressInst(MCInst& OutInst, const MCInst &MI,
                          const MCRegisterInfo &MRI,
                          const MCSubtargetInfo &STI);

    The clients that include this auto-generated header file and
    invoke these functions can compress an instruction before emitting
    it, in the target-specific ASM or ELF streamer, or can uncompress
    an instruction before printing it, when the expanded instruction
    format aliases is favored.

    The following clients were added to implement compression\uncompression
    for RISCV:

    1) RISCVAsmParser::MatchAndEmitInstruction:
       Inserted a call to compressInst() to compresses instructions
       parsed by llvm-mc coming from an ASM input.
    2) RISCVAsmPrinter::EmitInstruction:
       Inserted a call to compressInst() to compress instructions that
       were lowered from Machine Instructions (MachineInstr).
    3) RVInstPrinter::printInst:
       Inserted a call to uncompressInst() to print the expanded
       version of the instruction instead of the compressed one (e.g,
       add s0, s0, a5 instead of c.add s0, a5) when -riscv-no-aliases
       is not passed.

This patch squashes D45119, D42780 and D41932. It was reviewed in  smaller patches by
asb, efriedma, apazos and mgrang.

Reviewers: asb, efriedma, apazos, llvm-commits, sabuasal

Reviewed By: sabuasal

Subscribers: mgorny, eraman, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, niosHD, kito-cheng, shiva0217, zzheng

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

llvm-svn: 329455
2018-04-06 21:07:05 +00:00
..
AsmMatcherEmitter.cpp Fix signed/unsigned comparison warning in AsmGenMatcher generated code. NFCI. 2018-02-17 12:29:47 +00:00
AsmWriterEmitter.cpp [AArch64][TableGen] Skip tied result operands for InstAlias 2017-11-20 14:36:40 +00:00
AsmWriterInst.cpp
AsmWriterInst.h
Attributes.cpp Remove redundant includes from utils/TableGen. 2017-12-13 21:31:13 +00:00
CallingConvEmitter.cpp [TableGen] Simplify CallingConvEmitter.cpp. NFC. 2017-10-16 14:52:26 +00:00
CMakeLists.txt [RISCV] Tablegen-driven Instruction Compression. 2018-04-06 21:07:05 +00:00
CodeEmitterGen.cpp
CodeGenDAGPatterns.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
CodeGenDAGPatterns.h [TableGen] Print more helpful information in case of type contradiction 2017-12-21 17:12:43 +00:00
CodeGenHwModes.cpp TableGen support for parameterized register class information 2017-09-14 16:56:21 +00:00
CodeGenHwModes.h TableGen support for parameterized register class information 2017-09-14 16:56:21 +00:00
CodeGenInstruction.cpp [globalisel][tablegen] Generalize pointer-type inference by introducing ptypeN. NFC 2017-11-18 00:16:44 +00:00
CodeGenInstruction.h Fix layering of MachineValueType.h by moving it from CodeGen to Support 2018-03-23 23:58:25 +00:00
CodeGenIntrinsics.h Fix layering of MachineValueType.h by moving it from CodeGen to Support 2018-03-23 23:58:25 +00:00
CodeGenMapTable.cpp [mips] Improve diagnostics for instruction mapping 2018-01-08 16:25:40 +00:00
CodeGenRegisters.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
CodeGenRegisters.h Fix layering of MachineValueType.h by moving it from CodeGen to Support 2018-03-23 23:58:25 +00:00
CodeGenSchedule.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
CodeGenSchedule.h [MC][Tablegen] Allow models to describe the retire control unit for llvm-mca. 2018-04-05 15:41:41 +00:00
CodeGenTarget.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
CodeGenTarget.h [MachineOperand][Target] MachineOperand::isRenamable semantics changes 2018-02-23 18:25:08 +00:00
CTagsEmitter.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
DAGISelEmitter.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
DAGISelMatcher.cpp Remove redundant includes from utils/TableGen. 2017-12-13 21:31:13 +00:00
DAGISelMatcher.h Fix layering of MachineValueType.h by moving it from CodeGen to Support 2018-03-23 23:58:25 +00:00
DAGISelMatcherEmitter.cpp [SelectionDAG] Add a isel matcher op to check the type of node results other than result 0. 2017-11-22 07:11:01 +00:00
DAGISelMatcherGen.cpp TableGen support for parameterized register class information 2017-09-14 16:56:21 +00:00
DAGISelMatcherOpt.cpp
DFAPacketizerEmitter.cpp Avoid int to string conversion in Twine or raw_ostream contexts. 2017-12-28 16:58:54 +00:00
DisassemblerEmitter.cpp Fix layering by moving X86DisassemblerDecoderCommon to Support 2018-03-23 23:58:20 +00:00
FastISelEmitter.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
FixedLenDecoderEmitter.cpp TableGen: Use DefInit::getDef() instead of the type's getRecord() 2018-03-05 14:01:30 +00:00
GlobalISelEmitter.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
InfoByHwMode.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
InfoByHwMode.h Fix layering of MachineValueType.h by moving it from CodeGen to Support 2018-03-23 23:58:25 +00:00
InstrDocsEmitter.cpp [Docs] Add tablegen backend for target opcode documentation 2017-11-14 15:35:15 +00:00
InstrInfoEmitter.cpp [MachineOperand][Target] MachineOperand::isRenamable semantics changes 2018-02-23 18:25:08 +00:00
IntrinsicEmitter.cpp Avoid int to string conversion in Twine or raw_ostream contexts. 2017-12-28 16:58:54 +00:00
LLVMBuild.txt Add missing dependency (headers are included from MC, so a link dependency could exist easily enough) 2018-03-29 00:29:43 +00:00
OptParserEmitter.cpp [Bash-autocompletion] Add support for -std= 2017-08-29 02:01:56 +00:00
PseudoLoweringEmitter.cpp
RegisterBankEmitter.cpp [globalisel][regbank] Warn about MIR ambiguities when register bank/class names clash. 2017-11-01 22:13:05 +00:00
RegisterInfoEmitter.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
RISCVCompressInstEmitter.cpp [RISCV] Tablegen-driven Instruction Compression. 2018-04-06 21:07:05 +00:00
SDNodeProperties.cpp TableGen: Allow setting SDNodeProperties on intrinsics 2017-12-20 19:36:28 +00:00
SDNodeProperties.h TableGen: Allow setting SDNodeProperties on intrinsics 2017-12-20 19:36:28 +00:00
SearchableTableEmitter.cpp TableGen: Support Intrinsic values in SearchableTable 2018-04-01 17:08:58 +00:00
SequenceToOffsetTable.h Remove usages of deprecated std::unary_function and std::binary_function. 2017-09-14 18:33:25 +00:00
SubtargetEmitter.cpp [TableGen] Change std::sort to llvm::sort in response to r327219 2018-04-06 20:18:05 +00:00
SubtargetFeatureInfo.cpp Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
SubtargetFeatureInfo.h
TableGen.cpp [RISCV] Tablegen-driven Instruction Compression. 2018-04-06 21:07:05 +00:00
TableGenBackends.h [RISCV] Tablegen-driven Instruction Compression. 2018-04-06 21:07:05 +00:00
tdtags
Types.cpp
Types.h
X86DisassemblerShared.h [X86] Use unique_ptr to simplify memory management. NFC 2018-03-24 07:15:47 +00:00
X86DisassemblerTables.cpp [X86] Disassembler support for having an ADSIZE prefix affect instructions with 0xf2 and 0xf3 prefixes. 2018-04-05 18:20:14 +00:00
X86DisassemblerTables.h [X86] Add a new disassembler opcode map for 3DNow. Stop treating 3DNow as an attribute. 2018-03-24 07:48:54 +00:00
X86EVEX2VEXTablesEmitter.cpp [X86] Rename VROUNDYPS* and VROUNDYPD* instructions to VROUNDPSY* and VROUNDPDY*. Fix itinerary mistake on all memory forms of VROUNDPD 2018-03-22 21:55:20 +00:00
X86FoldTablesEmitter.cpp Fix a bunch of typoes. NFC 2018-03-30 22:22:31 +00:00
X86ModRMFilters.cpp
X86ModRMFilters.h
X86RecognizableInstr.cpp [X86] Disassembler support for having an ADSIZE prefix affect instructions with 0xf2 and 0xf3 prefixes. 2018-04-05 18:20:14 +00:00
X86RecognizableInstr.h [X86] Reduce number of OpPrefix bits in TSFlags to 2. NFCI 2018-04-03 06:37:04 +00:00