Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: lib/CodeGen/CGExprAgg.cpp

Issue 183973037: Cherry-pick Clang upstream r199830 - Handle va_arg on struct types for the le32 target (PNaCl and E… (Closed) Base URL: http://git.chromium.org/native_client/pnacl-clang.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/CodeGen/le32-vaarg.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===--- CGExprAgg.cpp - Emit LLVM Code from Aggregate Expressions --------===// 1 //===--- CGExprAgg.cpp - Emit LLVM Code from Aggregate Expressions --------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This contains code to emit Aggregate Expr nodes as LLVM code. 10 // This contains code to emit Aggregate Expr nodes as LLVM code.
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 921
922 void AggExprEmitter::VisitChooseExpr(const ChooseExpr *CE) { 922 void AggExprEmitter::VisitChooseExpr(const ChooseExpr *CE) {
923 Visit(CE->getChosenSubExpr()); 923 Visit(CE->getChosenSubExpr());
924 } 924 }
925 925
926 void AggExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { 926 void AggExprEmitter::VisitVAArgExpr(VAArgExpr *VE) {
927 llvm::Value *ArgValue = CGF.EmitVAListRef(VE->getSubExpr()); 927 llvm::Value *ArgValue = CGF.EmitVAListRef(VE->getSubExpr());
928 llvm::Value *ArgPtr = CGF.EmitVAArg(ArgValue, VE->getType()); 928 llvm::Value *ArgPtr = CGF.EmitVAArg(ArgValue, VE->getType());
929 929
930 if (!ArgPtr) { 930 if (!ArgPtr) {
931 CGF.ErrorUnsupported(VE, "aggregate va_arg expression"); 931 // If EmitVAArg fails, we fall back to the LLVM instruction.
932 llvm::Value *Val =
933 Builder.CreateVAArg(ArgValue, CGF.ConvertType(VE->getType()));
934 if (!Dest.isIgnored())
935 Builder.CreateStore(Val, Dest.getAddr());
932 return; 936 return;
933 } 937 }
934 938
935 EmitFinalDestCopy(VE->getType(), CGF.MakeAddrLValue(ArgPtr, VE->getType())); 939 EmitFinalDestCopy(VE->getType(), CGF.MakeAddrLValue(ArgPtr, VE->getType()));
936 } 940 }
937 941
938 void AggExprEmitter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) { 942 void AggExprEmitter::VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E) {
939 // Ensure that we have a slot, but if we already do, remember 943 // Ensure that we have a slot, but if we already do, remember
940 // whether it was externally destructed. 944 // whether it was externally destructed.
941 bool wasExternallyDestructed = Dest.isExternallyDestructed(); 945 bool wasExternallyDestructed = Dest.isExternallyDestructed();
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 // memcpy, as well as the TBAA tags for the members of the struct, in case 1470 // memcpy, as well as the TBAA tags for the members of the struct, in case
1467 // the optimizer wishes to expand it in to scalar memory operations. 1471 // the optimizer wishes to expand it in to scalar memory operations.
1468 llvm::MDNode *TBAAStructTag = CGM.getTBAAStructInfo(Ty); 1472 llvm::MDNode *TBAAStructTag = CGM.getTBAAStructInfo(Ty);
1469 1473
1470 Builder.CreateMemCpy(DestPtr, SrcPtr, 1474 Builder.CreateMemCpy(DestPtr, SrcPtr,
1471 llvm::ConstantInt::get(IntPtrTy, 1475 llvm::ConstantInt::get(IntPtrTy,
1472 TypeInfo.first.getQuantity()), 1476 TypeInfo.first.getQuantity()),
1473 alignment.getQuantity(), isVolatile, 1477 alignment.getQuantity(), isVolatile,
1474 /*TBAATag=*/0, TBAAStructTag); 1478 /*TBAATag=*/0, TBAAStructTag);
1475 } 1479 }
OLDNEW
« no previous file with comments | « no previous file | test/CodeGen/le32-vaarg.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698