[PATCH] TargetParser prototype - NFC (ARM only)

Renato Golin renato.golin at linaro.org
Fri May 1 08:45:24 PDT 2015

Hi echristo, t.p.northover, rnk,

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 

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,

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.

 * 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.
 * I'll use this new class in Clang before committing to LLVM, to make sure it works there, too. I can't see why not, but I'd rather be sure. After the Clang patch has been reviewed, I'll commit both at the same time.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9435.24803.patch
Type: text/x-patch
Size: 24649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150501/50fbcd3b/attachment.bin>

More information about the cfe-commits mailing list