Changeset View
Changeset View
Standalone View
Standalone View
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
Show First 20 Lines • Show All 2,027 Lines • ▼ Show 20 Lines | Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) { | ||||
case CK_LValueBitCast: | case CK_LValueBitCast: | ||||
case CK_ObjCObjectLValueCast: { | case CK_ObjCObjectLValueCast: { | ||||
Address Addr = EmitLValue(E).getAddress(); | Address Addr = EmitLValue(E).getAddress(); | ||||
Addr = Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(DestTy)); | Addr = Builder.CreateElementBitCast(Addr, CGF.ConvertTypeForMem(DestTy)); | ||||
LValue LV = CGF.MakeAddrLValue(Addr, DestTy); | LValue LV = CGF.MakeAddrLValue(Addr, DestTy); | ||||
return EmitLoadOfLValue(LV, CE->getExprLoc()); | return EmitLoadOfLValue(LV, CE->getExprLoc()); | ||||
} | } | ||||
case CK_LValueToRValueBitCast: { | |||||
LValue SourceLVal = CGF.EmitLValue(E); | |||||
Address Addr = Builder.CreateElementBitCast(SourceLVal.getAddress(), | |||||
CGF.ConvertTypeForMem(DestTy)); | |||||
LValue DestLV = CGF.MakeAddrLValue(Addr, DestTy); | |||||
DestLV.setTBAAInfo(TBAAAccessInfo::getMayAliasInfo()); | |||||
return EmitLoadOfLValue(DestLV, CE->getExprLoc()); | |||||
} | |||||
case CK_CPointerToObjCPointerCast: | case CK_CPointerToObjCPointerCast: | ||||
case CK_BlockPointerToObjCPointerCast: | case CK_BlockPointerToObjCPointerCast: | ||||
case CK_AnyPointerToBlockPointerCast: | case CK_AnyPointerToBlockPointerCast: | ||||
case CK_BitCast: { | case CK_BitCast: { | ||||
Value *Src = Visit(const_cast<Expr*>(E)); | Value *Src = Visit(const_cast<Expr*>(E)); | ||||
llvm::Type *SrcTy = Src->getType(); | llvm::Type *SrcTy = Src->getType(); | ||||
llvm::Type *DstTy = ConvertType(DestTy); | llvm::Type *DstTy = ConvertType(DestTy); | ||||
if (SrcTy->isPtrOrPtrVectorTy() && DstTy->isPtrOrPtrVectorTy() && | if (SrcTy->isPtrOrPtrVectorTy() && DstTy->isPtrOrPtrVectorTy() && | ||||
▲ Show 20 Lines • Show All 2,677 Lines • Show Last 20 Lines |