[all-commits] [llvm/llvm-project] b3fc0f: [mlir][PDLL] Don't use the result of `Constraint::...

River Riddle via All-commits all-commits at lists.llvm.org
Tue Apr 26 18:34:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b3fc0fa84a09540d8fc7214899021acbf2fd6ff8
      https://github.com/llvm/llvm-project/commit/b3fc0fa84a09540d8fc7214899021acbf2fd6ff8
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M mlir/include/mlir/TableGen/Constraint.h
    M mlir/include/mlir/Tools/PDLL/ODS/Constraint.h
    M mlir/lib/TableGen/Constraint.cpp
    M mlir/lib/Tools/PDLL/ODS/CMakeLists.txt
    A mlir/lib/Tools/PDLL/ODS/Constraint.cpp
    M mlir/lib/Tools/PDLL/ODS/Context.cpp
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/include/ops.td
    M mlir/test/mlir-pdll/Parser/include_td.pdll

  Log Message:
  -----------
  [mlir][PDLL] Don't use the result of `Constraint::getDefName()` when uniquing

In the case of anonymous defs this may return the name of the base def class,
which can lead to two different defs with the same name (which hits an assert).
This commit adds a new `getUniqueDefName` method that returns a unique name
for the constraint.

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


  Commit: 597fde54a8d6f19b5fe6563c0ba9f8b6b9158c28
      https://github.com/llvm/llvm-project/commit/597fde54a8d6f19b5fe6563c0ba9f8b6b9158c28
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M mlir/CMakeLists.txt
    M mlir/cmake/modules/AddMLIR.cmake
    M mlir/cmake/modules/CMakeLists.txt
    M mlir/cmake/modules/MLIRConfig.cmake.in
    M mlir/test/lib/CMakeLists.txt
    A mlir/test/lib/Tools/CMakeLists.txt
    A mlir/test/lib/Tools/PDLL/CMakeLists.txt
    A mlir/test/lib/Tools/PDLL/TestPDLL.cpp
    A mlir/test/lib/Tools/PDLL/TestPDLL.pdll
    A mlir/test/lib/Tools/PDLL/lit.local.cfg
    A mlir/test/mlir-pdll/Integration/test-pdll.mlir
    A mlir/test/mlir-pdll/Parser/dependency-file.pdll
    M mlir/tools/CMakeLists.txt
    M mlir/tools/mlir-opt/CMakeLists.txt
    M mlir/tools/mlir-opt/mlir-opt.cpp
    M mlir/tools/mlir-pdll/CMakeLists.txt
    M mlir/tools/mlir-pdll/mlir-pdll.cpp

  Log Message:
  -----------
  [mlir][PDLL] Add support for generating PDL patterns from PDLL at build time

This essentially sets up mlir-pdll to function in a similar manner to mlir-tblgen. Aside
from the boilerplate of configuring CMake and setting up a basic initial test, two new
options are added to mlir-pdll to mirror options provided by tblgen:

* -d
 This option generates a dependency file (i.e. a set of build time dependencies) while
 processing the input file.

* --write-if-changed
 This option only writes to the output file if the data would have changed, which for
 the build system prevents unnecesarry rebuilds if the file was touched but not actually
 changed.

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


  Commit: fb5a59f6e1b9ec3192ecdc14b69ab83dafcf90f2
      https://github.com/llvm/llvm-project/commit/fb5a59f6e1b9ec3192ecdc14b69ab83dafcf90f2
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M mlir/cmake/modules/AddMLIR.cmake
    M mlir/lib/Tools/mlir-pdll-lsp-server/CMakeLists.txt
    A mlir/lib/Tools/mlir-pdll-lsp-server/CompilationDatabase.cpp
    A mlir/lib/Tools/mlir-pdll-lsp-server/CompilationDatabase.h
    M mlir/lib/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.cpp
    M mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.cpp
    M mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
    A mlir/test/mlir-pdll-lsp-server/compilation_database.test
    A mlir/test/mlir-pdll-lsp-server/include/included.pdll
    A mlir/test/mlir-pdll-lsp-server/include/included.td
    A mlir/test/mlir-pdll-lsp-server/lit.local.cfg
    M mlir/utils/vscode/package.json
    M mlir/utils/vscode/src/configWatcher.ts
    M mlir/utils/vscode/src/mlirContext.ts

  Log Message:
  -----------
  [mlir][PDLL] Add initial support for a PDLL compilation database

The compilation database acts in a similar way to the compilation database
(compile_commands.json) used by clang-tidy, i.e. it provides additional
information about the compilation of project files to help the language
server. The main piece of information provided by the PDLL compilation
database in this commit is the set of include directories used when processing
the input .pdll file. This allows for the server to properly process .pdll files
that use includes anchored by the include directories set up in the build system.

The structure of the textual form of a compilation database is a yaml file
containing documents of the following form:

```
--- !FileInfo:
  filepath: <string> - Absolute file path of the file.
  includes: <string> - Semi-colon delimited list of include directories.
```

This commit also adds support to cmake for automatically generating
a `pdll_compile_commands.yml` file at the top-level of the build
directory.

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


  Commit: 09af7fefc8dce7648fe45fd9ffce6795b56400f2
      https://github.com/llvm/llvm-project/commit/09af7fefc8dce7648fe45fd9ffce6795b56400f2
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M llvm/include/llvm/Support/SourceMgr.h
    M mlir/lib/Tools/PDLL/Parser/Lexer.cpp
    M mlir/lib/Tools/PDLL/Parser/Lexer.h
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/lib/Tools/lsp-server-support/Protocol.cpp
    M mlir/lib/Tools/lsp-server-support/Protocol.h
    M mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.cpp
    M mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.cpp
    M mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
    A mlir/test/mlir-pdll-lsp-server/document-links.test
    M mlir/test/mlir-pdll-lsp-server/hover.test
    M mlir/test/mlir-pdll-lsp-server/initialize-params.test

  Log Message:
  -----------
  [mlir][PDLL] Add document link and hover support to mlir-pdll-lsp-server

This allows for navigating to included files on click, and also provides hover
information about the include file (similarly to clangd).

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


  Commit: 41d2c6df5cce4a4d65ff2956be762a50600ebfd9
      https://github.com/llvm/llvm-project/commit/41d2c6df5cce4a4d65ff2956be762a50600ebfd9
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M mlir/include/mlir/Tools/PDLL/Parser/CodeComplete.h
    M mlir/lib/Tools/PDLL/Parser/Lexer.cpp
    M mlir/lib/Tools/PDLL/Parser/Lexer.h
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.cpp
    M mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.cpp
    M mlir/test/mlir-pdll-lsp-server/completion.test

  Log Message:
  -----------
  [mlir][PDLL-LSP] Add code completion for include file paths

This allows for providing completion results for include directive
file paths by searching the set of include directories for the current
file.

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


Compare: https://github.com/llvm/llvm-project/compare/a2681c43308c...41d2c6df5cce


More information about the All-commits mailing list