[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 
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.

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.
 * 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.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9435

Files:
  include/llvm/Support/ARMTargetParser.h
  lib/Support/ARMTargetParser.cpp
  lib/Support/CMakeLists.txt
  lib/Target/ARM/ARMArchExtName.def
  lib/Target/ARM/ARMArchExtName.h
  lib/Target/ARM/ARMAsmPrinter.cpp
  lib/Target/ARM/ARMFPUName.def
  lib/Target/ARM/ARMFPUName.h
  lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  lib/Target/ARM/MCTargetDesc/ARMArchName.def
  lib/Target/ARM/MCTargetDesc/ARMArchName.h
  lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- 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/llvm-commits/attachments/20150501/50fbcd3b/attachment.bin>


More information about the llvm-commits mailing list