[PATCH] D132378: [LLVM][TableGen] Add jupyter kernel for llvm-tblgen

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 07:55:43 PDT 2022


DavidSpickett created this revision.
Herald added subscribers: bzcheeseman, rriddle.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer.
Herald added a project: LLVM.

This is based on the MLIR opt kernel:
https://github.com/llvm/llvm-project/tree/main/mlir/utils/jupyter

The inent of this is to enable experimentation and the creation
of interactive tutorials for the basics of tablegen.

Noteable changes from that:

- Removed the codemirror mode settings since those won't exist for tablegen.
- Added "%args" "magic" to control arguments sent to llvm-tblgen.

(magics are directives, see
https://ipython.readthedocs.io/en/stable/interactive/magics.html)

For example the following:

  %args --print-detailed-records
  class Stuff {}
  
  def water_bottle : Stuff {}

Produces:

  DETAILED RECORDS for file -
  
  -------------------- Global Variables (0) --------------------
  
  -------------------- Classes (1) --------------------
  
  Stuff  |<stdin>:1|
    Template args: (none)
    Superclasses: (none)
    Fields: (none)
  
  -------------------- Records (1) --------------------
  
  water_bottle  |<stdin>:3|
    Superclasses: Stuff
    Fields: (none)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132378

Files:
  llvm/utils/TableGen/jupyter/.gitignore
  llvm/utils/TableGen/jupyter/README.md
  llvm/utils/TableGen/jupyter/tablegen_kernel/__init__.py
  llvm/utils/TableGen/jupyter/tablegen_kernel/__main__.py
  llvm/utils/TableGen/jupyter/tablegen_kernel/assets/kernel.json
  llvm/utils/TableGen/jupyter/tablegen_kernel/install.py
  llvm/utils/TableGen/jupyter/tablegen_kernel/kernel.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132378.454506.patch
Type: text/x-patch
Size: 8177 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220822/a51d93bc/attachment.bin>


More information about the llvm-commits mailing list