CGExprComplex.cpp (193326) | CGExprComplex.cpp (194179) |
---|---|
1//===--- CGExprComplex.cpp - Emit LLVM Code for Complex Exprs -------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 63 unchanged lines hidden (view full) --- 72 return I; 73 } 74 75 /// EmitLoadOfLValue - Given an expression with complex type that represents a 76 /// value l-value, this method emits the address of the l-value, then loads 77 /// and returns the result. 78 ComplexPairTy EmitLoadOfLValue(const Expr *E) { 79 LValue LV = CGF.EmitLValue(E); | 1//===--- CGExprComplex.cpp - Emit LLVM Code for Complex Exprs -------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 63 unchanged lines hidden (view full) --- 72 return I; 73 } 74 75 /// EmitLoadOfLValue - Given an expression with complex type that represents a 76 /// value l-value, this method emits the address of the l-value, then loads 77 /// and returns the result. 78 ComplexPairTy EmitLoadOfLValue(const Expr *E) { 79 LValue LV = CGF.EmitLValue(E); |
80 return EmitLoadOfComplex(LV.getAddress(), LV.isVolatileQualified()); | 80 if (LV.isSimple()) 81 return EmitLoadOfComplex(LV.getAddress(), LV.isVolatileQualified()); 82 83 if (LV.isPropertyRef()) 84 return CGF.EmitObjCPropertyGet(LV.getPropertyRefExpr()).getComplexVal(); 85 86 assert(LV.isKVCRef() && "Unknown LValue type!"); 87 return CGF.EmitObjCPropertyGet(LV.getKVCRefExpr()).getComplexVal(); |
81 } 82 83 /// EmitLoadOfComplex - Given a pointer to a complex value, emit code to load 84 /// the real and imaginary pieces. 85 ComplexPairTy EmitLoadOfComplex(llvm::Value *SrcPtr, bool isVolatile); 86 87 /// EmitStoreOfComplex - Store the specified real/imag parts into the 88 /// specified value pointer. --- 13 unchanged lines hidden (view full) --- 102 return ComplexPairTy(); 103 } 104 ComplexPairTy VisitExpr(Expr *S); 105 ComplexPairTy VisitParenExpr(ParenExpr *PE) { return Visit(PE->getSubExpr());} 106 ComplexPairTy VisitImaginaryLiteral(const ImaginaryLiteral *IL); 107 108 // l-values. 109 ComplexPairTy VisitDeclRefExpr(const Expr *E) { return EmitLoadOfLValue(E); } | 88 } 89 90 /// EmitLoadOfComplex - Given a pointer to a complex value, emit code to load 91 /// the real and imaginary pieces. 92 ComplexPairTy EmitLoadOfComplex(llvm::Value *SrcPtr, bool isVolatile); 93 94 /// EmitStoreOfComplex - Store the specified real/imag parts into the 95 /// specified value pointer. --- 13 unchanged lines hidden (view full) --- 109 return ComplexPairTy(); 110 } 111 ComplexPairTy VisitExpr(Expr *S); 112 ComplexPairTy VisitParenExpr(ParenExpr *PE) { return Visit(PE->getSubExpr());} 113 ComplexPairTy VisitImaginaryLiteral(const ImaginaryLiteral *IL); 114 115 // l-values. 116 ComplexPairTy VisitDeclRefExpr(const Expr *E) { return EmitLoadOfLValue(E); } |
117 ComplexPairTy VisitObjCIvarRefExpr(ObjCIvarRefExpr *E) { 118 return EmitLoadOfLValue(E); 119 } 120 ComplexPairTy VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *E) { 121 return EmitLoadOfLValue(E); 122 } 123 ComplexPairTy VisitObjCKVCRefExpr(ObjCKVCRefExpr *E) { 124 return EmitLoadOfLValue(E); 125 } 126 ComplexPairTy VisitObjCMessageExpr(ObjCMessageExpr *E) { 127 return CGF.EmitObjCMessageExpr(E).getComplexVal(); 128 } |
|
110 ComplexPairTy VisitArraySubscriptExpr(Expr *E) { return EmitLoadOfLValue(E); } 111 ComplexPairTy VisitMemberExpr(const Expr *E) { return EmitLoadOfLValue(E); } 112 113 // FIXME: CompoundLiteralExpr 114 115 ComplexPairTy EmitCast(Expr *Op, QualType DestTy); 116 ComplexPairTy VisitImplicitCastExpr(ImplicitCastExpr *E) { 117 // Unlike for scalars, we don't have to worry about function->ptr demotion --- 399 unchanged lines hidden (view full) --- 517 assert(CGF.getContext().getCanonicalType(E->getLHS()->getType()) == 518 CGF.getContext().getCanonicalType(E->getRHS()->getType()) && 519 "Invalid assignment"); 520 // Emit the RHS. 521 ComplexPairTy Val = Visit(E->getRHS()); 522 523 // Compute the address to store into. 524 LValue LHS = CGF.EmitLValue(E->getLHS()); | 129 ComplexPairTy VisitArraySubscriptExpr(Expr *E) { return EmitLoadOfLValue(E); } 130 ComplexPairTy VisitMemberExpr(const Expr *E) { return EmitLoadOfLValue(E); } 131 132 // FIXME: CompoundLiteralExpr 133 134 ComplexPairTy EmitCast(Expr *Op, QualType DestTy); 135 ComplexPairTy VisitImplicitCastExpr(ImplicitCastExpr *E) { 136 // Unlike for scalars, we don't have to worry about function->ptr demotion --- 399 unchanged lines hidden (view full) --- 536 assert(CGF.getContext().getCanonicalType(E->getLHS()->getType()) == 537 CGF.getContext().getCanonicalType(E->getRHS()->getType()) && 538 "Invalid assignment"); 539 // Emit the RHS. 540 ComplexPairTy Val = Visit(E->getRHS()); 541 542 // Compute the address to store into. 543 LValue LHS = CGF.EmitLValue(E->getLHS()); |
544 545 // Store into it, if simple. 546 if (LHS.isSimple()) { 547 EmitStoreOfComplex(Val, LHS.getAddress(), LHS.isVolatileQualified()); 548 549 // And now return the LHS 550 IgnoreReal = ignreal; 551 IgnoreImag = ignimag; 552 IgnoreRealAssign = ignreal; 553 IgnoreImagAssign = ignimag; 554 return EmitLoadOfComplex(LHS.getAddress(), LHS.isVolatileQualified()); 555 } |
|
525 | 556 |
526 // Store into it. 527 EmitStoreOfComplex(Val, LHS.getAddress(), LHS.isVolatileQualified()); 528 // And now return the LHS | 557 // Otherwise we must have a property setter (no complex vector/bitfields). 558 if (LHS.isPropertyRef()) 559 CGF.EmitObjCPropertySet(LHS.getPropertyRefExpr(), RValue::getComplex(Val)); 560 else 561 CGF.EmitObjCPropertySet(LHS.getKVCRefExpr(), RValue::getComplex(Val)); 562 563 // There is no reload after a store through a method, but we need to restore 564 // the Ignore* flags. |
529 IgnoreReal = ignreal; 530 IgnoreImag = ignimag; 531 IgnoreRealAssign = ignreal; 532 IgnoreImagAssign = ignimag; | 565 IgnoreReal = ignreal; 566 IgnoreImag = ignimag; 567 IgnoreRealAssign = ignreal; 568 IgnoreImagAssign = ignimag; |
533 return EmitLoadOfComplex(LHS.getAddress(), LHS.isVolatileQualified()); | 569 return Val; |
534} 535 536ComplexPairTy ComplexExprEmitter::VisitBinComma(const BinaryOperator *E) { 537 CGF.EmitStmt(E->getLHS()); 538 CGF.EnsureInsertPoint(); 539 return Visit(E->getRHS()); 540} 541 --- 122 unchanged lines hidden --- | 570} 571 572ComplexPairTy ComplexExprEmitter::VisitBinComma(const BinaryOperator *E) { 573 CGF.EmitStmt(E->getLHS()); 574 CGF.EnsureInsertPoint(); 575 return Visit(E->getRHS()); 576} 577 --- 122 unchanged lines hidden --- |