REPOSITORY
  rL LLVM

================
Comment at: lib/Basic/Targets.cpp:1217
@@ -1204,1 +1216,3 @@
+    .Case("IsISA207Up", IsPwr8Up)
+    .Case("Is64Bit", Is64Bit)
     .Default(false);
----------------
nemanjai wrote:
> wschmidt wrote:
> > mmm, even if we keep this approach, I'm not sure about the Is64Bit one.  
> > Surely these aren't the only built-ins that only work for 64-bit.  If 
> > you're going to add this it needs to be complete and consistent, which is 
> > far more than what you're going for here.  My inclination is to leave it 
> > out and consider whether a full patch for this is sensible down the road.
> I will investigate whether other 64-bit only builtins provide any diagnostics 
> if used in code that is compiled at 32-bit. Thanks for bringing this up.
OK, as it turns out, this seems to largely be ignored by other targets (and we 
do not seem to have any builtins implemented that are available on 64-bit only.
I personally feel that diagnosing this is better than just letting the back end 
crash.
Example from Arm:

```
$ cat t.c 
void test_clrex() {
  __builtin_arm_clrex();
}
$ clang t.c --target=arm-apple-ios7.0 -c
fatal error: error in backend: Cannot select: intrinsic %llvm.arm.clrex
clang: error: clang frontend command failed with exit code 70 (use -v to see 
invocation)
clang version 3.7.0 (trunk 231831) (llvm/trunk 231828:231843M)
Target: arm-apple-ios7.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to 
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and 
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/t-4a719a.c
clang: note: diagnostic msg: /tmp/t-4a719a.sh
clang: note: diagnostic msg: 

********************

```
Similar example with this changeset:

```
$ cat a.c 
long long test_divde(void) {
  return __builtin_divde(74LL, 32LL);
}
$ clang a.c -c --target=powerpc-unknown-unknown -mcpu=pwr7
a.c:2:10: error: This builtin is only available on 64-bit targets
  return __builtin_divde(74LL, 32LL);
         ^
1 error generated.

```
I personally feel that a diagnostic identifying the problem is more helpful to 
the user than a message that the back end crashed and suggestion to open a bug 
report.

http://reviews.llvm.org/D8398

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to