llvm-6502/utils/TableGen
Chad Rosier b7110cf5b5 Improve the compression of the tablegen DiffLists by introducing a new sort
algorithm when assigning EnumValues to the synthesized registers.

The current algorithm, LessRecord, uses the StringRef compare_numeric
function.  This function compares strings, while handling embedded numbers.
For example, the R600 backend registers are sorted as follows:

  T1
  T1_W
  T1_X
  T1_XYZW
  T1_Y
  T1_Z
  T2
  T2_W
  T2_X
  T2_XYZW
  T2_Y
  T2_Z

In this example, the 'scaling factor' is dEnum/dN = 6 because T0, T1, T2
have an EnumValue offset of 6 from one another.  However, in other parts
of the register bank, the scaling factors are different:

dEnum/dN = 5:
  KC0_128_W
  KC0_128_X
  KC0_128_XYZW
  KC0_128_Y
  KC0_128_Z
  KC0_129_W
  KC0_129_X
  KC0_129_XYZW
  KC0_129_Y
  KC0_129_Z

The diff lists do not work correctly because different kinds of registers have
different 'scaling factors'.  This new algorithm, LessRecordRegister, tries to
enforce a scaling factor of 1.  For example, the registers are now sorted as
follows:

  T1
  T2
  T3
  ...
  T0_W
  T1_W
  T2_W
  ...
  T0_X
  T1_X
  T2_X
  ...
  KC0_128_W
  KC0_129_W
  KC0_130_W
  ...

For the Mips and R600 I see a 19% and 6% reduction in size, respectively.  I
did see a few small regressions, but the differences were on the order of a
few bytes (e.g., AArch64 was 16 bytes).  I suspect there will be even
greater wins for targets with larger register files.

Patch reviewed by Jakob.
rdar://14006013


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185094 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27 19:38:13 +00:00
..
AsmMatcherEmitter.cpp Handle tied sub-operands in AsmMatcherEmitter 2013-04-27 18:48:23 +00:00
AsmWriterEmitter.cpp This patch that sets the EmitAlias flag in td files 2013-02-05 08:32:10 +00:00
AsmWriterInst.cpp Remove exception handling usage from tblgen. 2012-10-25 20:33:17 +00:00
AsmWriterInst.h trailing whitespace cleanup 2010-10-11 19:38:01 +00:00
CallingConvEmitter.cpp Remove exception handling usage from tblgen. 2012-10-25 20:33:17 +00:00
CMakeLists.txt Add TableGen ctags(1) emitter and helper script. 2013-03-21 23:40:38 +00:00
CodeEmitterGen.cpp Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
CodeGenDAGPatterns.cpp Allow types to be omitted in output patterns. 2013-03-24 19:37:00 +00:00
CodeGenDAGPatterns.h Make all unnamed RegisterClass TreePatternNodes typed MVT::i32. 2013-03-23 18:08:44 +00:00
CodeGenInstruction.cpp Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
CodeGenInstruction.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
CodeGenIntrinsics.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
CodeGenMapTable.cpp Fix for bug 15246 -- out-of-bound error in the TableGen backend, CodeGenMapTable.cpp. 2013-02-14 17:58:13 +00:00
CodeGenRegisters.cpp Improve the compression of the tablegen DiffLists by introducing a new sort 2013-06-27 19:38:13 +00:00
CodeGenRegisters.h Make SubRegIndex size mandatory, following r183020. 2013-05-31 23:45:26 +00:00
CodeGenSchedule.cpp Support BufferSize on ProcResGroup for unified MOp schedulers. 2013-06-15 04:50:06 +00:00
CodeGenSchedule.h Support BufferSize on ProcResGroup for unified MOp schedulers. 2013-06-15 04:50:06 +00:00
CodeGenTarget.cpp Use ArrayRef<MVT::SimpleValueType> when possible. 2013-03-17 17:26:09 +00:00
CodeGenTarget.h Use ArrayRef<MVT::SimpleValueType> when possible. 2013-03-17 17:26:09 +00:00
CTagsEmitter.cpp Add TableGen ctags(1) emitter and helper script. 2013-03-21 23:40:38 +00:00
DAGISelEmitter.cpp Write llvm-tblgen backends as functions instead of sub-classes. 2012-06-11 15:37:55 +00:00
DAGISelMatcher.cpp Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
DAGISelMatcher.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
DAGISelMatcherEmitter.cpp Fix comments 2013-02-05 16:53:11 +00:00
DAGISelMatcherGen.cpp Allow types to be omitted in output patterns. 2013-03-24 19:37:00 +00:00
DAGISelMatcherOpt.cpp Remove unused STL header includes. 2011-04-23 19:53:52 +00:00
DFAPacketizerEmitter.cpp Fix PR14568: Avoid the DFA packetizer from making an invalid read 2012-12-10 22:45:57 +00:00
DisassemblerEmitter.cpp Add AArch64 as an experimental target. 2013-01-31 12:12:40 +00:00
FastISelEmitter.cpp Recognize ValueType operands in source patterns for fast-isel. 2013-05-22 20:45:11 +00:00
FixedLenDecoderEmitter.cpp TableGen/FixedLenDecoderEmitter.cpp: Fix a potential mask overflow in fieldFromInstruction(). 2012-12-26 06:43:14 +00:00
InstrInfoEmitter.cpp TableGen: Generate a function for getting operand indices based on their defined names 2013-06-25 21:22:09 +00:00
IntrinsicEmitter.cpp Use the AttributeSet instead of AttributeWithIndex. 2013-01-27 03:25:05 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Makefile Remove exception handling usage from tblgen. 2012-10-25 20:33:17 +00:00
OptParserEmitter.cpp Sort a few more #include lines in tools/... unittests/... and utils/... 2013-01-02 10:26:28 +00:00
PseudoLoweringEmitter.cpp PR14992 - Tablegen incorrectly converts ARM tLDMIA_UPD pseudo to tLDMIA 2013-02-13 19:21:47 +00:00
RegisterInfoEmitter.cpp Improve the compression of the tablegen DiffLists by introducing a new sort 2013-06-27 19:38:13 +00:00
SequenceToOffsetTable.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
SetTheory.cpp Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
SetTheory.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
StringToOffsetTable.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
SubtargetEmitter.cpp Support BufferSize on ProcResGroup for unified MOp schedulers. 2013-06-15 04:50:06 +00:00
TableGen.cpp Add TableGen ctags(1) emitter and helper script. 2013-03-21 23:40:38 +00:00
TableGenBackends.h Add TableGen ctags(1) emitter and helper script. 2013-03-21 23:40:38 +00:00
tdtags Add TableGen ctags(1) emitter and helper script. 2013-03-21 23:40:38 +00:00
TGValueTypes.cpp Remove extra semicolons. 2012-10-11 22:25:56 +00:00
X86DisassemblerShared.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
X86DisassemblerTables.cpp Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
X86DisassemblerTables.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00
X86ModRMFilters.cpp Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch 2011-12-20 02:50:00 +00:00
X86ModRMFilters.h Fix Doxygen issues: 2012-09-13 12:34:29 +00:00
X86RecognizableInstr.cpp Add support for encoding the HLE XACQUIRE and XRELEASE prefixes. 2013-06-18 17:08:10 +00:00
X86RecognizableInstr.h Sort the #include lines for utils/... 2012-12-04 10:37:14 +00:00