Go to the documentation of this file.
24 #include "llvm/IR/Constants.h"
25 #include "llvm/IR/Function.h"
26 #include "llvm/IR/GlobalVariable.h"
27 #include "llvm/IR/IntrinsicInst.h"
28 #include "llvm/IR/Intrinsics.h"
29 using namespace clang;
30 using namespace CodeGen;
37 class AggExprEmitter :
public StmtVisitor<AggExprEmitter> {
58 void withReturnValueSlot(
const Expr *E,
63 : CGF(cgf), Builder(CGF.Builder), Dest(Dest),
64 IsResultUnused(IsResultUnused) { }
73 void EmitAggLoadOfLValue(
const Expr *E);
88 void EmitMoveFromReturnSlot(
const Expr *E,
RValue Src);
90 void EmitArrayInit(
Address DestPtr, llvm::ArrayType *AType,
94 if (CGF.
getLangOpts().getGC() && TypeRequiresGCollection(T))
99 bool TypeRequiresGCollection(
QualType T);
105 void Visit(
Expr *E) {
110 void VisitStmt(
Stmt *S) {
115 Visit(
GE->getResultExpr());
132 if (llvm::Value *Result =
ConstantEmitter(CGF).tryEmitConstantExpr(E)) {
141 void VisitDeclRefExpr(
DeclRefExpr *E) { EmitAggLoadOfLValue(E); }
142 void VisitMemberExpr(
MemberExpr *ME) { EmitAggLoadOfLValue(ME); }
143 void VisitUnaryDeref(
UnaryOperator *E) { EmitAggLoadOfLValue(E); }
144 void VisitStringLiteral(
StringLiteral *E) { EmitAggLoadOfLValue(E); }
147 EmitAggLoadOfLValue(E);
150 EmitAggLoadOfLValue(E);
155 void VisitCallExpr(
const CallExpr *E);
156 void VisitStmtExpr(
const StmtExpr *E);
158 void VisitPointerToDataMemberBinaryOperator(
const BinaryOperator *BO);
168 EmitAggLoadOfLValue(E);
176 llvm::Value *outerBegin =
nullptr);
194 void VisitCXXTypeidExpr(
CXXTypeidExpr *E) { EmitAggLoadOfLValue(E); }
201 return EmitFinalDestCopy(E->
getType(), LV);
215 EmitFinalDestCopy(E->
getType(), Res);
227 void AggExprEmitter::EmitAggLoadOfLValue(
const Expr *E) {
236 EmitFinalDestCopy(E->
getType(), LV);
240 bool AggExprEmitter::TypeRequiresGCollection(
QualType T) {
243 if (!RecordTy)
return false;
247 if (isa<CXXRecordDecl>(Record) &&
248 (cast<CXXRecordDecl>(Record)->hasNonTrivialCopyConstructor() ||
249 !cast<CXXRecordDecl>(Record)->hasTrivialDestructor()))
256 void AggExprEmitter::withReturnValueSlot(
259 bool RequiresDestruction =
275 llvm::Value *LifetimeSizePtr =
nullptr;
276 llvm::IntrinsicInst *LifetimeStartInst =
nullptr;
281 llvm::TypeSize
Size =
284 if (LifetimeSizePtr) {
286 cast<llvm::IntrinsicInst>(std::prev(Builder.GetInsertPoint()));
287 assert(LifetimeStartInst->getIntrinsicID() ==
288 llvm::Intrinsic::lifetime_start &&
289 "Last insertion wasn't a lifetime.start?");
305 EmitFinalDestCopy(E->
getType(), Src);
307 if (!RequiresDestruction && LifetimeStartInst) {
318 assert(src.
isAggregate() &&
"value must be aggregate value!");
320 EmitFinalDestCopy(
type, srcLV, EVK_RValue);
337 if (SrcValueKind == EVK_RValue) {
358 EmitCopy(
type, Dest, srcAgg);
394 assert(Array.isSimple() &&
"initializer_list array not a simple lvalue");
395 Address ArrayPtr = Array.getAddress(CGF);
399 assert(
ArrayType &&
"std::initializer_list constructed from non-array");
410 if (!
Field->getType()->isPointerType() ||
420 llvm::Value *
Zero = llvm::ConstantInt::get(CGF.
PtrDiffTy, 0);
421 llvm::Value *IdxStart[] = {
Zero,
Zero };
422 llvm::Value *ArrayStart = Builder.CreateInBoundsGEP(
434 if (
Field->getType()->isPointerType() &&
438 llvm::Value *IdxEnd[] = {
Zero,
Size };
439 llvm::Value *ArrayEnd = Builder.CreateInBoundsGEP(
457 if (isa<ImplicitValueInitExpr>(E))
460 if (
auto *ILE = dyn_cast<InitListExpr>(E)) {
461 if (ILE->getNumInits())
466 if (
auto *Cons = dyn_cast_or_null<CXXConstructExpr>(E))
467 return Cons->getConstructor()->isDefaultConstructor() &&
468 Cons->getConstructor()->isTrivial();
475 void AggExprEmitter::EmitArrayInit(
Address DestPtr, llvm::ArrayType *AType,
479 uint64_t NumArrayElements = AType->getNumElements();
480 assert(NumInitElements <= NumArrayElements);
487 llvm::Value *zero = llvm::ConstantInt::get(CGF.
SizeTy, 0);
488 llvm::Value *indices[] = { zero, zero };
489 llvm::Value *begin = Builder.CreateInBoundsGEP(
501 if (NumInitElements * elementSize.
getQuantity() > 16 &&
506 if (llvm::Constant *C =
Emitter.tryEmitForInitializer(E, AS, ArrayQTy)) {
507 auto GV =
new llvm::GlobalVariable(
510 llvm::GlobalValue::PrivateLinkage, C,
"constinit",
511 nullptr, llvm::GlobalVariable::NotThreadLocal,
516 Address GVAddr(GV, GV->getValueType(), Align);
517 EmitFinalDestCopy(ArrayQTy, CGF.
MakeAddrLValue(GVAddr, ArrayQTy));
528 llvm::Instruction *cleanupDominator =
nullptr;
535 "arrayinit.endOfInit");
536 cleanupDominator = Builder.CreateStore(begin, endOfInit);
547 llvm::Value *one = llvm::ConstantInt::get(CGF.
SizeTy, 1);
554 llvm::Value *element = begin;
557 for (uint64_t i = 0; i != NumInitElements; ++i) {
560 element = Builder.CreateInBoundsGEP(
561 llvmElementType, element, one,
"arrayinit.element");
566 if (endOfInit.
isValid()) Builder.CreateStore(element, endOfInit);
570 Address(element, llvmElementType, elementAlign), elementType);
571 EmitInitializationToLValue(E->
getInit(i), elementLV);
581 if (NumInitElements != NumArrayElements &&
582 !(Dest.
isZeroed() && hasTrivialFiller &&
589 if (NumInitElements) {
590 element = Builder.CreateInBoundsGEP(
591 llvmElementType, element, one,
"arrayinit.start");
592 if (endOfInit.
isValid()) Builder.CreateStore(element, endOfInit);
596 llvm::Value *end = Builder.CreateInBoundsGEP(
597 llvmElementType, begin,
598 llvm::ConstantInt::get(CGF.
SizeTy, NumArrayElements),
"arrayinit.end");
600 llvm::BasicBlock *entryBB = Builder.GetInsertBlock();
605 llvm::PHINode *currentElement =
606 Builder.CreatePHI(element->getType(), 2,
"arrayinit.cur");
607 currentElement->addIncoming(element, entryBB);
618 Address(currentElement, llvmElementType, elementAlign), elementType);
620 EmitInitializationToLValue(filler, elementLV);
622 EmitNullInitializationToLValue(elementLV);
626 llvm::Value *nextElement = Builder.CreateInBoundsGEP(
627 llvmElementType, currentElement, one,
"arrayinit.next");
630 if (endOfInit.
isValid()) Builder.CreateStore(nextElement, endOfInit);
633 llvm::Value *done = Builder.CreateICmpEQ(nextElement, end,
636 Builder.CreateCondBr(done, endBB, bodyBB);
637 currentElement->addIncoming(nextElement, Builder.GetInsertBlock());
668 EmitAggLoadOfLValue(E);
694 if (
auto castE = dyn_cast<CastExpr>(op)) {
695 if (castE->getCastKind() ==
kind)
696 return castE->getSubExpr();
701 void AggExprEmitter::VisitCastExpr(
CastExpr *E) {
702 if (
const auto *ECE = dyn_cast<ExplicitCastExpr>(E))
707 assert(isa<CXXDynamicCastExpr>(E) &&
"CK_Dynamic without a dynamic_cast?");
738 case CK_LValueToRValueBitCast: {
750 llvm::Value *SizeVal = llvm::ConstantInt::get(
753 Builder.CreateMemCpy(DestAddress, SourceAddress, SizeVal);
757 case CK_DerivedToBase:
758 case CK_BaseToDerived:
759 case CK_UncheckedDerivedToBase: {
760 llvm_unreachable(
"cannot perform hierarchy conversion in EmitAggExpr: "
761 "should have been unpacked before we got here");
764 case CK_NonAtomicToAtomic:
765 case CK_AtomicToNonAtomic: {
766 bool isToAtomic = (E->
getCastKind() == CK_NonAtomicToAtomic);
771 if (isToAtomic) std::swap(
atomicType, valueType);
784 (isToAtomic ? CK_AtomicToNonAtomic : CK_NonAtomicToAtomic);
791 "peephole significantly changed types?");
829 return EmitFinalDestCopy(valueType, rvalue);
831 case CK_AddressSpaceConversion:
834 case CK_LValueToRValue:
857 case CK_UserDefinedConversion:
858 case CK_ConstructorConversion:
861 "Implicit cast types must be compatible");
865 case CK_LValueBitCast:
866 llvm_unreachable(
"should not be emitting lvalue bitcast as rvalue");
870 case CK_ArrayToPointerDecay:
871 case CK_FunctionToPointerDecay:
872 case CK_NullToPointer:
873 case CK_NullToMemberPointer:
874 case CK_BaseToDerivedMemberPointer:
875 case CK_DerivedToBaseMemberPointer:
876 case CK_MemberPointerToBoolean:
877 case CK_ReinterpretMemberPointer:
878 case CK_IntegralToPointer:
879 case CK_PointerToIntegral:
880 case CK_PointerToBoolean:
883 case CK_IntegralCast:
884 case CK_BooleanToSignedIntegral:
885 case CK_IntegralToBoolean:
886 case CK_IntegralToFloating:
887 case CK_FloatingToIntegral:
888 case CK_FloatingToBoolean:
889 case CK_FloatingCast:
890 case CK_CPointerToObjCPointerCast:
891 case CK_BlockPointerToObjCPointerCast:
892 case CK_AnyPointerToBlockPointerCast:
893 case CK_ObjCObjectLValueCast:
894 case CK_FloatingRealToComplex:
895 case CK_FloatingComplexToReal:
896 case CK_FloatingComplexToBoolean:
897 case CK_FloatingComplexCast:
898 case CK_FloatingComplexToIntegralComplex:
899 case CK_IntegralRealToComplex:
900 case CK_IntegralComplexToReal:
901 case CK_IntegralComplexToBoolean:
902 case CK_IntegralComplexCast:
903 case CK_IntegralComplexToFloatingComplex:
904 case CK_ARCProduceObject:
905 case CK_ARCConsumeObject:
906 case CK_ARCReclaimReturnedObject:
907 case CK_ARCExtendBlockObject:
908 case CK_CopyAndAutoreleaseBlockObject:
909 case CK_BuiltinFnToFnPtr:
910 case CK_ZeroToOCLOpaqueType:
913 case CK_IntToOCLSampler:
914 case CK_FloatingToFixedPoint:
915 case CK_FixedPointToFloating:
916 case CK_FixedPointCast:
917 case CK_FixedPointToBoolean:
918 case CK_FixedPointToIntegral:
919 case CK_IntegralToFixedPoint:
920 llvm_unreachable(
"cast kind invalid for aggregate types");
924 void AggExprEmitter::VisitCallExpr(
const CallExpr *E) {
926 EmitAggLoadOfLValue(E);
946 void AggExprEmitter::VisitStmtExpr(
const StmtExpr *E) {
960 const char *NameSuffix =
"") {
963 ArgTy = CT->getElementType();
967 "member pointers may only be compared for equality");
969 CGF, LHS, RHS, MPT,
false);
975 llvm::CmpInst::Predicate FCmp;
976 llvm::CmpInst::Predicate SCmp;
977 llvm::CmpInst::Predicate UCmp;
979 CmpInstInfo InstInfo = [&]() -> CmpInstInfo {
980 using FI = llvm::FCmpInst;
981 using II = llvm::ICmpInst;
984 return {
"cmp.lt", FI::FCMP_OLT, II::ICMP_SLT, II::ICMP_ULT};
986 return {
"cmp.gt", FI::FCMP_OGT, II::ICMP_SGT, II::ICMP_UGT};
988 return {
"cmp.eq", FI::FCMP_OEQ, II::ICMP_EQ, II::ICMP_EQ};
990 llvm_unreachable(
"Unrecognised CompareKind enum");
994 return Builder.CreateFCmp(InstInfo.FCmp, LHS, RHS,
995 llvm::Twine(InstInfo.Name) + NameSuffix);
999 return Builder.CreateICmp(Inst, LHS, RHS,
1000 llvm::Twine(InstInfo.Name) + NameSuffix);
1003 llvm_unreachable(
"unsupported aggregate binary expression should have "
1004 "already been handled");
1008 using llvm::BasicBlock;
1009 using llvm::PHINode;
1016 "cannot copy non-trivially copyable aggregate");
1028 auto EmitOperand = [&](
Expr *E) -> std::pair<Value *, Value *> {
1037 auto LHSValues = EmitOperand(E->
getLHS()),
1038 RHSValues = EmitOperand(E->
getRHS());
1041 Value *Cmp =
EmitCompare(Builder, CGF, E, LHSValues.first, RHSValues.first,
1042 K, IsComplex ?
".r" :
"");
1047 RHSValues.second, K,
".i");
1048 return Builder.CreateAnd(Cmp, CmpImag,
"and.eq");
1051 return Builder.getInt(VInfo->getIntValue());
1059 Builder.CreateSelect(EmitCmp(
CK_Less), EmitCmpRes(CmpInfo.
getLess()),
1061 Select = Builder.CreateSelect(EmitCmp(
CK_Equal),
1063 SelectOne,
"sel.eq");
1065 Value *SelectEq = Builder.CreateSelect(
1070 SelectEq,
"sel.gt");
1071 Select = Builder.CreateSelect(
1072 EmitCmp(
CK_Less), EmitCmpRes(CmpInfo.
getLess()), SelectGT,
"sel.lt");
1087 void AggExprEmitter::VisitBinaryOperator(
const BinaryOperator *E) {
1089 VisitPointerToDataMemberBinaryOperator(E);
1094 void AggExprEmitter::VisitPointerToDataMemberBinaryOperator(
1097 EmitFinalDestCopy(E->
getType(), LV);
1107 if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
1108 const VarDecl *
var = dyn_cast<VarDecl>(DRE->getDecl());
1109 return (
var &&
var->hasAttr<BlocksAttr>());
1118 if (op->isAssignmentOp() || op->isPtrMemOp())
1122 if (op->getOpcode() == BO_Comma)
1130 = dyn_cast<AbstractConditionalOperator>(E)) {
1136 = dyn_cast<OpaqueValueExpr>(E)) {
1137 if (
const Expr *src = op->getSourceExpr())
1144 }
else if (
const CastExpr *
cast = dyn_cast<CastExpr>(E)) {
1145 if (
cast->getCastKind() == CK_LValueToRValue)
1151 }
else if (
const UnaryOperator *uop = dyn_cast<UnaryOperator>(E)) {
1155 }
else if (
const MemberExpr *mem = dyn_cast<MemberExpr>(E)) {
1171 &&
"Invalid assignment");
1226 EmitFinalDestCopy(E->
getType(), LHS);
1234 void AggExprEmitter::
1249 bool destructNonTrivialCStruct =
1250 !isExternallyDestructed &&
1252 isExternallyDestructed |= destructNonTrivialCStruct;
1261 assert(CGF.
HaveInsertPoint() &&
"expression evaluation ended with no IP!");
1262 CGF.
Builder.CreateBr(ContBlock);
1275 if (destructNonTrivialCStruct)
1282 void AggExprEmitter::VisitChooseExpr(
const ChooseExpr *CE) {
1286 void AggExprEmitter::VisitVAArgExpr(
VAArgExpr *VE) {
1311 if (!wasExternallyDestructed)
1321 void AggExprEmitter::VisitCXXInheritedCtorInitExpr(
1330 AggExprEmitter::VisitLambdaExpr(
LambdaExpr *E) {
1337 llvm::Instruction *CleanupDominator =
nullptr;
1342 i != e; ++i, ++CurField) {
1345 if (CurField->hasCapturedVLAType()) {
1350 EmitInitializationToLValue(*i, LV);
1354 CurField->getType().isDestructedType()) {
1357 if (!CleanupDominator)
1360 llvm::Constant::getNullValue(CGF.
Int8PtrTy),
1372 for (
unsigned i = Cleanups.size(); i != 0; --i)
1376 if (CleanupDominator)
1377 CleanupDominator->eraseFromParent();
1404 case CK_UserDefinedConversion:
1405 case CK_ConstructorConversion:
1411 case CK_BooleanToSignedIntegral:
1412 case CK_FloatingCast:
1413 case CK_FloatingComplexCast:
1414 case CK_FloatingComplexToBoolean:
1415 case CK_FloatingComplexToIntegralComplex:
1416 case CK_FloatingComplexToReal:
1417 case CK_FloatingRealToComplex:
1418 case CK_FloatingToBoolean:
1419 case CK_FloatingToIntegral:
1420 case CK_IntegralCast:
1421 case CK_IntegralComplexCast:
1422 case CK_IntegralComplexToBoolean:
1423 case CK_IntegralComplexToFloatingComplex:
1424 case CK_IntegralComplexToReal:
1425 case CK_IntegralRealToComplex:
1426 case CK_IntegralToBoolean:
1427 case CK_IntegralToFloating:
1429 case CK_IntegralToPointer:
1430 case CK_PointerToIntegral:
1432 case CK_VectorSplat:
1434 case CK_NonAtomicToAtomic:
1435 case CK_AtomicToNonAtomic:
1438 case CK_BaseToDerivedMemberPointer:
1439 case CK_DerivedToBaseMemberPointer:
1440 case CK_MemberPointerToBoolean:
1441 case CK_NullToMemberPointer:
1442 case CK_ReinterpretMemberPointer:
1446 case CK_AnyPointerToBlockPointerCast:
1447 case CK_BlockPointerToObjCPointerCast:
1448 case CK_CPointerToObjCPointerCast:
1449 case CK_ObjCObjectLValueCast:
1450 case CK_IntToOCLSampler:
1451 case CK_ZeroToOCLOpaqueType:
1455 case CK_FixedPointCast:
1456 case CK_FixedPointToBoolean:
1457 case CK_FixedPointToFloating:
1458 case CK_FixedPointToIntegral:
1459 case CK_FloatingToFixedPoint:
1460 case CK_IntegralToFixedPoint:
1464 case CK_AddressSpaceConversion:
1465 case CK_BaseToDerived:
1466 case CK_DerivedToBase:
1468 case CK_NullToPointer:
1469 case CK_PointerToBoolean:
1474 case CK_ARCConsumeObject:
1475 case CK_ARCExtendBlockObject:
1476 case CK_ARCProduceObject:
1477 case CK_ARCReclaimReturnedObject:
1478 case CK_CopyAndAutoreleaseBlockObject:
1479 case CK_ArrayToPointerDecay:
1480 case CK_FunctionToPointerDecay:
1481 case CK_BuiltinFnToFnPtr:
1483 case CK_LValueBitCast:
1484 case CK_LValueToRValue:
1485 case CK_LValueToRValueBitCast:
1486 case CK_UncheckedDerivedToBase:
1489 llvm_unreachable(
"Unhandled clang::CastKind enum");
1497 while (
auto *CE = dyn_cast<CastExpr>(E)) {
1505 return IL->getValue() == 0;
1508 return FL->getValue().isPosZero();
1510 if ((isa<ImplicitValueInitExpr>(E) || isa<CXXScalarValueInitExpr>(E)) &&
1514 if (
const CastExpr *ICE = dyn_cast<CastExpr>(E))
1515 return ICE->getCastKind() == CK_NullToPointer &&
1520 return CL->getValue() == 0;
1528 AggExprEmitter::EmitInitializationToLValue(
Expr *E,
LValue LV) {
1535 }
else if (isa<ImplicitValueInitExpr>(E) || isa<CXXScalarValueInitExpr>(E)) {
1536 return EmitNullInitializationToLValue(LV);
1537 }
else if (isa<NoInitExpr>(E)) {
1540 }
else if (
type->isReferenceType()) {
1564 llvm_unreachable(
"bad evaluation kind");
1567 void AggExprEmitter::EmitNullInitializationToLValue(
LValue lv) {
1594 void AggExprEmitter::VisitInitListExpr(
InitListExpr *E) {
1601 if (llvm::Constant* C = CGF.
CGM.EmitConstantExpr(E, E->
getType(), &CGF)) {
1602 llvm::GlobalVariable* GV =
1603 new llvm::GlobalVariable(CGF.
CGM.
getModule(),
C->getType(),
true,
1638 llvm::Instruction *cleanupDominator =
nullptr;
1641 if (!cleanupDominator)
1647 unsigned curInitIndex = 0;
1650 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(record)) {
1651 assert(E->
getNumInits() >= CXXRD->getNumBases() &&
1652 "missing initializer for base class");
1653 for (
auto &
Base : CXXRD->bases()) {
1654 assert(!
Base.isVirtual() &&
"should not see vbases here");
1655 auto *BaseRD =
Base.getType()->getAsCXXRecordDecl();
1668 Base.getType().isDestructedType()) {
1687 for (
const auto *Field : record->
fields())
1688 assert(
Field->isUnnamedBitfield() &&
"Only unnamed bitfields allowed");
1697 if (NumInitElements) {
1699 EmitInitializationToLValue(E->
getInit(0), FieldLoc);
1702 EmitNullInitializationToLValue(FieldLoc);
1710 for (
const auto *field : record->
fields()) {
1712 if (field->getType()->isIncompleteArrayType())
1716 if (field->isUnnamedBitfield())
1722 if (curInitIndex == NumInitElements && Dest.
isZeroed() &&
1731 if (curInitIndex < NumInitElements) {
1733 EmitInitializationToLValue(E->
getInit(curInitIndex++), LV);
1736 EmitNullInitializationToLValue(LV);
1742 bool pushedCleanup =
false;
1744 = field->getType().isDestructedType()) {
1750 pushedCleanup =
true;
1756 if (!pushedCleanup && LV.
isSimple())
1757 if (llvm::GetElementPtrInst *GEP =
1758 dyn_cast<llvm::GetElementPtrInst>(LV.
getPointer(CGF)))
1759 if (GEP->use_empty())
1760 GEP->eraseFromParent();
1765 assert((cleanupDominator || cleanups.empty()) &&
1766 "Missing cleanupDominator before deactivating cleanup blocks");
1767 for (
unsigned i = cleanups.size(); i != 0; --i)
1771 if (cleanupDominator)
1772 cleanupDominator->eraseFromParent();
1776 llvm::Value *outerBegin) {
1781 uint64_t numElements = E->
getArraySize().getZExtValue();
1787 llvm::Value *zero = llvm::ConstantInt::get(CGF.
SizeTy, 0);
1788 llvm::Value *indices[] = {zero, zero};
1789 llvm::Value *begin = Builder.CreateInBoundsGEP(
1806 llvm::BasicBlock *entryBB = Builder.GetInsertBlock();
1811 llvm::PHINode *index =
1812 Builder.CreatePHI(zero->getType(), 2,
"arrayinit.index");
1813 index->addIncoming(zero, entryBB);
1814 llvm::Value *element =
1815 Builder.CreateInBoundsGEP(llvmElementType, begin, index);
1821 if (outerBegin->getType() != element->getType())
1822 outerBegin = Builder.CreateBitCast(outerBegin, element->getType());
1838 Address(element, llvmElementType, elementAlign), elementType);
1846 AggExprEmitter(CGF, elementSlot,
false)
1847 .VisitArrayInitLoopExpr(InnerLoop, outerBegin);
1849 EmitInitializationToLValue(E->
getSubExpr(), elementLV);
1853 llvm::Value *nextIndex = Builder.CreateNUWAdd(
1854 index, llvm::ConstantInt::get(CGF.
SizeTy, 1),
"arrayinit.next");
1855 index->addIncoming(nextIndex, Builder.GetInsertBlock());
1858 llvm::Value *done = Builder.CreateICmpEQ(
1859 nextIndex, llvm::ConstantInt::get(CGF.
SizeTy, numElements),
1862 Builder.CreateCondBr(done, endBB, bodyBB);
1875 EmitInitializationToLValue(E->
getBase(), DestLV);
1887 if (
auto *MTE = dyn_cast<MaterializeTemporaryExpr>(E))
1888 E = MTE->getSubExpr();
1898 ILE = dyn_cast<InitListExpr>(ILE->
getInit(0));
1906 if (!RT->isUnionType()) {
1910 unsigned ILEElement = 0;
1911 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(SD))
1912 while (ILEElement != CXXRD->getNumBases())
1915 for (
const auto *Field : SD->
fields()) {
1918 if (Field->getType()->isIncompleteArrayType() ||
1921 if (Field->isUnnamedBitfield())
1927 if (Field->getType()->isReferenceType())
1934 return NumNonZeroBytes;
1940 for (
unsigned i = 0, e = ILE->
getNumInits(); i != e; ++i)
1942 return NumNonZeroBytes;
1959 const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
1972 if (NumNonZeroBytes*4 > Size)
1976 llvm::Constant *SizeVal = CGF.
Builder.getInt64(Size.getQuantity());
1995 "Invalid aggregate expression to emit");
1997 "slot has bits but no address");
2002 AggExprEmitter(*
this, Slot, Slot.
isIgnored()).Visit(
const_cast<Expr*
>(E));
2048 getContext().getASTRecordLayout(BaseRD).getSize() <=
2072 "Trying to aggregate-copy a type without a trivial copy/move "
2073 "constructor or assignment operator");
2082 if (
getTargetHooks().emitCUDADeviceBuiltinSurfaceDeviceCopy(*
this, Dest,
2086 if (
getTargetHooks().emitCUDADeviceBuiltinTextureDeviceCopy(*
this, Dest,
2112 llvm::Value *SizeVal =
nullptr;
2115 if (
auto *VAT = dyn_cast_or_null<VariableArrayType>(
2121 SizeVal =
Builder.CreateNUWMul(
2173 Inst->setMetadata(llvm::LLVMContext::MD_tbaa_struct, TBAAStructTag);
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
@ PCK_Struct
The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor)
isTypeConstant - Determine whether an object of this type can be emitted as a constant.
@ InternalLinkage
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
llvm::Type * ConvertTypeForMem(QualType T)
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
EmitComplexExprIntoLValue - Emit the given expression of complex type and place its result into the s...
void callCStructCopyConstructor(LValue Dst, LValue Src)
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
bool isRecordType() const
llvm::IntegerType * SizeTy
llvm::Value * getTypeSize(QualType Ty)
Returns calculated size of the specified type.
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
field_iterator field_begin() const
void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst, llvm::Value **Result=nullptr)
EmitStoreThroughBitfieldLValue - Store Src into Dst with same constraints as EmitStoreThroughLValue.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
llvm::PointerType * Int8PtrTy
void EmitNullInitialization(Address DestPtr, QualType Ty)
EmitNullInitialization - Generate code to set a value of the given type to null, If the type contains...
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
llvm::Constant * EmitNullConstant(QualType T)
Return the result of value-initializing the given type, i.e.
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
NeedsGCBarriers_t requiresGCollection() const
llvm::Value * getPointer() const
static RValue getAggregate(Address addr, bool isVolatile=false)
void EmitAggregateStore(llvm::Value *Val, Address Dest, bool DestIsVolatile)
Build all the stores needed to initialize an aggregate at Dest with the value Val.
static bool castPreservesZero(const CastExpr *CE)
Determine whether the given cast kind is known to always convert values with all zero bits in their v...
RValue EmitReferenceBindingToExpr(const Expr *E)
Emits a reference binding to the passed in expression.
const Expr * getExpr() const
virtual void EmitGCMemmoveCollectable(CodeGen::CodeGenFunction &CGF, Address DestPtr, Address SrcPtr, llvm::Value *Size)=0
Represents the canonical version of C arrays with a specified constant size.
CharUnits getAlignment() const
Return the alignment of this pointer.
void EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr)
RValue EmitCoyieldExpr(const CoyieldExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
RValue EmitPseudoObjectRValue(const PseudoObjectExpr *e, AggValueSlot slot=AggValueSlot::ignored())
Address getAddress(CodeGenFunction &CGF) const
specific_decl_iterator< FieldDecl > field_iterator
void EmitAtomicStore(RValue rvalue, LValue lvalue, bool isInit)
static bool isBlockVarRef(const Expr *E)
Is the value of the given expression possibly a reference to or into a __block variable?
llvm::Value * emitArrayLength(const ArrayType *arrayType, QualType &baseType, Address &addr)
emitArrayLength - Compute the length of an array, even if it's a VLA, and drill down to the base elem...
Represents a place-holder for an object not to be initialized by anything.
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
const Expr * getSubExpr() const
RValue EmitAnyExpr(const Expr *E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
EmitAnyExpr - Emit code to compute the specified expression which can have any type.
CharUnits getPointerAlign() const
A (possibly-)qualified type.
unsigned getTargetAddressSpace(QualType T) const
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
Expr * getTrueExpr() const
static bool isTrivialFiller(Expr *E)
Determine if E is a trivial array filler, that is, one that is equivalent to zero-initialization.
U cast(CodeGen::Address addr)
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
const ComparisonCategoryInfo & getInfoForType(QualType Ty) const
Return the comparison category information as specified by getCategoryForType(Ty).
ASTContext & getContext() const
Represents a member of a struct/union/class.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
The collection of all-type qualifiers we support.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
llvm::APInt getArraySize() const
RValue EmitCoawaitExpr(const CoawaitExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin, Address arrayEndPointer, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
pushIrregularPartialArrayCleanup - Push an EH cleanup to destroy already-constructed elements of the ...
bool isRealFloatingType() const
Floating point categories.
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parenthese and casts which do not change the value (including ptr->int casts of the sam...
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
Overlap_t mayOverlap() const
CompoundStmt * getSubStmt()
Describes an C or C++ initializer list.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
const LangOptions & getLangOpts() const
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
bool HaveInsertPoint() const
HaveInsertPoint - True if an insertion point is defined.
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
@ EHCleanup
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
Address EmitVAArg(VAArgExpr *VE, Address &VAListAddr)
Generate code to get an argument from the passed in pointer and update it accordingly.
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
llvm::Value * EmitDynamicCast(Address V, const CXXDynamicCastExpr *DCE)
llvm::AllocaInst * CreateTempAlloca(llvm::Type *Ty, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr)
CreateTempAlloca - This creates an alloca and inserts it into the entry block if ArraySize is nullptr...
Represents a loop initializing the elements of an array.
@ TCK_Store
Checking the destination of a store. Must be suitably sized and aligned.
RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, ReturnValueSlot Return=ReturnValueSlot())
CXXTemporary * getTemporary()
Address CreateStructGEP(Address Addr, unsigned Index, const llvm::Twine &Name="")
void pushLifetimeExtendedDestroy(CleanupKind kind, Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
void setExternallyDestructed(bool destructed=true)
bool isTransparent() const
Is this a transparent initializer list (that is, an InitListExpr that is purely syntactic,...
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
const ValueInfo * getUnordered() const
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g....
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
The scope of a CXXDefaultInitExpr.
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
A C++ throw-expression (C++ [except.throw]).
AggValueSlot::Overlap_t getOverlapForFieldInit(const FieldDecl *FD)
Determine whether a field initialization may overlap some other object.
void pushFullExprCleanup(CleanupKind kind, As... A)
pushFullExprCleanup - Push a cleanup to be run at the end of the current full-expression.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
bool isCUDADeviceBuiltinTextureType() const
Check if the type is the CUDA device builtin texture type.
ReturnValueSlot - Contains the address where the return value of a function can be stored,...
static llvm::Value * EmitCompare(CGBuilderTy &Builder, CodeGenFunction &CGF, const BinaryOperator *E, llvm::Value *LHS, llvm::Value *RHS, CompareKind Kind, const char *NameSuffix="")
bool isReferenceType() const
const AstTypeMatcher< AtomicType > atomicType
Matches atomic types.
void EmitCXXConstructExpr(const CXXConstructExpr *E, AggValueSlot Dest)
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited.
void setVolatile(bool flag)
static bool hasScalarEvaluationKind(QualType T)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
void setZeroed(bool V=true)
virtual llvm::Value * EmitMemberPointerComparison(CodeGenFunction &CGF, llvm::Value *L, llvm::Value *R, const MemberPointerType *MPT, bool Inequality)
Emit a comparison between two member pointers. Returns an i1.
A rewritten comparison expression that was originally written using operator syntax.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored.
Represents binding an expression to a temporary.
const CXXRecordDecl * Record
The declaration for the comparison category type from the standard library.
LangAS getAddressSpace() const
Return the address space of this type.
const Expr * getSubExpr() const
A builtin binary operation expression such as "x + y" or "x <= y".
bool isNullPtrType() const
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Scope - A scope is a transient data structure that is used while parsing the program.
bool isPaddedAtomicType(QualType type)
AggValueSlot CreateAggTemp(QualType T, const Twine &Name="tmp", Address *Alloca=nullptr)
CreateAggTemp - Create a temporary memory object for the given aggregate type.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
Expr * getReplacement() const
const CodeGenOptions & getCodeGenOpts() const
llvm::PointerType * getType() const
Return the type of the pointer value.
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
const T * getAs() const
Member-template getAs<specific type>'.
const TargetInfo & getTarget() const
RValue EmitAtomicExpr(AtomicExpr *E)
void Visit(PTR(Stmt) S, ParamTys... P)
void pushRegularPartialArrayCleanup(llvm::Value *arrayBegin, llvm::Value *arrayEnd, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
pushRegularPartialArrayCleanup - Push an EH cleanup to destroy already-constructed elements of the gi...
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
void EmitBranchOnBoolExpr(const Expr *Cond, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock, uint64_t TrueCount, Stmt::Likelihood LH=Stmt::LH_None)
EmitBranchOnBoolExpr - Emit a branch on a boolean condition (e.g.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
static CharUnits One()
One - Construct a CharUnits quantity of one.
llvm::Module & getModule() const
void callCStructMoveAssignmentOperator(LValue Dst, LValue Src)
CleanupKind getCleanupKind(QualType::DestructionKind kind)
Expr * getFalseExpr() const
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Represents an implicitly-generated value initialization of an object of a given type.
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind.
ComparisonCategories CompCategories
Types and expressions required to build C++2a three-way comparisons using operator<=>,...
bool Zero(InterpState &S, CodePtr OpPC)
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
void EmitLambdaVLACapture(const VariableArrayType *VAT, LValue LV)
Represents a variable declaration or definition.
StringLiteral - This represents a string literal expression, e.g.
void EmitInheritedCXXConstructorCall(const CXXConstructorDecl *D, bool ForVirtualBase, Address This, bool InheritedFromVBase, const CXXInheritedCtorInitExpr *E)
Emit a call to a constructor inherited from a base class, passing the current constructor's arguments...
static constexpr Variable var(Literal L)
Returns the variable of L.
IsAliased_t isPotentiallyAliased() const
RValue EmitAtomicLoad(LValue LV, SourceLocation SL, AggValueSlot Slot=AggValueSlot::ignored())
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
static void CheckAggExprForMemSetUse(AggValueSlot &Slot, const Expr *E, CodeGenFunction &CGF)
CheckAggExprForMemSetUse - If the initializer is large and has a lot of zeros in it,...
Address EmitCompoundStmt(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
EmitCompoundStmt - Emit a compound statement {..} node.
void EmitCXXTemporary(const CXXTemporary *Temporary, QualType TempType, Address Ptr)
Emits all the code to cause the given temporary to be cleaned up.
static Expr * findPeephole(Expr *op, CastKind kind, const ASTContext &ctx)
Attempt to look through various unimportant expressions to find a cast of the given kind.
LValue EmitAggExprToLValue(const Expr *E)
EmitAggExprToLValue - Emit the computation of the specified expression of aggregate type into a tempo...
bool isAnyComplexType() const
bool isAtomicType() const
ASTContext & getContext() const
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
void callCStructCopyAssignmentOperator(LValue Dst, LValue Src)
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
void DeactivateCleanupBlock(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *DominatingIP)
DeactivateCleanupBlock - Deactivates the given cleanup block.
Represents a call to an inherited base class constructor from an inheriting constructor.
A default argument (C++ [dcl.fct.default]).
static TypeEvaluationKind getEvaluationKind(QualType T)
getEvaluationKind - Return the TypeEvaluationKind of QualType T.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
An object to manage conditionally-evaluated expressions.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
An expression that sends a message to the given Objective-C object or class.
RValue EmitCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue=ReturnValueSlot())
CastKind getCastKind() const
bool isPointerZeroInitializable(QualType T)
Check if the pointer type can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
TBAAAccessInfo getTBAAInfo() const
void callCStructMoveConstructor(LValue Dst, LValue Src)
void EmitIgnoredExpr(const Expr *E)
EmitIgnoredExpr - Emit an expression in a context which ignores the result.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
const Expr * getSubExpr() const
bool LValueIsSuitableForInlineAtomic(LValue Src)
An LValue is a candidate for having its loads and stores be made atomic if we are operating under /vo...
static bool isSimpleZero(const Expr *E, CodeGenFunction &CGF)
isSimpleZero - If emitting this value will obviously just cause a store of zero to memory,...
LangAS
Defines the address space values used by the address space qualifier of QualType.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
const llvm::DataLayout & getDataLayout() const
const T * castAs() const
Member-template castAs<specific type>.
CompoundLiteralExpr - [C99 6.5.2.5].
A scoped helper to set the current debug location to the specified location or preferred location of ...
LValue EmitCheckedLValue(const Expr *E, TypeCheckKind TCK)
Same as EmitLValue but additionally we generate checking code to guard against undefined behavior.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
LValue EmitPseudoObjectLValue(const PseudoObjectExpr *e)
Represents a C++ struct/union/class.
AggValueSlot::Overlap_t getOverlapForBaseInit(const CXXRecordDecl *RD, const CXXRecordDecl *BaseRD, bool IsVirtual)
Determine whether a base class initialization may overlap some other object.
LValue - This represents an lvalue references.
static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF)
GetNumNonZeroBytesInInit - Get an approximate count of the number of non-zero bytes that will be stor...
const TargetCodeGenInfo & getTargetHooks() const
static AggValueSlot forAddr(Address addr, Qualifiers quals, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
forAddr - Make a slot for an aggregate value.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
bool isMemberPointerType() const
bool isPointerType() const
An RAII object to record that we're evaluating a statement expression.
void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)
Emit type info if type of an expression is a variably modified type.
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
InitListExpr * getUpdater() const
llvm::Value * getPointer() const
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Complex values, per C99 6.2.5p11.
void pushDestroy(QualType::DestructionKind dtorKind, Address addr, QualType type)
pushDestroy - Push the standard destructor for the given type as at least a normal cleanup.
const Expr * getExpr() const
Get the initialization expression that will be used.
ParenExpr - This represents a parethesized expression, e.g.
Represents a 'co_yield' expression.
llvm::IntegerType * PtrDiffTy
CGCXXABI & getCXXABI() const
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
This class organizes the cross-function state that is used while generating LLVM code.
field_range fields() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
void EmitAggExpr(const Expr *E, AggValueSlot AS)
EmitAggExpr - Emit the computation of the specified expression of aggregate type.
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12)
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
static AggValueSlot forLValue(const LValue &LV, CodeGenFunction &CGF, IsDestructed_t isDestructed, NeedsGCBarriers_t needsGC, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed, IsSanitizerChecked_t isChecked=IsNotSanitizerChecked)
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
@ TCK_Load
Checking the operand of a load. Must be suitably sized and aligned.
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
Expr * getSubExpr() const
Get the initializer to use for each array element.
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
CodeGenTypes & getTypes() const
Represents a 'co_await' expression.
bool isPartial() const
True iff the comparison is not totally ordered.
llvm::Type * ConvertType(QualType T)
bool hasObjectMember() const
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class....
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
static bool hasAggregateEvaluationKind(QualType T)
IsZeroed_t isZeroed() const
llvm::Type * getElementType() const
Return the type of the values stored in this address.
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
void DecorateInstructionWithTBAA(llvm::Instruction *Inst, TBAAAccessInfo TBAAInfo)
DecorateInstructionWithTBAA - Decorate the instruction with a TBAA tag.
llvm::Value * getPointer(CodeGenFunction &CGF) const
void ErrorUnsupported(const Stmt *S, const char *Type)
ErrorUnsupported - Print out an error that codegen doesn't support the specified stmt yet.
field_iterator field_end() const
Address CreateElementBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Cast the element type of the given address to a different type, preserving information like the align...
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type,...
A pointer to member type per C++ 8.3.3 - Pointers to members.
llvm::Value * EmitLifetimeStart(llvm::TypeSize Size, llvm::Value *Addr)
Emit a lifetime.begin marker if some criteria are satisfied.
[C99 6.4.2.2] - A predefined identifier such as func.
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
LValue EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E)
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
const ValueInfo * getEqualOrEquiv() const
const Expr * getInitializer() const
Expr * getSubExpr() const
LValue getOrCreateOpaqueLValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its LValue mapping if it exists, otherwise create one.
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
static RValue get(llvm::Value *V)
bool GE(InterpState &S, CodePtr OpPC)
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
void EmitAggregateCopy(LValue Dest, LValue Src, QualType EltTy, AggValueSlot::Overlap_t MayOverlap, bool isVolatile=false)
EmitAggregateCopy - Emit an aggregate copy.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
Stmt - This represents one statement.
llvm::Value * getAggregatePointer() const
Address getAddress() const
Represents a C11 generic selection.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type.
IsDestructed_t isExternallyDestructed() const
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
The scope of an ArrayInitLoopExpr.
Qualifiers getQualifiers() const
bool hasVolatileMember(QualType T)
hasVolatileMember - returns true if aggregate type has a volatile member.
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
Represents a call to the builtin function __builtin_va_arg.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
LValue EmitLValue(const Expr *E)
EmitLValue - Emit code to compute a designator that specifies the location of the expression.
RecordDecl * getDecl() const
const Expr * getInit(unsigned Init) const
CharUnits - This is an opaque type for sizes expressed in character units.
TypeInfoChars getTypeInfoInChars(const Type *T) const
bool isZeroInitializable(QualType T)
IsZeroInitializable - Return whether a type can be zero-initialized (in the C++ sense) with an LLVM z...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class....
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
A scope within which we are constructing the fields of an object which might use a CXXDefaultInitExpr...
Address GetAddressOfDirectBaseInCompleteClass(Address Value, const CXXRecordDecl *Derived, const CXXRecordDecl *Base, bool BaseIsVirtual)
GetAddressOfBaseOfCompleteClass - Convert the given pointer to a complete class to the given direct b...
CastKind
CastKind - The kind of operation required for a conversion.
Address CreateMemTemp(QualType T, const Twine &Name="tmp", Address *Alloca=nullptr)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen and cas...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getElementType() const
This represents one expression.
CharUnits getPreferredSize(ASTContext &Ctx, QualType Type) const
Get the preferred size to use when storing a value to this slot.
A use of a default initializer in a constructor or in aggregate initialization.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
const ValueInfo * getLess() const
bool hadArrayRangeDesignator() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
const ValueInfo * getGreater() const
A reference to a declared variable, function, enum, etc.
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
bool isCUDADeviceBuiltinSurfaceType() const
Check if the type is the CUDA device builtin surface type.
Represents a struct/union/class.
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11,...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
unsigned getNumInits() const
LValue EmitLValueForFieldInitialization(LValue Base, const FieldDecl *Field)
EmitLValueForFieldInitialization - Like EmitLValueForField, except that if the Field is a reference,...
Represents a call to a C++ constructor.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
A saved depth on the scope stack.
const LangOptions & getLangOpts() const
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
TBAAAccessInfo mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo, TBAAAccessInfo SrcInfo)
mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the purposes of memory transfer call...
void EmitCXXThrowExpr(const CXXThrowExpr *E, bool KeepInsertionPoint=true)
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
void setNonGC(bool Value)
llvm::MDNode * getTBAAStructInfo(QualType QTy)