summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-21 05:54:00 +0000
committerChris Lattner <sabre@nondot.org>2007-08-21 05:54:00 +0000
commitcbfc73b26c7236a76f789755bf5292940488df98 (patch)
treefb58185217f174bec615da7aa4810433221fadbd /clang/CodeGen/CGStmt.cpp
parent926792f726d91f0cf42a5a7a716a0886522e733a (diff)
downloadbcm5719-llvm-cbfc73b26c7236a76f789755bf5292940488df98.tar.gz
bcm5719-llvm-cbfc73b26c7236a76f789755bf5292940488df98.zip
Split complex arithmetic codegen out from aggregate codegen.
This means that we get rid of tons of intermediate allocas. For example: void foo(double _Complex a, double _Complex b) { a = b+a+a; } this used to have 4 temporary allocas, now it has zero of them. This also simplifies the individual visitor methods because they now can all operate on real/imag pairs instead of having to load/store all over the place. llvm-svn: 41217
Diffstat (limited to 'clang/CodeGen/CGStmt.cpp')
-rw-r--r--clang/CodeGen/CGStmt.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/CodeGen/CGStmt.cpp b/clang/CodeGen/CGStmt.cpp
index 131e2b553c3..c128abcca9c 100644
--- a/clang/CodeGen/CGStmt.cpp
+++ b/clang/CodeGen/CGStmt.cpp
@@ -31,7 +31,9 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
// Must be an expression in a stmt context. Emit the value and ignore the
// result.
if (const Expr *E = dyn_cast<Expr>(S)) {
- if (hasAggregateLLVMType(E->getType()))
+ if (E->getType()->isComplexType()) {
+ EmitComplexExpr(E);
+ } else if (hasAggregateLLVMType(E->getType()))
EmitAggExpr(E, 0, false); // Emit an aggregate, ignoring the result.
else
EmitExpr(E);
OpenPOWER on IntegriCloud