1+ //===- SQLOps.td - Polygeist dialect ops ----------------*- tablegen -*-===//
2+ //
3+ // This file is licensed under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ //===----------------------------------------------------------------------===//
8+
9+ // #ifndef SQL_OPS
10+ // #define SQL_OPS
11+
12+ include "mlir/IR/AttrTypeBase.td"
13+ include "SQLDialect.td"
14+
15+ def SelectOp : SQL_Op<"select", [Pure]> {
16+ let summary = "select";
17+
18+ // TODO: limit (optional), where clauses, join, etc
19+ let arguments = (ins StrArrayAttr:$column, StrAttr:$table);
20+ let results = (outs Index : $result);
21+
22+ let hasFolder = 0;
23+ let hasCanonicalizer = 0;
24+ }
25+
26+ def ExecuteOp : SQL_Op<"execute", []> {
27+ let summary = "execute query";
28+
29+ let arguments = (ins Index:$handle);
30+ let results = (outs Index:$result);
31+
32+ let hasFolder = 0;
33+ let hasCanonicalizer = 0;
34+ }
35+
36+ def NumResultsOp : SQL_Op<"num_results", [Pure]> {
37+ let summary = "number of results";
38+
39+ let arguments = (ins Index:$handle);
40+ let results = (outs Index:$result);
41+
42+ let hasFolder = 0;
43+ let hasCanonicalizer = 0;
44+ }
45+
46+ def ResultOp : SQL_Op<"get_result", [Pure]> {
47+ let summary = "get results of execution";
48+
49+ let arguments = (ins Index:$handle, StrAttr:$column, Index:$row);
50+ let results = (outs AnyType:$result);
51+
52+ let hasFolder = 0;
53+ let hasCanonicalizer = 0;
54+ }
55+
56+
57+ // #endif
0 commit comments