diff options
author | John McCall <rjmccall@apple.com> | 2010-09-15 10:14:12 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-09-15 10:14:12 +0000 |
commit | 558d2abc7f9fd6801cc7677200992313ae90b5d8 (patch) | |
tree | 7624495cd37a259daceff9065f500f9522cbd775 /lib/CodeGen/CodeGenFunction.h | |
parent | 8f3b834471b158d65d490e3458fa16ba659ec105 (diff) |
one piece of code is responsible for the lifetime of every aggregate
slot. The easiest way to do that was to bundle up the information
we care about for aggregate slots into a new structure which demands
that its creators at least consider the question.
I could probably be convinced that the ObjC 'needs GC' bit should
be rolled into this structure.
Implement generalized copy elision. The main obstacle here is that
IR-generation must be much more careful about making sure that exactly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 715be3ce17..d19827bf4f 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -1024,6 +1024,12 @@ public: /// appropriate alignment. llvm::AllocaInst *CreateMemTemp(QualType T, const llvm::Twine &Name = "tmp"); + /// CreateAggTemp - Create a temporary memory object for the given + /// aggregate type. + AggValueSlot CreateAggTemp(QualType T, const llvm::Twine &Name = "tmp") { + return AggValueSlot::forAddr(CreateMemTemp(T, Name), false, false); + } + /// EvaluateExprAsBool - Perform the usual unary conversions on the specified /// expression and compare the result against zero, returning an Int1Ty value. llvm::Value *EvaluateExprAsBool(const Expr *E); @@ -1034,9 +1040,9 @@ public: /// the result should be returned. /// /// \param IgnoreResult - True if the resulting value isn't used. - RValue EmitAnyExpr(const Expr *E, llvm::Value *AggLoc = 0, - bool IsAggLocVolatile = false, bool IgnoreResult = false, - bool IsInitializer = false); + RValue EmitAnyExpr(const Expr *E, + AggValueSlot AggSlot = AggValueSlot::ignored(), + bool IgnoreResult = false); // EmitVAListRef - Emit a "reference" to a va_list; this is either the address // or the value of the expression, depending on how va_list is defined. @@ -1044,14 +1050,13 @@ public: /// EmitAnyExprToTemp - Similary to EmitAnyExpr(), however, the result will /// always be accessible even if no aggregate location is provided. - RValue EmitAnyExprToTemp(const Expr *E, bool IsAggLocVolatile = false, - bool IsInitializer = false); + RValue EmitAnyExprToTemp(const Expr *E); /// EmitsAnyExprToMem - Emits the code necessary to evaluate an /// arbitrary expression into the given memory location. void EmitAnyExprToMem(const Expr *E, llvm::Value *Location, - bool IsLocationVolatile = false, - bool IsInitializer = false); + bool IsLocationVolatile, + bool IsInitializer); /// EmitAggregateCopy - Emit an aggrate copy. /// @@ -1254,7 +1259,7 @@ public: bool EmitSimpleStmt(const Stmt *S); RValue EmitCompoundStmt(const CompoundStmt &S, bool GetLast = false, - llvm::Value *AggLoc = 0, bool isAggVol = false); + AggValueSlot AVS = AggValueSlot::ignored()); /// EmitLabel - Emit the block for the given label. It is legal to call this /// function even if there is no current insertion point. @@ -1543,11 +1548,10 @@ public: QualType DstTy); - /// EmitAggExpr - Emit the computation of the specified expression of - /// aggregate type. The result is computed into DestPtr. Note that if - /// DestPtr is null, the value of the aggregate expression is not needed. - void EmitAggExpr(const Expr *E, llvm::Value *DestPtr, bool VolatileDest, - bool IgnoreResult = false, bool IsInitializer = false, + /// EmitAggExpr - Emit the computation of the specified expression + /// of aggregate type. The result is computed into the given slot, + /// which may be null to indicate that the value is not needed. + void EmitAggExpr(const Expr *E, AggValueSlot AS, bool IgnoreResult = false, bool RequiresGCollection = false); /// EmitAggExprToLValue - Emit the computation of the specified expression of @@ -1617,12 +1621,11 @@ public: void GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn, const VarDecl *D); - void EmitCXXConstructExpr(llvm::Value *Dest, const CXXConstructExpr *E); + void EmitCXXConstructExpr(const CXXConstructExpr *E, AggValueSlot Dest); RValue EmitCXXExprWithTemporaries(const CXXExprWithTemporaries *E, - llvm::Value *AggLoc = 0, - bool IsAggLocVolatile = false, - bool IsInitializer = false); + AggValueSlot Slot + = AggValueSlot::ignored()); void EmitCXXThrowExpr(const CXXThrowExpr *E); |