[cfe-commits] r41468 - in /cfe/trunk/CodeGen: CGExpr.cpp CGStmt.cpp CodeGenFunction.h
Chris Lattner
sabre at nondot.org
Sun Aug 26 15:58:06 PDT 2007
Author: lattner
Date: Sun Aug 26 17:58:05 2007
New Revision: 41468
URL: http://llvm.org/viewvc/llvm-project?rev=41468&view=rev
Log:
eliminate EmitAnyExpr, inlining it and simplifying it into its only caller.
Modified:
cfe/trunk/CodeGen/CGExpr.cpp
cfe/trunk/CodeGen/CGStmt.cpp
cfe/trunk/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExpr.cpp?rev=41468&r1=41467&r2=41468&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/CodeGen/CGExpr.cpp Sun Aug 26 17:58:05 2007
@@ -368,27 +368,6 @@
// Expression Emission
//===--------------------------------------------------------------------===//
-/// EmitAnyExpr - Emit an expression of any type: scalar, complex, aggregate,
-/// returning an rvalue corresponding to it. If NeedResult is false, the
-/// result of the expression doesn't need to be generated into memory.
-RValue CodeGenFunction::EmitAnyExpr(const Expr *E, bool NeedResult) {
- if (!hasAggregateLLVMType(E->getType()))
- return RValue::get(EmitScalarExpr(E));
-
- llvm::Value *DestMem = 0;
- if (NeedResult)
- DestMem = CreateTempAlloca(ConvertType(E->getType()));
-
- if (!E->getType()->isComplexType()) {
- EmitAggExpr(E, DestMem, false);
- } else if (NeedResult)
- EmitComplexExprIntoAddr(E, DestMem, false);
- else
- EmitComplexExpr(E);
-
- return RValue::getAggregate(DestMem);
-}
-
RValue CodeGenFunction::EmitCallExpr(const CallExpr *E) {
if (const ImplicitCastExpr *IcExpr =
Modified: cfe/trunk/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGStmt.cpp?rev=41468&r1=41467&r2=41468&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/CodeGen/CGStmt.cpp Sun Aug 26 17:58:05 2007
@@ -28,10 +28,15 @@
switch (S->getStmtClass()) {
default:
- // Must be an expression in a stmt context. Emit the value and ignore the
- // result.
+ // Must be an expression in a stmt context. Emit the value (to get
+ // side-effects) and ignore the result.
if (const Expr *E = dyn_cast<Expr>(S)) {
- EmitAnyExpr(E, false);
+ if (!hasAggregateLLVMType(E->getType()))
+ EmitScalarExpr(E);
+ else if (E->getType()->isComplexType())
+ EmitComplexExpr(E);
+ else
+ EmitAggExpr(E, 0, false);
} else {
printf("Unimplemented stmt!\n");
S->dump();
Modified: cfe/trunk/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CodeGenFunction.h?rev=41468&r1=41467&r2=41468&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/CodeGen/CodeGenFunction.h Sun Aug 26 17:58:05 2007
@@ -328,13 +328,8 @@
RValue EmitCompoundAssignmentResult(const CompoundAssignOperator *E,
LValue LHSLV, RValue ResV);
- /// EmitAnyExpr - Emit an expression of any type: scalar, complex, aggregate,
- /// returning an rvalue corresponding to it. If NeedResult is false, the
- /// result of the expression doesn't need to be generated into memory.
- RValue EmitAnyExpr(const Expr *E, bool NeedResult = true);
-
RValue EmitCallExpr(const CallExpr *E);
- RValue EmitBuiltinExpr(unsigned builtinID, const CallExpr *E);
+ RValue EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E);
llvm::Value *EmitObjCStringLiteral(const ObjCStringLiteral *E);
More information about the cfe-commits
mailing list