HomePhabricator

[clang] New __attribute__((__clang_arm_mve_alias)).

Authored by simon_tatham on Sep 2 2019, 7:35 AM.

Description

[clang] New attribute((__clang_arm_mve_alias)).

This allows you to declare a function with a name of your choice (say
foo), but have clang treat it as if it were a builtin function (say
__builtin_foo), by writing

static __inline__ __attribute__((__clang_arm_mve_alias(__builtin_foo)))
int foo(args);

I'm intending to use this for the ACLE intrinsics for MVE, which have
to be polymorphic on their argument types and also need to be
implemented by builtins. To avoid having to implement the polymorphism
with several layers of nested _Generic and make error reporting
hideous, I want to make all the user-facing intrinsics correspond
directly to clang builtins, so that after clang resolves
attribute((overloadable)) polymorphism it's already holding the
right BuiltinID for the intrinsic it selected.

However, this commit itself just introduces the new attribute, and
doesn't use it for anything.

To avoid unanticipated side effects if this attribute is used to make
aliases to other builtins, there's a restriction mechanism: only
(BuiltinID, alias) pairs that are approved by the function
ArmMveAliasValid() will be permitted. At present, that function
doesn't permit anything, because the Tablegen that will generate its
list of valid pairs isn't yet implemented. So the only test of this
facility is one that checks that an unapproved builtin _can't_ be
aliased.

Reviewers: dmgreen, miyuki, ostannard

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D67159

Details

Committed
simon_tathamOct 24 2019, 8:33 AM
Differential Revision
D67159: [clang] New __attribute__((__clang_arm_mve_alias)).
Parents
rGe0ef4ebe2f6a: [ARM] Add IR intrinsics for MVE VLD[24] and VST[24].
Branches
Unknown
Tags
Unknown