Paul C. Anagnostopoulos via llvm-dev
2020-Oct-16 20:37 UTC
[llvm-dev] Manipulating DAGs in TableGen
This is a revised proposal to enhance TableGen's ability to analyze and manipulate DAGs. Hopefully this will allow more complex DAGs to be built in TableGen. 1. Add a new value suffix. value(index) The value must be a DAG. The index specifies the operator or an operand, whose value is produced. The index can be 0 produce the operator 1...n produce operand by position If the item does not exist, an error is reported. Note that multiple value suffixes are allowed, so, for example, DagList[i](1) would produce the first operand of the i-th dag in the list. 2. Add the !getdagvalue() bang operator. !getdagvalue(dag, index [, default]) This bang operator produces the same result as the (...) suffix. However, the default value can be specified as the third argument. If the item does not exist and no default is specified, an error is reported. 2. Add the !getdagname() bang operator. !getdagname(dag, index [, default]) This bang operator produces the name of the indexed operator/operand, as a string without the leading dollar sign ($). The default value can be specified as the third argument. If the item does not exist and no default is specified, an error is reported. 3. Add the !setdag bang operator. !setdag(dag, index1, value1, name1, index2, value2, name2, ...) This bang operator creates a copy of the top-level dag node and then replaces the operator and/or operands with new values and names. Each replacement is specified by an index, a value, and a name. The value and/or name can be ? (uninitialized). The new dag is produced. If an index is invalid, an error is reported. !getdagvalue and !setdagvalue replace !getop() and !setop(), which could be deprecated. 4. The !size operator will be extended to accept a DAG node and produce the number of operands in it.