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

Quentin Colombet qcolombet at apple.com
Mon Nov 18 16:15:49 PST 2013


Hi Ahmed,

On Nov 16, 2013, at 7:41 PM, Ahmed Bougacha <ahmed.bougacha at gmail.com> wrote:

> 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.
Thanks.

> 
>> 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.
Yes, I was talking about those :).

> Added a sentence to the doc paragraph.
Great!

> We can move them to a common namespace should the need arise (it did not).
Agreed.

-Quentin
> 
> 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>
>> 
> <Updated-doc_0001-TableGen-Generate-an-enum-for-all-named-Operand-type.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131118/3769c1be/attachment.html>


More information about the llvm-commits mailing list