[cfe-commits] r145747 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGExprAgg.cpp CGValue.h
Eli Friedman
eli.friedman at gmail.com
Fri Dec 2 19:08:41 PST 2011
Author: efriedma
Date: Fri Dec 2 21:08:40 2011
New Revision: 145747
URL: http://llvm.org/viewvc/llvm-project?rev=145747&view=rev
Log:
Add a utility to get a RValue for a given LValue for an aggregate; switch a few places over to it.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGValue.h
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=145747&r1=145746&r2=145747&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Dec 2 21:08:40 2011
@@ -1463,8 +1463,7 @@
cast<CastExpr>(E)->getCastKind() == CK_LValueToRValue) {
LValue L = EmitLValue(cast<CastExpr>(E)->getSubExpr());
assert(L.isSimple());
- args.add(RValue::getAggregate(L.getAddress(), L.isVolatileQualified()),
- type, /*NeedsCopy*/true);
+ args.add(L.asAggregateRValue(), type, /*NeedsCopy*/true);
return;
}
@@ -1518,7 +1517,7 @@
// FIXME: Volatile?
EltRV = RValue::getComplex(LoadComplexFromAddr(LV.getAddress(), false));
else if (CodeGenFunction::hasAggregateLLVMType(EltTy))
- EltRV = RValue::getAggregate(LV.getAddress());
+ EltRV = LV.asAggregateRValue();
else
EltRV = EmitLoadOfLValue(LV);
ExpandTypeToArgs(EltTy, EltRV, Args, IRFuncTy);
@@ -1539,7 +1538,7 @@
// FIXME: Volatile?
FldRV = RValue::getComplex(LoadComplexFromAddr(LV.getAddress(), false));
else if (CodeGenFunction::hasAggregateLLVMType(FT))
- FldRV = RValue::getAggregate(LV.getAddress());
+ FldRV = LV.asAggregateRValue();
else
FldRV = EmitLoadOfLValue(LV);
ExpandTypeToArgs(FT, FldRV, Args, IRFuncTy);
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=145747&r1=145746&r2=145747&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Fri Dec 2 21:08:40 2011
@@ -263,9 +263,7 @@
void AggExprEmitter::EmitFinalDestCopy(const Expr *E, LValue Src, bool Ignore) {
assert(Src.isSimple() && "Can't have aggregate bitfield, vector, etc");
- EmitFinalDestCopy(E, RValue::getAggregate(Src.getAddress(),
- Src.isVolatileQualified()),
- Ignore);
+ EmitFinalDestCopy(E, Src.asAggregateRValue(), Ignore);
}
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/CodeGen/CGValue.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGValue.h?rev=145747&r1=145746&r2=145747&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGValue.h (original)
+++ cfe/trunk/lib/CodeGen/CGValue.h Fri Dec 2 21:08:40 2011
@@ -300,6 +300,11 @@
R.Initialize(type, type.getQualifiers());
return R;
}
+
+ RValue asAggregateRValue() const {
+ // FIMXE: Alignment
+ return RValue::getAggregate(getAddress(), isVolatileQualified());
+ }
};
/// An aggregate value slot.
More information about the cfe-commits
mailing list