2023 LLVM Dev Mtg - TableGen Formatter: Extending Clang-Format Capabilities

Опубликовано: 15 Март 2026
на канале: LLVM
263
5

2023 LLVM Developers' Meeting
https://llvm.org/devmtg/2023-10
------
TableGen Formatter: Extending Clang-Format Capabilities
Speaker: Venkat Nikhil Tatavarthy, Himanshu Shishir Shah
------
Slides: https://llvm.org/devmtg/2023-10/slide...
-----
The TableGen infrastructure holds a pivotal position within LLVM and its sub-projects, particularly in LLVM backends, where a considerable amount of target-specific information, such as instruction definitions and CPU features, is expressed using TableGen. Furthermore, MLIR also heavily depends on TableGen as its backbone, playing a critical role in defining dialects, custom operators, and lowering rules. Both subsystems contain a significant volume of TableGen code, with over 300 and 44 KLOC utilized in LLVM and MLIR, respectively. Despite its extensive usage, the TableGen language currently lacks a proper code formatter, creating a need for one. To address this issue, we propose a solution that involves adding support for TableGen in Clang-Format. By building on top of the existing Clang-Format codebase, we efficiently achieve this with minimal modifications, benefiting from code reuse and ensuring seamless compatibility with its core functionalities. These modifications enable the Clang-Format to recognize a majority of the TableGen syntax including conditional statements, loops, and keywords such as def and multiclass. This effort contributes to enhancing code consistency and readability within TableGen, further empowering developers working on LLVM and its related projects.
-----
Videos Edited by Bash Films: http://www.BashFilms.com