[llvm-dev] tablegen generated enums in tablegen
Hal Finkel via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 29 19:39:11 PDT 2020
As a generic note, I don't believe that there are many places within
TableGen's set of code generators that handle 'code' values as
pass-through in the way you hint at below. One place that does is
SearchableTable/GenericTable field values, and that is pretty useful.
-Hal
On 6/28/20 11:06 AM, Chris Sears via llvm-dev wrote:
> I figured out the answer to my problem. I use const MCInstrDesc desc
> = MCII->get(x) to get the same information. It's just that I was
> writing TableGen descriptions and so I thought the answer would be in
> TableGen.
>
> On Sat, Jun 27, 2020 at 10:49 AM Chris Sears <chris.sears at gmail.com
> <mailto:chris.sears at gmail.com>> wrote:
>
> I'd like to store a tablegen generated enumeration in a record
> field/value. Clearly this enumeration isn't available yet so it
> seems that a code fragment should be the escape mechanism I need.
> Looking at the other backends for examples, I see things like
>
> [{ return Imm >= 0 && Imm < 64; }] // promising
> code Requires = [{ {} }]; // this
> looks like a string
> let Requires = [{ {AArch64::FeatureETE} }]. // which is not promising
>
> So I thinkthat this would look something like:
>
> int reg_index = -1;
> ...
> let reg_index = [{ return XX::R8; }]; // or
> let reg_index = [{ {XX::R8} }];
>
> However, thenIget errors of the form:
>
> error: Value 'reg_index' of type 'int' is incompatible with
> initializer '[{ {XX::R8} }]' of type 'code'
> error: Value 'reg_index' of type 'int' is incompatible with
> initializer '[{ return XX::R8; }]' of type 'code'
>
> Is there a way of doing this? I don't understand TableGen casting
> but is that necessary?
>
>
>
> --
> Ite Ursi
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200629/495eda59/attachment.html>
More information about the llvm-dev
mailing list