Skip to content

Conversation

@Bertik23
Copy link
Contributor

@Bertik23 Bertik23 commented Oct 4, 2025

This PR is part of the LLVM IR LSP server project (RFC)

This PR depends on #164623 and #164626

With this PR we are introducing a LSP server for LLVM IR as the llvm-lsp-server tool.

The LSP is build using the LSP support library, that was recently moved from MLIR into Support/LSP. And supports some standard LSP messages as well as some custom ones tailored for compiler development.

The server supports the following standard LSP capabilities:

  • textDocumentSync.openClose: Synchronizes document content with the server.
  • referencesProvider: Finds all references to a symbol.
  • codeActionProvider: Provides code actions, such as quick fixes and refactorings. This server uses it to provide CFG views.
  • documentsSymbolProvider: Provides a tree of document symbols, enables breadcrums navigation in the editor.

Non-standard messages are used for

  • getting svgs with control flow graphs
  • cross navigation between CFG and IR

How is the LSP server build

The server utilizes a similar build to the LSP servers found in MLIR or clangd.
Open files use a support class IRDocument, this class handles anything involving the file directly.

To enable cross navigation between CFG and IR a parameter was added to the DOTFuncInfo, a function that takes a BasicBlock and returns a string id for that basicblock.

LSP artifacts like CFGs and optimized files are then stored in a folder next to the file, accessible to the user.

@github-actions
Copy link

github-actions bot commented Oct 4, 2025

⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
Please turn off Keep my email addresses private setting in your account.
See LLVM Developer Policy and LLVM Discourse for more information.

@github-actions
Copy link

github-actions bot commented Oct 4, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@Bertik23 Bertik23 marked this pull request as ready for review November 5, 2025 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant