This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Restricting arguments to intrinsic functions
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Charles Baylis <charles dot baylis at linaro dot org>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 24 Oct 2014 09:44:46 -0500
- Subject: Re: Restricting arguments to intrinsic functions
- Authentication-results: sourceware.org; auth=none
- References: <CADnVucA8f3zHOY_UaFvxNAR-j3D7EDvTPiYpoLEUNJL+8TYZzw at mail dot gmail dot com>
On Thu, Oct 23, 2014 at 06:52:20PM +0100, Charles Baylis wrote:
> ( tl;dr: How do I handle intrinsic or builtin functions where there
> are restrictions on the arguments which can't be represented in a C
> function prototype? Do other ports have this problem, how do they
> solve it? Language extension for C++98 to provide static_assert?)
In the builtin expand, you can get the operands' predicates from the
insn_data array entry for the RTL pattern generated for that builtin.
If the predicate is false, do a copy_to_mode_reg; if then the predicate
is still false, assume it had to be some constant and error out.
This works well; I stole the method from the tile* ports. It may need
tweaks for your port.
Segher