diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-16 00:20:07 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-16 00:20:07 +0000 |
commit | 474e2fe4957e6e72cee36ed189eaf21878ad0e91 (patch) | |
tree | f34d20ffad53a9e23297fc342f2a98e6588d851f /lib/CodeGen/CGExprAgg.cpp | |
parent | fbcb0ebb51f4b76abaa4a7b30be08c175f723369 (diff) |
Patch to move RequiresGCollection bit to
AggValueSlot slot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprAgg.cpp')
-rw-r--r-- | lib/CodeGen/CGExprAgg.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 9ed20f382e..d28071197c 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -34,13 +34,12 @@ class AggExprEmitter : public StmtVisitor<AggExprEmitter> { CGBuilderTy &Builder; AggValueSlot Dest; bool IgnoreResult; - bool RequiresGCollection; ReturnValueSlot getReturnValueSlot() const { // If the destination slot requires garbage collection, we can't // use the real return value slot, because we have to use the GC // API. - if (RequiresGCollection) return ReturnValueSlot(); + if (Dest.isRequiresGCollection()) return ReturnValueSlot(); return ReturnValueSlot(Dest.getAddr(), Dest.isVolatile()); } @@ -52,9 +51,9 @@ class AggExprEmitter : public StmtVisitor<AggExprEmitter> { public: AggExprEmitter(CodeGenFunction &cgf, AggValueSlot Dest, - bool ignore, bool requiresGCollection) + bool ignore) : CGF(cgf), Builder(CGF.Builder), Dest(Dest), - IgnoreResult(ignore), RequiresGCollection(requiresGCollection) { + IgnoreResult(ignore) { } //===--------------------------------------------------------------------===// @@ -178,7 +177,7 @@ bool AggExprEmitter::TypeRequiresGCollection(QualType T) { /// directly into the return value slot. If GC does interfere, a final /// move will be performed. void AggExprEmitter::EmitGCMove(const Expr *E, RValue Src) { - if (RequiresGCollection) { + if (Dest.isRequiresGCollection()) { std::pair<uint64_t, unsigned> TypeInfo = CGF.getContext().getTypeInfo(E->getType()); unsigned long size = TypeInfo.first/8; @@ -211,7 +210,7 @@ void AggExprEmitter::EmitFinalDestCopy(const Expr *E, RValue Src, bool Ignore) { Dest = CGF.CreateAggTemp(E->getType(), "agg.tmp"); } - if (RequiresGCollection) { + if (Dest.isRequiresGCollection()) { std::pair<uint64_t, unsigned> TypeInfo = CGF.getContext().getTypeInfo(E->getType()); unsigned long size = TypeInfo.first/8; @@ -370,13 +369,14 @@ void AggExprEmitter::VisitBinAssign(const BinaryOperator *E) { CGF.EmitAggExpr(E->getRHS(), Slot); CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), Slot.asRValue()); } else { - bool RequiresGCollection = false; + bool GCollection = false; if (CGF.getContext().getLangOptions().getGCMode()) - RequiresGCollection = TypeRequiresGCollection(E->getLHS()->getType()); + GCollection = TypeRequiresGCollection(E->getLHS()->getType()); // Codegen the RHS so that it stores directly into the LHS. - AggValueSlot LHSSlot = AggValueSlot::forLValue(LHS, true); - CGF.EmitAggExpr(E->getRHS(), LHSSlot, false, RequiresGCollection); + AggValueSlot LHSSlot = AggValueSlot::forLValue(LHS, true, + GCollection); + CGF.EmitAggExpr(E->getRHS(), LHSSlot, false); EmitFinalDestCopy(E, LHS, true); } } @@ -646,14 +646,13 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) { // // FIXME: Take Qualifiers object. void CodeGenFunction::EmitAggExpr(const Expr *E, AggValueSlot Slot, - bool IgnoreResult, - bool RequiresGCollection) { + bool IgnoreResult) { assert(E && hasAggregateLLVMType(E->getType()) && "Invalid aggregate expression to emit"); assert((Slot.getAddr() != 0 || Slot.isIgnored()) && "slot has bits but no address"); - AggExprEmitter(*this, Slot, IgnoreResult, RequiresGCollection) + AggExprEmitter(*this, Slot, IgnoreResult) .Visit(const_cast<Expr*>(E)); } |