[PATCH] TableGen: Generate an enum for all named Operand types

Ahmed Bougacha ahmed.bougacha at gmail.com
Sat Nov 16 19:41:21 PST 2013

On Tue, Nov 12, 2013 at 9:59 AM, Quentin Colombet <qcolombet at apple.com> wrote:
> Hi Ahmed,
> The code looks fine to me, but the additional documentation is a bit too
> short.
> +TableGen will also generate an enumeration consisting of all named Operand
> +types defined in the backend, in the llvm::XXX::OpTypes namespace.
> +
> Indeed, I am not sure that it is clear that "types defined in the backend"
> are the derived types in the backend. In my opinion the proposed phrasing
> would suffix if and only if there is an example to illustrate it.
> Unfortunately, you cannot reuse the XNORrr example as it does not have such
> types. You have to add one.

Yup, added a subsubsection (with drive-by consistency changes) to demonstrate.

> Out of curiosity, for your mapping how the “regular” types are mapped?

I assume you're talking about the immediate Operand types defined in
Target.td (i8imm, i32imm, ..): they are members of the namespace, just
like target-defined types. Added a sentence to the doc paragraph.
We can move them to a common namespace should the need arise (it did not).

Attached updated patch, thanks Quentin & Sean!

- Ahmed

> Cheers,
> -Quentin
> On Nov 11, 2013, at 1:42 PM, Ahmed Bougacha <ahmed.bougacha at gmail.com>
> wrote:
> Hi Quentin, all,
> Here's the next patch I had waiting for review.
> In some situations it's very useful to have access to an enum of all
> operand types (that is, instances of Operand in the target's tablegen
> files).
> My use for this is associating MI/SD-pattern level operands with the
> underlying list of MC operand, and keeping track of that association.
> I also sent a nice-to-have feature implemented in another email
> (complete machine operand printing) that was very helpful for
> debugging and testing.
> Thanks!
> - Ahmed
> ---
> docs/WritingAnLLVMBackend.rst       |  3 +++
> utils/TableGen/InstrInfoEmitter.cpp | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+)
> <0001-TableGen-Generate-an-enum-for-all-named-Operand-type.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Updated-doc_0001-TableGen-Generate-an-enum-for-all-named-Operand-type.patch
Type: application/octet-stream
Size: 4919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131116/1d1e3ce2/attachment.obj>

More information about the llvm-commits mailing list