summaryrefslogtreecommitdiff
path: root/mlir/lib/Tools/PDLL/Parser/Lexer.cpp
AgeCommit message (Collapse)Author
2024-07-02mlir/LogicalResult: move into llvm (#97309)Ramkumar Ramachandra
This patch is part of a project to move the Presburger library into LLVM.
2023-09-01[MLIR][PDL] Add PDLL support for negated native constraintsMogball
This commit enables the expression of negated native constraints in PDLL: If a constraint is prefixed with "not" it is parsed as a negated constraint and hence the attribute `isNegated` of the emitted `pdl.apply_native_constraint` operation is set to `true`. In first instance this is only supported for the calling of external native C++ constraints and generation of PDL patterns. Previously, negating a native constraint would have been handled by creating an additional native call, e.g. ```PDLL Constraint checkA(input: Attr); Constarint checkNotA(input: Attr); ``` or by including an explicit additional operand for negation, e.g. `Constraint checkA(input: Attr, negated: Attr);` With this a constraint can simply be negated by prefixing it with `not`. e.g. ```PDLL Constraint simpleConstraint(op: Op); Pattern example { let inputOp = op<test.bar>() ->(type: Type); let root = op<test.foo>(inputOp.0) -> (); not simpleConstraint(inputOp); simpleConstraint(root); erase root; } ``` Depends on [[ https://reviews.llvm.org/D153871 | D153871 ]] Reviewed By: Mogball Differential Revision: https://reviews.llvm.org/D153959
2022-08-08[mlir] LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song
2022-07-14[mlir] (NFC) run clang-format on all filesJeff Niu
2022-04-28[mlir:PDLL] Fix error handling of eof within a string literalRiver Riddle
We currently aren't handling this properly, and in the case of a string block just crash. This commit adds proper error handling and detection for eof. Differential Revision: https://reviews.llvm.org/D124585
2022-04-26[mlir][PDLL-LSP] Add code completion for include file pathsRiver Riddle
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
2022-04-26[mlir][PDLL] Add document link and hover support to mlir-pdll-lsp-serverRiver Riddle
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
2022-03-19[mlir][PDLL] Add code completion to the PDLL language serverRiver Riddle
This commit adds code completion support to the language server, and initially supports providing completions for: Member access, attributes/constraint/dialect/operation names, and pattern metadata. Differential Revision: https://reviews.llvm.org/D121544
2022-02-10[PDLL] Add support for user defined constraint and rewrite functionsRiver Riddle
These functions allow for defining pattern fragments usable within the `match` and `rewrite` sections of a pattern. The main structure of Constraints and Rewrites functions are the same, and are similar to functions in other languages; they contain a signature (i.e. name, argument list, result list) and a body: ```pdll // Constraint that takes a value as an input, and produces a value: Constraint Cst(arg: Value) -> Value { ... } // Constraint that returns multiple values: Constraint Cst() -> (result1: Value, result2: ValueRange); ``` When returning multiple results, each result can be optionally be named (the result of a Constraint/Rewrite in the case of multiple results is a tuple). These body of a Constraint/Rewrite functions can be specified in several ways: * Externally In this case we are importing an external function (registered by the user outside of PDLL): ```pdll Constraint Foo(op: Op); Rewrite Bar(); ``` * In PDLL (using PDLL constructs) In this case, the body is defined using PDLL constructs: ```pdll Rewrite BuildFooOp() { // The result type of the Rewrite is inferred from the return. return op<my_dialect.foo>; } // Constraints/Rewrites can also implement a lambda/expression // body for simple one line bodies. Rewrite BuildFooOp() => op<my_dialect.foo>; ``` * In PDLL (using a native/C++ code block) In this case the body is specified using a C++(or potentially other language at some point) code block. When building PDLL in AOT mode this will generate a native constraint/rewrite and register it with the PDL bytecode. ```pdll Rewrite BuildFooOp() -> Op<my_dialect.foo> [{ return rewriter.create<my_dialect::FooOp>(...); }]; ``` Differential Revision: https://reviews.llvm.org/D115836
2022-01-26[mlir][NFC] Add a using for llvm::SMLoc/llvm::SMRange to LLVM.hRiver Riddle
These are used pervasively during parsing. Differential Revision: https://reviews.llvm.org/D118291
2021-12-16[mlir][PDLL] Add an initial frontend for PDLLRiver Riddle
This is a new pattern rewrite frontend designed from the ground up to support MLIR constructs, and to target PDL. This frontend language was proposed in https://llvm.discourse.group/t/rfc-pdll-a-new-declarative-rewrite-frontend-for-mlir/4798 This commit starts sketching out the base structure of the frontend, and is intended to be a minimal starting point for building up the language. It essentially contains support for defining a pattern, variables, and erasing an operation. The features mentioned in the proposal RFC (including IDE support) will be added incrementally in followup commits. I intend to upstream the documentation for the language in a followup when a bit more of the pieces have been landed. Differential Revision: https://reviews.llvm.org/D115093