[llvm-dev] tablegen generated enums in tablegen
Chris Sears via llvm-dev
llvm-dev at lists.llvm.org
Sat Jun 27 10:49:09 PDT 2020
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200627/d3708019/attachment.html>
More information about the llvm-dev
mailing list