[llvm-dev] Manipulating DAGs in TableGen

Paul C. Anagnostopoulos via llvm-dev
Mon, 19 Oct 2020 16:53:43 -0000

I think I will do both. In order that dag(i) can work and fetch the operator, an
integer index is needed for it. So -1 for the operator. Then that should be
supported in the other bang operators.

Meanwhile, I will rename !getdagop and !setdagop just for consistency. The old
!getop and !setop will remain, of course, but deprecated. !getop is used 0 times
and !setop 4 times.

~~ Paul


At 10/19/2020 12:39 PM, Nicolai HÃ¤hnle wrote:
>I generally like the proposal.
>
>On Sat, Oct 17, 2020 at 2:05 PM Paul C. Anagnostopoulos via llvm-dev
><llvm-dev at lists.llvm.org> wrote:
>> Now I'm second-guessing myself about the indexes used to access the
operator and operands. All the C++ functions used to access the operands index
them from 0, as expected. It seems foolish and confusing to index them from 1 in
these bang operators.
>>
>> One option is to index the operator as -1 and the operands from 0.
>>
>> A second option is to remove the ability to index the operator and
retain the !getop and !setop bangs for that purpose, possibly renamed to
!getdagop and !setdagop.
>
>That's a good thought. It seems like a good idea to be consistent with
>how things look from a backend's perspective in C++, so separate
>!get(dag)op and !set(dag)op seems slightly better. Just my opinion :)
>
>Cheers,
>Nicolai