proposal: add macro expansion of for-loop to TableGen

Hi folks,

TableGen provides sufficiently rich syntax for expressing target
instruction set. Nevertheless, when I wrote the PTX backend, I
observed that some redundancy in TableGen can be further eliminated
through macro expansion of for-loops.

The semantics of a for-loop is expanding the for-loop body, and so it
is equivalent to manually unroll the loop (see example #1).

I believe the for-loop is not only useful to the PTX backend but also
to other backends (see examples below). Generally speaking, a for-loop
can be used anywhere when you see a "table filling" pattern --- you
are writing repeated identical lines that only differs in a few places
(see examples below).

An (illustrative, not complete) BNF of for-loop is as follows:

Hi folks,

I have done studies since then, and I found that TableGen per se is
probably not a perfect place of adding macro expansion of for-loops.
If in the future someone proposes a similar thing, I hope this is
helpful to you. Here are the reasons:

Reason #1: If we add for-loop as a top-level syntactical construct,
such as let-statement, its usefulness is restricted.

Here is an excerpt of BNF of TableGen: