[llvm-dev] Manipulating DAGs in TableGen
Nicolai Hähnle via llvm-dev
llvm-dev at lists.llvm.org
Wed Oct 14 06:43:11 PDT 2020
On Tue, Oct 13, 2020 at 5:06 PM Madhur Amilkanthwar
<madhur13490 at gmail.com> wrote:
> On Tue, Oct 13, 2020 at 8:07 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.
>>
>> 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.
>
>
> I am not sure why you say so. Isn't 7 and 8 above somewhere similar to !con already offered by the language? !con allows you to concatenate two DAGs, 5 allows you to connect two DAGs to form a bigger DAG. You may be able to achieve the same today with existing the language constructs but I don't see a concise way to do this.
You're right that 7 is like !cond (and actually seems like it's
identical to the !setdag proposed by Paul).
8 doesn't work though because you can't just run C++ code at TableGen
frontend runtime.
Cheers,
Nicolai
>
> 5 and 6 are subject to debate but since it's a language an addition like this could be useful.
>
>
>> >Cheers,
>> >Nicolai
>>
>
>
> --
> Disclaimer: Views, concerns, thoughts, questions, ideas expressed in this mail are of my own and my employer has no take in it.
> Thank You.
> Madhur D. Amilkanthwar
>
--
Lerne, wie die Welt wirklich ist,
aber vergiss niemals, wie sie sein sollte.
More information about the llvm-dev
mailing list