[PATCH] Teach intrinsics to report their required target features

Justin Bogner mail at justinbogner.com
Fri May 29 17:15:45 PDT 2015


This implements a way to look up the required target feature for a
particular target-specific intrinsic so that frontends can detect and
report unsupported target intrinsics, rather than emitting them and then
crashing later in SelectionDAG.

I'll follow this up with a change in clang that calls into this when
lowering intrinsics in CGBuiltin and checks if a required feature is
available using clang::TargetInfo::hasFeature.

This ends up being a very simple and unobtrusive way to do this, and
gives nice error messages instead of crashing and burning when somebody
uses (for example) the wrong GCC builtin for their specific target.

The first patch is the tablegen change and the update to the intrinsics
API, the other two are mostly-complete updates to the X86 and ARM
intrinsics tablegen files to show what this looks like. Assuming
everyone's happy with the approach, I'll clean those up and audit them
for correctness before they go in.

Okay to go ahead with this?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-IR-Teach-intrinsics-to-report-their-required-target-.patch
Type: text/x-patch
Size: 5966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/15e317d7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-wip-Categorize-IntrinsicsX86-with-TargetFeatures.patch
Type: text/x-patch
Size: 58815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/15e317d7/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-wip-Categorize-IntrinsicsARM-with-TargetFeatures.patch
Type: text/x-patch
Size: 3165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/15e317d7/attachment-0002.bin>


More information about the llvm-commits mailing list