[llvm-dev] Manipulating DAGs in TableGen

Nicolai Hähnle via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 14 06:44:30 PDT 2020


On Tue, Oct 13, 2020 at 4:37 PM Paul C. Anagnostopoulos
<paul at windfall.com> wrote:
> Nicolai:
>
> If we have two operators to get and set DAG operator/operands, does it make sense to add to more operators to get/set the $names of operands? They would still specify the operand by integer index.

Yes, I do think that would be helpful. For setting, I think you'd want
to set the child and name at the same time, i.e. something like
!setdag(dag_to_modify, index1, value1, name1, index2, value2, name2,
...). Either valueN or nameN can be `?` (unset).

Cheers,
Nicolai


>
> At 10/13/2020 10:16 AM, Nicolai Hähnle wrote:
> >On Tue, Oct 13, 2020 at 10:47 AM Madhur Amilkanthwar
> ><madhur13490 at gmail.com> wrote:
> >> What do you guys think about the below enhancements?
> >>
> >> 5. !getdagrestype(dag [, index]) - Returns type of result value. If the DAG computes multiple values then return type of 'index'th result.
> >>
> >> 6. !setdagrestype(dag target_dag, type T [, index]) - Set return type of target_dag to T. Use of 'index' is as in 5.(Coupled with the existing (or enhanced?) foreach construct we can construct multiple DAGs with different return types.)
> >>
> >> .7 !setdagchild(dag target_dag, dag new_dag, index) - Set child 'index' numbered of target_dag to new_dag. I think this is more or less similar to 3 you suggested but I feel it is more convenient and concise.
> >>
> >> 8. !setdagchildcond(dag target_dag, dag new_dag, index, {C++ code}) - Similar to 7 above but do it only if the C++ code returns true. This is useful to check if the result type of `new_dag` and that of the operand type of 'index' child of 'target_dag' are compatible. Users can define compatibility using C++ code. For example, it is okay to set dag even if there is mismatch between signedness of types.
> >
> >All of these sound like operations that are specific to TableGen
> >backend interpretations of what a DAG means. This discussion is about
> >!ops which are a part of the TableGen frontend, so I don't think any
> >of these apply here.
> >
> >Cheers,
> >Nicolai
>


-- 
Lerne, wie die Welt wirklich ist,
aber vergiss niemals, wie sie sein sollte.


More information about the llvm-dev mailing list