This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Restricting arguments to intrinsic functions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]