[PATCH] D73044: {tablegen] Emit string literals instead of char arrays

Luke Drummond via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 07:03:56 PST 2020


ldrumm created this revision.
ldrumm added reviewers: rnk, mstorsjo, stoklund.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.

[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 or when cross-compiling.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73044

Files:
  utils/TableGen/AsmWriterEmitter.cpp
  utils/TableGen/CMakeLists.txt
  utils/TableGen/InstrInfoEmitter.cpp
  utils/TableGen/RegisterInfoEmitter.cpp
  utils/TableGen/SequenceToOffsetTable.h
  utils/TableGen/TableGen.cpp
  utils/TableGen/tablegen-config.h.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73044.239119.patch
Type: text/x-patch
Size: 9288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200120/ab720e3a/attachment.bin>


More information about the llvm-commits mailing list