# MLIR -- Defining Patterns with PDLL

DevFeed: [MLIR -- Defining Patterns with PDLL](<https://devfeed.tech/articles/mlir-defining-patterns-with-pdll-40485.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2024/08/04/mlir-pdll/>)

Published: 2024-08-04T14:00:00Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [LLVM](<https://devfeed.tech/topics/llvm.md>), [Tooling](<https://devfeed.tech/topics/tooling.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [heir](<https://devfeed.tech/tags/heir.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [mlir](<https://devfeed.tech/tags/mlir.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [patterns](<https://devfeed.tech/tags/patterns.md>), [primer](<https://devfeed.tech/tags/primer.md>), [programming](<https://devfeed.tech/tags/programming.md>), [tablegen](<https://devfeed.tech/tags/tablegen.md>)

## AI overview

A tutorial on using PDLL to define MLIR patterns. It explains PDLL's relationship to PDL, its intended role as an alternative to TableGen pattern definitions, and how PDLL files are transformed into IR and then C++ code for compilation into a pass.

## Source excerpt

Table of Contents In this article I'll show how to use PDLL, a tool for defining MLIR patterns, which itself is built with MLIR. PDLL is intended to be a replacement for defining patterns in tablegen, though there are few public examples of its use. In fact, the main impetus for PDLL is that tablegen makes it difficult to express things like: Operations that return multiple results Operations with regions Operations with variadic operands Arithmetic on static values While not all these features are fully supported in PDLL yet, they are within scope of the language and tooling.