[all-commits] [llvm/llvm-project] 482e89: [tablegen] Emit string literals instead of char ar...

ldrumm via All-commits all-commits at lists.llvm.org
Mon Jan 27 10:22:50 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 482e890d1f94d137d9893d1c41a79eec8e86c66b
      https://github.com/llvm/llvm-project/commit/482e890d1f94d137d9893d1c41a79eec8e86c66b
  Author: Luke Drummond <luke.drummond at codeplay.com>
  Date:   2020-01-27 (Mon, 27 Jan 2020)

  Changed paths:
    M llvm/cmake/modules/TableGen.cmake
    M llvm/utils/TableGen/AsmWriterEmitter.cpp
    M llvm/utils/TableGen/InstrInfoEmitter.cpp
    M llvm/utils/TableGen/RegisterInfoEmitter.cpp
    M llvm/utils/TableGen/SequenceToOffsetTable.h
    M llvm/utils/TableGen/TableGen.cpp

  Log Message:
  -----------
  [tablegen] Emit string literals instead of char arrays

This changes the generated (Instr|Asm|Reg|Regclass)Name tables from this
form:
    extern const char HexagonInstrNameData[] = {
      /* 0 */ 'G', '_', 'F', 'L', 'O', 'G', '1', '0', 0,
      /* 9 */ 'E', 'N', 'D', 'L', 'O', 'O', 'P', '0', 0,
      /* 18 */ 'V', '6', '_', 'v', 'd', 'd', '0', 0,
      /* 26 */ 'P', 'S', '_', 'v', 'd', 'd', '0', 0,
      [...]
    };

...to this:

    extern const char HexagonInstrNameData[] = {
      /* 0 */ "G_FLOG10\0"
      /* 9 */ "ENDLOOP0\0"
      /* 18 */ "V6_vdd0\0"
      /* 26 */ "PS_vdd0\0"
      [...]
    };

This should make debugging and exploration a lot easier for mortals,
while providing a significant compile-time reduction for common compilers.

To avoid issues with low implementation limits, this is disabled by
default for visual studio.

To force output one way or the other, pass
`--long-string-literals=<bool>` to `tablegen`

Reviewers: mstorsjo, rnk

Subscribers: llvm-commits

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

A variation of this patch was originally committed in ce23515f5ab011 and
then reverted in e464b31c due to build failures.




More information about the All-commits mailing list