[all-commits] [llvm/llvm-project] 210a38: [LLVM][TableGen] Add jupyter kernel for llvm-tblgen

David Spickett via All-commits all-commits at lists.llvm.org
Mon Jan 23 06:16:10 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 210a383e18ece7917edb9a7e20cecad4cf0daeb0
      https://github.com/llvm/llvm-project/commit/210a383e18ece7917edb9a7e20cecad4cf0daeb0
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2023-01-23 (Mon, 23 Jan 2023)

  Changed paths:
    A llvm/utils/TableGen/jupyter/.gitignore
    A llvm/utils/TableGen/jupyter/LLVM_TableGen.ipynb
    A llvm/utils/TableGen/jupyter/LLVM_TableGen.md
    A llvm/utils/TableGen/jupyter/README.md
    A llvm/utils/TableGen/jupyter/tablegen_kernel/__init__.py
    A llvm/utils/TableGen/jupyter/tablegen_kernel/__main__.py
    A llvm/utils/TableGen/jupyter/tablegen_kernel/assets/kernel.json
    A llvm/utils/TableGen/jupyter/tablegen_kernel/install.py
    A llvm/utils/TableGen/jupyter/tablegen_kernel/kernel.py

  Log Message:
  -----------
  [LLVM][TableGen] Add jupyter kernel for llvm-tblgen

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)
```

Reviewed By: jpienaar, awarzynski

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




More information about the All-commits mailing list