[cfe-dev] error message for unsupported intrinsic?

Chris Lattner clattner at apple.com
Thu Dec 16 10:28:08 PST 2010


On Dec 16, 2010, at 10:16 AM, Bob Wilson wrote:

> Do we have some mechanism for reporting nice errors messages about processor-specific intrinsics that are not supported for the current target?
> 
> I'm trying to set up a comprehensive test for all the Neon intrinsics in Clang.  I discovered that a few of them (vcvt_f32_f16 and vcvt_f16_f32) are only supported on ARM processors with the half-precision floating-point extension (e.g., Cortex-A9), so I added support for those operations in the ARM backend.  But, when I re-ran the test, I left the -mcpu option set to "cortex-a8" and got this cryptic message:
> 
> fatal error: error in backend: Cannot yet select: intrinsic
>      %llvm.arm.neon.vcvtfp2hf
> 
> It would be better to have an error message from the front-end when an unsupported builtin is used.  The back-end can't give a very helpful error message because the internal LLVM intrinsic name is not necessarily meaningful to the user.  I'm hoping there is already a mechanism in place for checking that.

It turns out that there is!  Check out the !srcloc mechanism that we slap on inline asm calls.  It would make a lot of sense to do the same for builtins when expanding to intrinsics.  Then if we get a selection failure, the backend can pass the sourceloc back through to the fatal error handling stuff (just like inline asm errors) and get a caret pointing to the builtin.
http://llvm.org/docs/LangRef.html#inlineasm

This would be a really great improvement for these kinds of problems.

-Chris





More information about the cfe-dev mailing list