[cfe-commits] r118899 - /cfe/trunk/lib/CodeGen/Mangle.cpp

Bob Wilson bob.wilson at apple.com
Fri Nov 12 22:59:55 PST 2010


Oh, I missed the getTypeSize method!  I'll commit a patch for that soon.  I'm working on making this complete enough that I can add some tests for it.

On Nov 12, 2010, at 9:24 AM, Bob Wilson wrote:

> Author: bwilson
> Date: Fri Nov 12 11:24:49 2010
> New Revision: 118899
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=118899&view=rev
> Log:
> Use ASTContext::getTypeInfo to find the vector element size.
> 
> Modified:
>    cfe/trunk/lib/CodeGen/Mangle.cpp
> 
> Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=118899&r1=118898&r2=118899&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
> +++ cfe/trunk/lib/CodeGen/Mangle.cpp Fri Nov 12 11:24:49 2010
> @@ -1411,30 +1411,30 @@
>   QualType EltType = T->getElementType();
>   if (!EltType->isBuiltinType())
>     return false;
> -  unsigned EltBits = 0;
>   const char *EltName = 0;
>   if (T->getVectorKind() == VectorType::NeonPolyVector) {
>     switch (cast<BuiltinType>(EltType)->getKind()) {
> -    case BuiltinType::SChar:     EltBits =  8; EltName = "poly8_t"; break;
> -    case BuiltinType::Short:     EltBits = 16; EltName = "poly16_t"; break;
> +    case BuiltinType::SChar:     EltName = "poly8_t"; break;
> +    case BuiltinType::Short:     EltName = "poly16_t"; break;
>     default: return false;
>     }
>   } else {
>     switch (cast<BuiltinType>(EltType)->getKind()) {
> -    case BuiltinType::SChar:     EltBits =  8; EltName = "int8_t"; break;
> -    case BuiltinType::UChar:     EltBits =  8; EltName = "uint8_t"; break;
> -    case BuiltinType::Short:     EltBits = 16; EltName = "int16_t"; break;
> -    case BuiltinType::UShort:    EltBits = 16; EltName = "uint16_t"; break;
> -    case BuiltinType::Int:       EltBits = 32; EltName = "int32_t"; break;
> -    case BuiltinType::UInt:      EltBits = 32; EltName = "uint32_t"; break;
> -    case BuiltinType::LongLong:  EltBits = 64; EltName = "int64_t"; break;
> -    case BuiltinType::ULongLong: EltBits = 64; EltName = "uint64_t"; break;
> -    case BuiltinType::Float:     EltBits = 32; EltName = "float32_t"; break;
> +    case BuiltinType::SChar:     EltName = "int8_t"; break;
> +    case BuiltinType::UChar:     EltName = "uint8_t"; break;
> +    case BuiltinType::Short:     EltName = "int16_t"; break;
> +    case BuiltinType::UShort:    EltName = "uint16_t"; break;
> +    case BuiltinType::Int:       EltName = "int32_t"; break;
> +    case BuiltinType::UInt:      EltName = "uint32_t"; break;
> +    case BuiltinType::LongLong:  EltName = "int64_t"; break;
> +    case BuiltinType::ULongLong: EltName = "uint64_t"; break;
> +    case BuiltinType::Float:     EltName = "float32_t"; break;
>     default: return false;
>     }
>   }
>   const char *BaseName = 0;
> -  unsigned BitSize = T->getNumElements() * EltBits;
> +  unsigned BitSize = (T->getNumElements() *
> +                      getASTContext().getTypeInfo(EltType).first);
>   if (BitSize == 64)
>     BaseName = "__simd64_";
>   else if (BitSize == 128)
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list