[cfe-commits] r64325 - in /cfe/trunk/lib/CodeGen: CGExpr.cpp CodeGenFunction.h

Daniel Dunbar daniel at zuster.org
Wed Feb 11 12:59:44 PST 2009


Author: ddunbar
Date: Wed Feb 11 14:59:32 2009
New Revision: 64325

URL: http://llvm.org/viewvc/llvm-project?rev=64325&view=rev
Log:
Support IRgen of va_arg of structure as l-value.

Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=64325&r1=64324&r2=64325&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Wed Feb 11 14:59:32 2009
@@ -137,6 +137,8 @@
   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::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());

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=64325&r1=64324&r2=64325&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Feb 11 14:59:32 2009
@@ -555,8 +555,10 @@
 
   // 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);





More information about the cfe-commits mailing list