diff options
author | Nate Begeman <natebegeman@mac.com> | 2009-01-18 03:20:47 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2009-01-18 03:20:47 +0000 |
commit | 59b5da6d853b4368b984700315adf7b37de05764 (patch) | |
tree | a87909833d6430bb5abcd31c866393a438fc67a8 /lib/Sema | |
parent | 77ecb3a28f21496ecfdbb3d5f5b66b0d2abf48c9 (diff) |
Support evaluation of vector constant expressions, and codegen of same.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62455 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 82c8ea099d..cff01c6530 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2187,11 +2187,9 @@ bool Sema::CheckArithmeticConstantExpression(const Expr* Init) { } bool Sema::CheckForConstantInitializer(Expr *Init, QualType DclT) { - Expr::EvalResult Result; - Init = Init->IgnoreParens(); - if (Init->Evaluate(Result, Context) && !Result.HasSideEffects) + if (Init->isEvaluatable(Context)) return false; // Look through CXXDefaultArgExprs; they have no meaning in this context. diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 7d08132cd6..2bc6ff2f12 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -2925,13 +2925,14 @@ QualType Sema::CheckVectorCompareOperands(Expr *&lex, Expr *&rex, return lType; const VectorType *VTy = lType->getAsVectorType(); - - // FIXME: need to deal with non-32b int / non-64b long long unsigned TypeSize = Context.getTypeSize(VTy->getElementType()); - if (TypeSize == 32) { + if (TypeSize == Context.getTypeSize(Context.IntTy)) return Context.getExtVectorType(Context.IntTy, VTy->getNumElements()); - } - assert(TypeSize == 64 && "Unhandled vector element size in vector compare"); + else if (TypeSize == Context.getTypeSize(Context.LongTy)) + return Context.getExtVectorType(Context.LongTy, VTy->getNumElements()); + + assert(TypeSize == Context.getTypeSize(Context.LongLongTy) && + "Unhandled vector element size in vector compare"); return Context.getExtVectorType(Context.LongLongTy, VTy->getNumElements()); } |