1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/utils/TableGen
Reid Kleckner e3b8614158 [MC] Rewrite tablegen for printInstrAlias to comiple faster, NFC
Before this change, the *InstPrinter.cpp files of each target where some
of the slowest objects to compile in all of LLVM. See this snippet produced by
ClangBuildAnalyzer:
https://reviews.llvm.org/P8171$96
Search for "InstPrinter", and see that it shows up in a few places.

Tablegen was emitting a large switch containing a sequence of operand checks,
each of which created many conditions and many BBs. Register allocation and
jump threading both did not scale well with such a large repetitive sequence of
basic blocks.

So, this change essentially turns those control flow structures into
data. The previous structure looked like:

  switch (Opc) {
  case TGT::ADD:
    // check alias 1
    if (MI->getOperandCount() == N && // check num opnds
        MI->getOperand(0).isReg() && // check opnd 0
        ...
        MI->getOperand(1).isImm() && // check opnd 1
     AsmString = "foo";
     break;
   }
   // check alias 2
   if (...)
     ...
   return false;

The new structure looks like:

  OpToPatterns: Sorted table of opcodes mapping to pattern indices.
   \->
     Patterns: List of patterns. Previous table points to subrange of
               patterns to match.
      \->
        Conds: The if conditions above encoded as a kind and 32-bit value.

See MCInstPrinter.cpp for the details of how the new data structures are
interpreted.

Here are some before and after metrics.
Time to compile AArch64InstPrinter.cpp:
  0m29.062s vs. 0m2.203s
size of the obj:
  3.9M vs. 676K
size of clang.exe:
  97M vs. 96M

I have not benchmarked disassembly performance, but typically
disassemblers are bottlenecked on IO and string processing, not alias
matching, so I'm not sure it's interesting enough to be worth doing.

Reviewers: RKSimon, andreadb, xbolva00, craig.topper

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D70650
2019-12-06 15:00:18 -08:00
..
GlobalISel [gicombiner] Add a CodeExpander to handle C++ fragments with variable expansion 2019-10-03 19:13:39 +00:00
AsmMatcherEmitter.cpp Cosmetic; don't use the magic constant 35 when HASH is more readable. This matches other MCK__<THING>_* usage better. 2019-09-23 12:52:42 +00:00
AsmWriterEmitter.cpp [MC] Rewrite tablegen for printInstrAlias to comiple faster, NFC 2019-12-06 15:00:18 -08:00
AsmWriterInst.cpp
AsmWriterInst.h AsmWriterOperand - fix uninitialized variable warning. NFCI. 2019-11-07 16:56:15 +00:00
Attributes.cpp
CallingConvEmitter.cpp AArch64: support arm64_32, an ILP32 slice for watchOS. 2019-09-12 10:22:23 +00:00
CMakeLists.txt [TableGen] Add backend to generate command guide for tools using libOption. 2019-11-22 14:10:17 -08:00
CodeEmitterGen.cpp [TableGen] Fix crash when using HwModes in CodeEmitterGen 2019-10-09 09:15:34 +00:00
CodeGenDAGPatterns.cpp [SVE][CodeGen] Scalable vector MVT size queries 2019-11-18 12:30:59 +00:00
CodeGenDAGPatterns.h Reland 'Fixed -Wdeprecated-copy warnings. NFCI.' 2019-11-23 23:09:39 +01:00
CodeGenHwModes.cpp
CodeGenHwModes.h
CodeGenInstruction.cpp GlobalISel: Add target pre-isel instructions 2019-10-07 18:43:29 +00:00
CodeGenInstruction.h CodeGenInstruction - fix uninitialized variable warnings. NFCI. 2019-11-06 17:04:21 +00:00
CodeGenIntrinsics.h Teach GlobalISelEmitter to treat used iPTRAny operands as pointer operands 2019-08-20 22:04:10 +00:00
CodeGenMapTable.cpp [TableGen] CodeGenMapTable - Don't dereference a dyn_cast result. NFCI. 2019-09-17 17:32:15 +00:00
CodeGenRegisters.cpp GlobalISel: Support physical register inputs in patterns 2019-09-06 20:32:37 +00:00
CodeGenRegisters.h CodeGenRegBank - make functions const to fix cppcheck warnings. 2019-11-10 11:14:58 +00:00
CodeGenSchedule.cpp [TableGen] Improve error reporting of overlapping definitions (NFC) 2019-10-02 19:44:53 +00:00
CodeGenSchedule.h
CodeGenTarget.cpp [TableGen] Support encoding per-HwMode 2019-09-19 13:39:54 +00:00
CodeGenTarget.h Recommit "[GlobalISel] Import patterns containing INSERT_SUBREG" 2019-08-27 17:47:06 +00:00
CTagsEmitter.cpp
DAGISelEmitter.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
DAGISelMatcher.cpp
DAGISelMatcher.h
DAGISelMatcherEmitter.cpp
DAGISelMatcherGen.cpp TableGen: Remove assert that pattern results match input number 2019-11-06 16:06:37 -08:00
DAGISelMatcherOpt.cpp DAGISelMatcherOpt - TGParser::ParseOperation - silence static analyzer cast_or_null<CheckTypeMatcher> null dereference warning. NFCI. 2019-09-26 17:38:47 +00:00
DFAEmitter.cpp [TableGen] Pacify gcc-5.4 more 2019-10-07 08:23:20 +00:00
DFAEmitter.h [TableGen] Introduce a generic automaton (DFA) backend 2019-10-04 09:03:36 +00:00
DFAPacketizerEmitter.cpp [DFAPacketizer] Allow up to 64 functional units 2019-11-05 15:41:42 +00:00
DisassemblerEmitter.cpp [TableGen] Correct comments for end of namespace. NFC 2019-08-25 10:47:30 +00:00
ExegesisEmitter.cpp
FastISelEmitter.cpp
FixedLenDecoderEmitter.cpp Reduce scope of variable to silence cppcheck warning. NFC 2019-11-09 22:10:09 +00:00
GICombinerEmitter.cpp [gicombiner] Add parse failure tests for defs/match 2019-10-25 12:56:49 -07:00
GlobalISelEmitter.cpp [PGO][PGSO] DAG.shouldOptForSize part. 2019-11-21 14:16:00 -08:00
InfoByHwMode.cpp [TableGen] Support encoding per-HwMode 2019-09-19 13:39:54 +00:00
InfoByHwMode.h [TableGen] Support encoding per-HwMode 2019-09-19 13:39:54 +00:00
InstrDocsEmitter.cpp [TableGen] Correct comments for end of namespace. NFC 2019-08-25 10:47:30 +00:00
InstrInfoEmitter.cpp GlobalISel: Add target pre-isel instructions 2019-10-07 18:43:29 +00:00
IntrinsicEmitter.cpp [IntrinsicEmitter] Add overloaded type VecOfBitcastsToInt for SVE intrinsics 2019-10-02 09:25:02 +00:00
LLVMBuild.txt
OptEmitter.cpp [TableGen] Add backend to generate command guide for tools using libOption. 2019-11-22 14:10:17 -08:00
OptEmitter.h [TableGen] Add backend to generate command guide for tools using libOption. 2019-11-22 14:10:17 -08:00
OptParserEmitter.cpp [TableGen] Add backend to generate command guide for tools using libOption. 2019-11-22 14:10:17 -08:00
OptRSTEmitter.cpp [TableGen] Fixed 'unused but set variable' warning. NFCI 2019-11-24 20:04:03 +01:00
PredicateExpander.cpp
PredicateExpander.h
PseudoLoweringEmitter.cpp
RegisterBankEmitter.cpp
RegisterInfoEmitter.cpp TableGen: Use enum names in composeSubRegIndices table 2019-10-27 21:26:56 -07:00
RISCVCompressInstEmitter.cpp [tblgen] Add getOperatorAsDef() to Record 2019-10-08 18:41:32 +00:00
SDNodeProperties.cpp
SDNodeProperties.h
SearchableTableEmitter.cpp Fix uninitialized variable warnings. NFCI. 2019-11-09 17:03:21 +00:00
SequenceToOffsetTable.h Relax assertions when there's really no entries. [NFC] 2019-10-22 15:26:30 -04:00
SubtargetEmitter.cpp [TableGen] Fix a bug that MCSchedClassDesc is interfered between different SchedModel 2019-10-11 08:36:54 +00:00
SubtargetFeatureInfo.cpp Use a bit of relaxed constexpr to make FeatureBitset costant intializable 2019-08-24 15:02:44 +00:00
SubtargetFeatureInfo.h
TableGen.cpp Revert "Use InitLLVM to setup a pretty stack printer" 2019-11-25 21:06:56 -05:00
TableGenBackends.h [TableGen] Add backend to generate command guide for tools using libOption. 2019-11-22 14:10:17 -08:00
tdtags
Types.cpp
Types.h
WebAssemblyDisassemblerEmitter.cpp [TableGen] Correct comments for end of namespace. NFC 2019-08-25 10:47:30 +00:00
WebAssemblyDisassemblerEmitter.h
X86DisassemblerShared.h
X86DisassemblerTables.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
X86DisassemblerTables.h
X86EVEX2VEXTablesEmitter.cpp [X86] Consider isCodeGenOnly in the EVEX2VEX pass to make VMAXPD/PS map to the non-commutable VEX instruction. Use EVEX2VEX override to fix the scalar instructions. 2019-10-01 07:10:09 +00:00
X86FoldTablesEmitter.cpp X86FoldTablesEmitter - fix static analyzer potential invalid iterator warning. NFCI. 2019-11-06 13:31:00 +00:00
X86ModRMFilters.cpp
X86ModRMFilters.h
X86RecognizableInstr.cpp [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
X86RecognizableInstr.h