[PATCH] D28080: [Docs][OpenCL] Added OpenCL feature description to user manual.

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 23 09:14:53 PST 2017


Anastasia added a comment.

> (I should pass -finclude-default-header after -cc1 without -Xclang then it works, but I think also the
>  latter version should work, no?)

In general -cc1 and -Xclang have similar effect so I either should work indeed.

> Also, I cannot add -S (even with -emit-llvm), then it complains about a missing target:
> 
>   $ clang -cc1 -triple spir64-unknown-unknown ~/temp/local.cl -S
>   error: unable to create target: 'No available targets are compatible with this triple.'
> 
> 
> I think -S used to work with -emit-llvm as a switch to output LLVM text instead of bitcode, but now it seems to
>  output text by default so it should not be used.

I think this has to do with spir being a 'generic' target.

> Is there are reason to use/document the -cc1 -triple instead of
>  -target here?

Yes, because in some cases we have added frontend flag only, so we need to either pass -cc1 or -Xclang. But I could change the documentation to try to pass -target before the -cc1 flag.

> Also, for me the command without -emit-llvm doesn't output anything.

What targets do you use? I think the problem is that it's not clear what the default output of the standalone compiler should be for the most of the OpenCL targets, since it does't produce a valid binary. If let's say we emit an x86 binary, would it be valid to run it for POCL directly?  Perhaps, we could try to emit the bitcode by default then.

Currently if I run:

  clang test.cl

I get an error:  undefined reference to `main'. But if I add a main (which isn't really valid for OpenCL) I get:
error: function cannot be called 'main'


https://reviews.llvm.org/D28080





More information about the cfe-commits mailing list