Paul C. Anagnostopoulos via llvm-dev
2020-Oct-17 12:04 UTC
[llvm-dev] Manipulating DAGs in TableGen
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. Opinions, please.
Nicolai Hähnle via llvm-dev
2020-Oct-19 16:39 UTC
[llvm-dev] Manipulating DAGs in TableGen
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> > Opinions, please. > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Lerne, wie die Welt wirklich ist, aber vergiss niemals, wie sie sein sollte.
Paul C. Anagnostopoulos via llvm-dev
2020-Oct-19 16:53 UTC
[llvm-dev] Manipulating DAGs in TableGen
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