diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-04-15 00:35:48 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-04-15 00:35:48 +0000 |
commit | f111d935722ed488144600cea5ed03a6b5069e8f (patch) | |
tree | b9890fee5ac2d94380e448777c0a49223fbc578d /lib/CodeGen/CGExprAgg.cpp | |
parent | 7e7fbd05a5dfdb0addfc8b5af2fcbed8c7b5fb87 (diff) |
C1X: implement generic selections
As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 4315915c16..6fb9987ecd 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -81,6 +81,9 @@ public: CGF.ErrorUnsupported(S, "aggregate expression"); } void VisitParenExpr(ParenExpr *PE) { Visit(PE->getSubExpr()); } + void VisitGenericSelectionExpr(GenericSelectionExpr *GE) { + Visit(GE->getResultExpr()); + } void VisitUnaryExtension(UnaryOperator *E) { Visit(E->getSubExpr()); } // l-values. @@ -518,9 +521,8 @@ void AggExprEmitter::VisitImplicitValueInitExpr(ImplicitValueInitExpr *E) { /// zero to memory, return true. This can return false if uncertain, so it just /// handles simple cases. static bool isSimpleZero(const Expr *E, CodeGenFunction &CGF) { - // (0) - if (const ParenExpr *PE = dyn_cast<ParenExpr>(E)) - return isSimpleZero(PE->getSubExpr(), CGF); + E = E->IgnoreParens(); + // 0 if (const IntegerLiteral *IL = dyn_cast<IntegerLiteral>(E)) return IL->getValue() == 0; @@ -743,8 +745,7 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { /// non-zero bytes that will be stored when outputting the initializer for the /// specified initializer expression. static uint64_t GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) { - if (const ParenExpr *PE = dyn_cast<ParenExpr>(E)) - return GetNumNonZeroBytesInInit(PE->getSubExpr(), CGF); + E = E->IgnoreParens(); // 0 and 0.0 won't require any non-zero stores! if (isSimpleZero(E, CGF)) return 0; |