[cfe-dev] Target specific info available to Clang (and others)

Renato Golin renato.golin at linaro.org
Thu Oct 23 06:50:56 PDT 2014


So,

In order to fix bug PR20787 (common parsing infrastructure for FPU
options between LLVM and tools), I need to create a parser in LLVM
that has all targets' information (types of fpus, cpus, archs, etc)
but that can also be visible by external tools.

Until now, all that information has been hidden from view by creating
them with TableGen and leave them only visible to the target files.
That makes a lot of sense, but I need some of that exposed.

Including generated files from LLVM works ok, but Clang can't see
them. If I enable Clang to see them (by adding the include dir on the
path), there will be nothing to stop people from including more than
they should.

The kind of information I want to expose are the enums that identify
features, mainly VFP/NEON/Crypto etc. This is in
ARMGenSubtargetInfo.inc under GET_SUBTARGETINFO_ENUM.

One way I could think of, but it's controversial, is to generate two
files: ARMGenSubtargetInfo.inc and  ARMGenSubtargetInfoPublic.inc, the
former in the current directory, the latter in a shared include path
for all tools. That way, not only LLVM, but also Clang, llc, lld etc
would be able to use the same parsing mechanism and understand the
generated data (enums, structures) in the exact same way.

Attached are two pseudo-patches that illustrate the problem. The Clang
patch shows how much more powerful could such infrastructure become.
The patch doesn't compile on Clang because Clang cannot see
ARMGenSubtargetInfo.inc.

References:

http://llvm.org/bugs/show_bug.cgi?id=20787
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-August/038699.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140811/231052.html

cheers,
--renato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpuparse-clang.patch
Type: text/x-patch
Size: 4297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141023/d30ed8f7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpuparse-llvm.patch
Type: text/x-patch
Size: 12467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141023/d30ed8f7/attachment-0001.bin>


More information about the cfe-dev mailing list