Support IRgen of va_arg of structure as l-value.

llvm-svn: 64325
This commit is contained in:
Daniel Dunbar 2009-02-11 20:59:32 +00:00
parent 88ceac46de
commit 8d9dc4a6d5
2 changed files with 12 additions and 2 deletions

View File

@ -137,6 +137,8 @@ LValue CodeGenFunction::EmitLValue(const Expr *E) {
case Expr::CallExprClass:
case Expr::CXXOperatorCallExprClass:
return EmitCallExprLValue(cast<CallExpr>(E));
case Expr::VAArgExprClass:
return EmitVAArgExprLValue(cast<VAArgExpr>(E));
case Expr::DeclRefExprClass:
case Expr::QualifiedDeclRefExprClass:
return EmitDeclRefLValue(cast<DeclRefExpr>(E));
@ -996,11 +998,17 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
LValue CodeGenFunction::EmitCallExprLValue(const CallExpr *E) {
// Can only get l-value for call expression returning aggregate type
RValue RV = EmitCallExpr(E);
// FIXME: can this be volatile?
return LValue::MakeAddr(RV.getAggregateAddr(),
E->getType().getCVRQualifiers());
}
LValue CodeGenFunction::EmitVAArgExprLValue(const VAArgExpr *E) {
// FIXME: This shouldn't require another copy.
llvm::Value *Temp = CreateTempAlloca(ConvertType(E->getType()));
EmitAggExpr(E, Temp, false);
return LValue::MakeAddr(Temp, E->getType().getCVRQualifiers());
}
LValue
CodeGenFunction::EmitCXXConditionDeclLValue(const CXXConditionDeclExpr *E) {
EmitLocalBlockVarDecl(*E->getVarDecl());

View File

@ -555,8 +555,10 @@ public:
// Note: only availabe for agg return types
LValue EmitBinaryOperatorLValue(const BinaryOperator *E);
// Note: only availabe for agg return types
// Note: only available for agg return types
LValue EmitCallExprLValue(const CallExpr *E);
// Note: only available for agg return types
LValue EmitVAArgExprLValue(const VAArgExpr *E);
LValue EmitDeclRefLValue(const DeclRefExpr *E);
LValue EmitStringLiteralLValue(const StringLiteral *E);
LValue EmitPredefinedFunctionName(unsigned Type);