[llvm-dev] TableGen 'code' type to be eliminated

Aaron Ballman via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 20 10:08:23 PST 2020


On Fri, Nov 20, 2020 at 12:33 PM Madhur Amilkanthwar via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> Well, it is not semantically different but having "code" in .td files does make the files readble to me, at least. It distinctly tells me that the value of the field is a C++ code which needs to be grammatically correct. This extra semantics associated with "code" is appealing for readibility.

+1 to this -- we use `code` in Attr.td (for instance) to distinguish
between arbitrary string data and data that is intended to have some
valid syntax (whether it's C++ or otherwise) that will be checked
elsewhere. It wouldn't be the end of the world to lose the clarity
there, but it also doesn't seem like there's a large maintenance
burden to continuing to support it either (unless I'm missing
something).

~Aaron

>
> On Fri, Nov 20, 2020, 10:22 PM Paul C. Anagnostopoulos via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>>
>> We are seriously considering eliminating the 'code' type from TableGen. The 'code' type is used to represent code sequences, which are specified with the [{ ... }] brackets. The bracket syntax will be retained, but the type distinction will be eliminated.
>>
>> A code sequence is stored as a string, but with the type of 'code'. Some string operations, such as the paste operator (#), work on code, too. But other operations, such as !strconcat and !eq, do not. There does not appear to be any reason to maintain the distinction between string and code, except when formatting the value of a field. We will retain the two formats "..." and [{...}] when printing a field value.
>>
>> I have checked all the TableGen backends and none appear to make any semantic distinction between strings and code.
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list