[llvm-dev] tablegen generated enums in tablegen
Chris Sears via llvm-dev
llvm-dev at lists.llvm.org
Sun Jun 28 09:06:01 PDT 2020
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> 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 think that this would look something like:
>
> int reg_index = -1;
> ...
> let reg_index = [{ return XX::R8; }]; // or
> let reg_index = [{ {XX::R8} }];
>
> However, then I get 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200628/506e3390/attachment-0001.html>
More information about the llvm-dev
mailing list