This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
- A bogus neon-vfpv3 alias (neon defaults to vfp3)
- armv5/v6
- {fp4/fp5}-{sp/dp}-d16
Next steps:
- Port Clang's FPU/ARCH/EXT parsing to use this library.
- Create a TableGen back-end to generate this information.
- Run this TableGen process regardless of which back-ends are built.
- Expose more information and rename it to TargetDescription.
- Re-factor Clang to use as much of it as possible.
Notes:
- The patter is the same as ARMBuildAttrs, but uses a class instead of global functions. This is due to the fact that we may want later to extend the description abilities and remove the "ARM" from the TargetParser, making it a polymorphic class. For now, we only have target parser usage in target specific area, so it should work ok.
- It's in Support because we don't want to tie to any specific back-end, but the arch-specific knowledge should later be generated by a TableGen back-end on a generic context, so some .td files will be exposed for the architectures supported even if we're not building those back-ends. This is to be done well later.
- The IDs are in the exact same order as before, and the parsing is pretty much in the same way (StringSwitch vs. iteration), so no functional or performance changes should happen.
- Clang's patch is in D9549.
Actually, I'd much rather use .def files if possible. TableGen slows down builds and is hard to understand. Sure, pre-processor macros are hard to reason about, but they're *still* easier to understand than tablegen.
Also, so long as this library is in Support, and I think it will be here for a while, this FIXME is unactionable because Support cannot depend on TableGen.
I think we can solve any inflexibility of .def files with a separate plain C++ source synonym table, like you currently have.