Move the special-case check from r240462 into ARM-specific code.
authorBob Wilson <bob.wilson@apple.com>
Wed, 24 Jun 2015 06:05:20 +0000 (06:05 +0000)
committerBob Wilson <bob.wilson@apple.com>
Wed, 24 Jun 2015 06:05:20 +0000 (06:05 +0000)
commit63c931443defca2fb7fa2a54e2ec6933c2e731fe
tree27ed7d24c530dc9bc9870b7d02e035d818bcb1e8
parentee1247be7bce73037758e518162f18225254628f
Move the special-case check from r240462 into ARM-specific code.

This fixes a serious bug in r240462: checking the BuiltinID for
ARM::BI_MoveToCoprocessor* in EmitBuiltinExpr() ignores the fact that
each target has an overlapping range of the BuiltinID values. That check
can trigger for builtins from other targets, leading to very bad
behavior.

Part of the reason I did not implement r240462 this way to begin with is
the special handling of the last argument for Neon builtins. In this
change, I have factored out the check to see which builtins have that
extra argument into a new HasExtraNeonArgument() function. There is still
some awkwardness in having to check for those builtins in two separate
places, i.e., once to see if the extra argument is present and once to
generate the appropriate IR, but this seems much cleaner than my previous
patch.

llvm-svn: 240522
clang/lib/CodeGen/CGBuiltin.cpp