Skip to content

Commit c0b83f2

Browse files
committed
Docuumentation updates per review
1 parent cf661be commit c0b83f2

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

mlir/docs/DeclarativeRewrites.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,9 @@ NativeCodeCall<"someFn($1, $2, $0)">` and use it like `(SomeCall $in0, $in1,
431431
$in2)`, then this will be translated into C++ call `someFn($in1, $in2, $in0)`.
432432

433433
In the case of properties, the placeholder will be bound to a value of the _interface_
434-
type of the property. Passing in a `StringProp` as an argument to a `NativeCodeCall`
435-
will pass a `StringRef` (as if the getter of the matched operation were called)
436-
and not a `std::string`. See `mlir/include/mlir/IR/Properties.td` for details
437-
on interface vs. storage type.
434+
type of the property. For example, passing in a `StringProp` as an argument to a `NativeCodeCall` will pass a `StringRef` (as if the getter of the matched
435+
operation were called) and not a `std::string`. See
436+
`mlir/include/mlir/IR/Properties.td` for details on interface vs. storage type.
438437

439438
Positional range placeholders will be substituted by multiple `dag` object
440439
parameters at the `NativeCodeCall` use site. For example, if we define

mlir/include/mlir/IR/Properties.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,9 @@ class ConfinedProperty<Property p, Pred pred, string newSummary = "">
405405
/// equal to the given value (and matches any other constraints on the property).
406406
/// The constant value is given as a string and should be of the _interface_ type
407407
/// of the attribute.
408+
///
409+
/// This requires that the given property's inference type be comparable to the
410+
/// given value with `==`, and does require specify a concrete property type.
408411
class ConstantProp<Property prop, string val>
409412
: ConfinedProp<prop,
410413
CPred<"$_self == " # val>,

mlir/include/mlir/TableGen/Pattern.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,9 @@ class SymbolInfoMap {
300300
// the DAG of the operation, `operandIndexOrNumValues` specifies the
301301
// operand index, and `variadicSubIndex` must be set to `std::nullopt`.
302302
//
303-
// * Properties not associated with an operation (ex. as arguments to
303+
// * Properties not associated with an operation (e.g. as arguments to
304304
// native code) have their corresponding PropConstraint stored in the
305-
// `dag` field. (They'll and set `operandIndexOrNumValues` to -1 to
306-
// indicate they aren't part of an operation.)
305+
// `dag` field. This constraint is only used when
307306
//
308307
// * If a symbol is defined in a `variadic` DAG, `dag` specifies the DAG
309308
// of the parent operation, `operandIndexOrNumValues` specifies the
@@ -423,9 +422,9 @@ class SymbolInfoMap {
423422
DagAndConstant(nullptr, index, std::nullopt));
424423
}
425424
static SymbolInfo getProp(const PropConstraint *constraint) {
425+
// -1 for anthe `operandIndexOrNumValues` is a sentinel value.
426426
return SymbolInfo(nullptr, Kind::Prop,
427427
DagAndConstant(constraint, -1, std::nullopt));
428-
;
429428
}
430429
static SymbolInfo
431430
getOperand(DagNode node, const Operator *op, int operandIndex,

mlir/lib/TableGen/Pattern.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,8 @@ void Pattern::collectBoundSymbols(DagNode tree, SymbolInfoMap &infoMap,
830830
if (!treeArgName.empty() && treeArgName != "_") {
831831
DagLeaf leaf = tree.getArgAsLeaf(i);
832832

833-
// In (NativeCodeCall<"Foo($_self, $0, $1, $2)"> I8Attr:$a, I8:$b, $c,
834-
// I8Prop:$d),
833+
// In (NativeCodeCall<"Foo($_self, $0, $1, $2, $3)"> I8Attr:$a, I8:$b,
834+
// $c, I8Prop:$d),
835835
if (leaf.isUnspecified()) {
836836
// This is case of $c, a Value without any constraints.
837837
verifyBind(infoMap.bindValue(treeArgName), treeArgName);

0 commit comments

Comments
 (0)