[cfe-dev] TreeTransform: QualType for OpenCL float4

Christoph Viebig (lists) lists at christoph-viebig.de
Fri Jan 23 03:27:52 PST 2015


Hi Sameer,

thanks again for your answer :)
Unfortunately it turns out that this doesn't work.
So the print out is still: float data __attribute__((ext_vector_type(4)))
But I could imagine from the use of the method that it can be used to register
type aliases like in C++ typedef. But I might be wrong though.

I will try to look on it later today again. Maybe I'll find something in the
Parser or so.

Best
Christoph

> "Sahasrabuddhe, Sameer" <Sameer.Sahasrabuddhe at amd.com> hat am 22. Januar 2015
> um 19:46 geschrieben:
>
>
>
> Sema::addImplicitTypedef() seems to be meant for registering a "name" for a
> type, although I have never used it myself! Can't make out if this will help
> your purpose, which is to print "float16" instead of the entire extended
> vector syntax.
>
> Sameer.
> ________________________________________
> From: Christoph Viebig (lists) [lists at christoph-viebig.de]
> Sent: Thursday, January 22, 2015 5:31 PM
> To: cfe-dev at cs.uiuc.edu; Sahasrabuddhe, Sameer
> Subject: Re: [cfe-dev] TreeTransform: QualType for OpenCL float4
>
> Hi Sameer,
>
> thank you very much for your answer. It indeed works fine, altough it seems
> that
> pointer types can not be converted by
> SemaRef.getASTContext().getExtVectorType(Param->getType(), 4);
> because assert(vecType->isBuiltinType() || vecType->isDependentType()); is
> failing in ASTContext.cpp.
>
> The print method returns for such a transformed ParmVarDecl:
>
> float data __attribute__((ext_vector_type(4)))
>
> which is also reflected in the AST dump:
>
> ParmVarDecl 0x2aa64f0 <line:2:5, col:11> col:11 data 'float
> __attribute__((ext_vector_type(4)))'
>
> If I declare a float16 variable in the program that's parsed the original type
> name is preserved (float16):
> 'float16':'float __attribute__((ext_vector_type(16)))'
>
> as you can see here:
>
> DeclStmt 0x2aa63e0 <line:4:5, col:26>
> `-VarDecl 0x2aa6350 <col:5,
> ../libclc/generic/include/clc/float/definitions.h:1:25>
> demoMinReductionKernel.cl:4:13 agg 'float16':'float
> __attribute__((ext_vector_type(16)))' cinit
> `-ImplicitCastExpr 0x2aa63c8
> <../libclc/generic/include/clc/float/definitions.h:1:25> 'float16':'float
> __attribute__((ext_vector_type(16)))' <VectorSplat>
> `-FloatingLiteral 0x2aa63a8 <col:25> 'float' 3.402823e+38
>
> Do you now if there is some sort of alias that needs to be modified or set as
> well?
>
> Best regards
> Christoph



More information about the cfe-dev mailing list