- In implementing vector and __vector, which is better?:
A. Don’t make it a keyword, but if LangOptions::AltiVec is set and a kw_identifier with the name “vector” or “__vector” is followed by a numeric type keyword, make the type a vector type.
B. Make vector and __vector a keyword if LangOptions::AltiVec is set, and if not followed by a numeric type keyword, treat it as an identifier.
My guess is that A is better as it involves less fixing up of cases where an identifier with the name of “vector” can occur.
Regarding the typing, I’m thinking internally it would be treated just as if attribute((vector_size(16)) were applied to the type, right?
With attribute((vector_size(16)), does the Clang code generation already output everything LLVM needs to support the Altivec vectors?
For example, in looking at the code generated for some code using an “attribute((vector_size(16)) float” variable or return type, the .ll file uses “<4 x float>”. On a PowerPC platform supporting Altivec, does LLVM automatically know to map that to a vector register?
I’m guessing the Altivec functions can be implemented as Clang built-in functions that map to calls to LLVM’s altivec intrinsic functions, right? I haven’t researched this much yet.
Any suggestions or other things I ought to know at this early point?