23 #include "llvm/IR/Constants.h" 24 #include "llvm/IR/Function.h" 25 #include "llvm/IR/GlobalVariable.h" 26 #include "llvm/IR/IntrinsicInst.h" 27 #include "llvm/IR/Intrinsics.h" 28 using namespace clang;
29 using namespace CodeGen;
36 class AggExprEmitter :
public StmtVisitor<AggExprEmitter> {
57 void withReturnValueSlot(
const Expr *E,
62 : CGF(cgf), Builder(CGF.Builder), Dest(Dest),
63 IsResultUnused(IsResultUnused) { }
72 void EmitAggLoadOfLValue(
const Expr *E);
87 void EmitMoveFromReturnSlot(
const Expr *E,
RValue Src);
89 void EmitArrayInit(
Address DestPtr, llvm::ArrayType *AType,
93 if (CGF.
getLangOpts().getGC() && TypeRequiresGCollection(T))
98 bool TypeRequiresGCollection(
QualType T);
104 void Visit(
Expr *E) {
109 void VisitStmt(
Stmt *S) {
133 void VisitDeclRefExpr(
DeclRefExpr *E) { EmitAggLoadOfLValue(E); }
134 void VisitMemberExpr(
MemberExpr *ME) { EmitAggLoadOfLValue(ME); }
135 void VisitUnaryDeref(
UnaryOperator *E) { EmitAggLoadOfLValue(E); }
136 void VisitStringLiteral(
StringLiteral *E) { EmitAggLoadOfLValue(E); }
139 EmitAggLoadOfLValue(E);
142 EmitAggLoadOfLValue(E);
147 void VisitCallExpr(
const CallExpr *E);
148 void VisitStmtExpr(
const StmtExpr *E);
150 void VisitPointerToDataMemberBinaryOperator(
const BinaryOperator *BO);
160 EmitAggLoadOfLValue(E);
186 void VisitCXXTypeidExpr(
CXXTypeidExpr *E) { EmitAggLoadOfLValue(E); }
193 return EmitFinalDestCopy(E->
getType(), LV);
207 EmitFinalDestCopy(E->
getType(), Res);
219 void AggExprEmitter::EmitAggLoadOfLValue(
const Expr *E) {
228 EmitFinalDestCopy(E->
getType(), LV);
232 bool AggExprEmitter::TypeRequiresGCollection(
QualType T) {
235 if (!RecordTy)
return false;
239 if (isa<CXXRecordDecl>(Record) &&
240 (cast<CXXRecordDecl>(Record)->hasNonTrivialCopyConstructor() ||
241 !cast<CXXRecordDecl>(Record)->hasTrivialDestructor()))
248 void AggExprEmitter::withReturnValueSlot(
251 bool RequiresDestruction =
268 llvm::IntrinsicInst *LifetimeStartInst =
nullptr;
276 if (LifetimeSizePtr) {
278 cast<llvm::IntrinsicInst>(std::prev(Builder.GetInsertPoint()));
279 assert(LifetimeStartInst->getIntrinsicID() ==
280 llvm::Intrinsic::lifetime_start &&
281 "Last insertion wasn't a lifetime.start?");
292 if (RequiresDestruction)
299 EmitFinalDestCopy(E->
getType(), Src);
301 if (!RequiresDestruction && LifetimeStartInst) {
312 assert(src.
isAggregate() &&
"value must be aggregate value!");
314 EmitFinalDestCopy(type, srcLV, EVK_RValue);
318 void AggExprEmitter::EmitFinalDestCopy(
QualType type,
const LValue &src,
331 if (SrcValueKind == EVK_RValue) {
352 EmitCopy(type, Dest, srcAgg);
388 assert(Array.
isSimple() &&
"initializer_list array not a simple lvalue");
393 assert(ArrayType &&
"std::initializer_list constructed from non-array");
404 if (!Field->getType()->isPointerType() ||
405 !Ctx.
hasSameType(Field->getType()->getPointeeType(),
417 Builder.CreateInBoundsGEP(ArrayPtr.getPointer(), IdxStart,
"arraystart");
428 if (Field->getType()->isPointerType() &&
429 Ctx.
hasSameType(Field->getType()->getPointeeType(),
434 Builder.CreateInBoundsGEP(ArrayPtr.getPointer(), IdxEnd,
"arrayend");
451 if (isa<ImplicitValueInitExpr>(E))
454 if (
auto *ILE = dyn_cast<InitListExpr>(E)) {
455 if (ILE->getNumInits())
460 if (
auto *Cons = dyn_cast_or_null<CXXConstructExpr>(E))
461 return Cons->getConstructor()->isDefaultConstructor() &&
462 Cons->getConstructor()->isTrivial();
469 void AggExprEmitter::EmitArrayInit(
Address DestPtr, llvm::ArrayType *AType,
473 uint64_t NumArrayElements = AType->getNumElements();
474 assert(NumInitElements <= NumArrayElements);
484 Builder.CreateInBoundsGEP(DestPtr.
getPointer(), indices,
"arrayinit.begin");
493 if (NumInitElements * elementSize.
getQuantity() > 16 &&
499 auto GV =
new llvm::GlobalVariable(
502 llvm::GlobalValue::PrivateLinkage, C,
"constinit",
503 nullptr, llvm::GlobalVariable::NotThreadLocal,
508 EmitFinalDestCopy(ArrayQTy, CGF.
MakeAddrLValue(GV, ArrayQTy, Align));
519 llvm::Instruction *cleanupDominator =
nullptr;
526 "arrayinit.endOfInit");
527 cleanupDominator = Builder.
CreateStore(begin, endOfInit);
548 for (uint64_t i = 0; i != NumInitElements; ++i) {
551 element = Builder.CreateInBoundsGEP(element, one,
"arrayinit.element");
561 EmitInitializationToLValue(E->
getInit(i), elementLV);
571 if (NumInitElements != NumArrayElements &&
572 !(Dest.
isZeroed() && hasTrivialFiller &&
579 if (NumInitElements) {
580 element = Builder.CreateInBoundsGEP(element, one,
"arrayinit.start");
585 llvm::Value *end = Builder.CreateInBoundsGEP(begin,
586 llvm::ConstantInt::get(CGF.
SizeTy, NumArrayElements),
589 llvm::BasicBlock *entryBB = Builder.GetInsertBlock();
594 llvm::PHINode *currentElement =
595 Builder.CreatePHI(element->getType(), 2,
"arrayinit.cur");
596 currentElement->addIncoming(element, entryBB);
609 EmitInitializationToLValue(filler, elementLV);
611 EmitNullInitializationToLValue(elementLV);
616 Builder.CreateInBoundsGEP(currentElement, one,
"arrayinit.next");
622 llvm::Value *done = Builder.CreateICmpEQ(nextElement, end,
625 Builder.CreateCondBr(done, endBB, bodyBB);
626 currentElement->addIncoming(nextElement, Builder.GetInsertBlock());
657 EmitAggLoadOfLValue(E);
670 if (
CastExpr *castE = dyn_cast<CastExpr>(op)) {
671 if (castE->getCastKind() ==
kind)
672 return castE->getSubExpr();
673 if (castE->getCastKind() == CK_NoOp)
680 void AggExprEmitter::VisitCastExpr(
CastExpr *E) {
681 if (
const auto *ECE = dyn_cast<ExplicitCastExpr>(E))
686 assert(isa<CXXDynamicCastExpr>(E) &&
"CK_Dynamic without a dynamic_cast?");
717 case CK_LValueToRValueBitCast: {
732 Builder.
CreateMemCpy(DestAddress, SourceAddress, SizeVal);
736 case CK_DerivedToBase:
737 case CK_BaseToDerived:
738 case CK_UncheckedDerivedToBase: {
739 llvm_unreachable(
"cannot perform hierarchy conversion in EmitAggExpr: " 740 "should have been unpacked before we got here");
743 case CK_NonAtomicToAtomic:
744 case CK_AtomicToNonAtomic: {
745 bool isToAtomic = (E->
getCastKind() == CK_NonAtomicToAtomic);
750 if (isToAtomic) std::swap(atomicType, valueType);
763 (isToAtomic ? CK_AtomicToNonAtomic : CK_NonAtomicToAtomic);
769 "peephole significantly changed types?");
807 return EmitFinalDestCopy(valueType, rvalue);
809 case CK_AddressSpaceConversion:
812 case CK_LValueToRValue:
824 case CK_UserDefinedConversion:
825 case CK_ConstructorConversion:
828 "Implicit cast types must be compatible");
832 case CK_LValueBitCast:
833 llvm_unreachable(
"should not be emitting lvalue bitcast as rvalue");
837 case CK_ArrayToPointerDecay:
838 case CK_FunctionToPointerDecay:
839 case CK_NullToPointer:
840 case CK_NullToMemberPointer:
841 case CK_BaseToDerivedMemberPointer:
842 case CK_DerivedToBaseMemberPointer:
843 case CK_MemberPointerToBoolean:
844 case CK_ReinterpretMemberPointer:
845 case CK_IntegralToPointer:
846 case CK_PointerToIntegral:
847 case CK_PointerToBoolean:
850 case CK_IntegralCast:
851 case CK_BooleanToSignedIntegral:
852 case CK_IntegralToBoolean:
853 case CK_IntegralToFloating:
854 case CK_FloatingToIntegral:
855 case CK_FloatingToBoolean:
856 case CK_FloatingCast:
857 case CK_CPointerToObjCPointerCast:
858 case CK_BlockPointerToObjCPointerCast:
859 case CK_AnyPointerToBlockPointerCast:
860 case CK_ObjCObjectLValueCast:
861 case CK_FloatingRealToComplex:
862 case CK_FloatingComplexToReal:
863 case CK_FloatingComplexToBoolean:
864 case CK_FloatingComplexCast:
865 case CK_FloatingComplexToIntegralComplex:
866 case CK_IntegralRealToComplex:
867 case CK_IntegralComplexToReal:
868 case CK_IntegralComplexToBoolean:
869 case CK_IntegralComplexCast:
870 case CK_IntegralComplexToFloatingComplex:
871 case CK_ARCProduceObject:
872 case CK_ARCConsumeObject:
873 case CK_ARCReclaimReturnedObject:
874 case CK_ARCExtendBlockObject:
875 case CK_CopyAndAutoreleaseBlockObject:
876 case CK_BuiltinFnToFnPtr:
877 case CK_ZeroToOCLOpaqueType:
879 case CK_IntToOCLSampler:
880 case CK_FixedPointCast:
881 case CK_FixedPointToBoolean:
882 case CK_FixedPointToIntegral:
883 case CK_IntegralToFixedPoint:
884 llvm_unreachable(
"cast kind invalid for aggregate types");
888 void AggExprEmitter::VisitCallExpr(
const CallExpr *E) {
890 EmitAggLoadOfLValue(E);
910 void AggExprEmitter::VisitStmtExpr(
const StmtExpr *E) {
924 const char *NameSuffix =
"") {
927 ArgTy = CT->getElementType();
931 "member pointers may only be compared for equality");
933 CGF, LHS, RHS, MPT,
false);
939 llvm::CmpInst::Predicate FCmp;
940 llvm::CmpInst::Predicate SCmp;
941 llvm::CmpInst::Predicate UCmp;
943 CmpInstInfo InstInfo = [&]() -> CmpInstInfo {
944 using FI = llvm::FCmpInst;
945 using II = llvm::ICmpInst;
948 return {
"cmp.lt", FI::FCMP_OLT, II::ICMP_SLT, II::ICMP_ULT};
950 return {
"cmp.gt", FI::FCMP_OGT, II::ICMP_SGT, II::ICMP_UGT};
952 return {
"cmp.eq", FI::FCMP_OEQ, II::ICMP_EQ, II::ICMP_EQ};
954 llvm_unreachable(
"Unrecognised CompareKind enum");
958 return Builder.CreateFCmp(InstInfo.FCmp, LHS, RHS,
959 llvm::Twine(InstInfo.Name) + NameSuffix);
963 return Builder.CreateICmp(Inst, LHS, RHS,
964 llvm::Twine(InstInfo.Name) + NameSuffix);
967 llvm_unreachable(
"unsupported aggregate binary expression should have " 968 "already been handled");
972 using llvm::BasicBlock;
980 "cannot copy non-trivially copyable aggregate");
984 if (!ArgTy->isIntegralOrEnumerationType() && !ArgTy->isRealFloatingType() &&
985 !ArgTy->isNullPtrType() && !ArgTy->isPointerType() &&
986 !ArgTy->isMemberPointerType() && !ArgTy->isAnyComplexType()) {
989 bool IsComplex = ArgTy->isAnyComplexType();
992 auto EmitOperand = [&](
Expr *E) -> std::pair<Value *, Value *> {
1001 auto LHSValues = EmitOperand(E->
getLHS()),
1002 RHSValues = EmitOperand(E->
getRHS());
1005 Value *Cmp =
EmitCompare(Builder, CGF, E, LHSValues.first, RHSValues.first,
1006 K, IsComplex ?
".r" :
"");
1011 RHSValues.second, K,
".i");
1012 return Builder.CreateAnd(Cmp, CmpImag,
"and.eq");
1015 return Builder.getInt(VInfo->getIntValue());
1019 if (ArgTy->isNullPtrType()) {
1023 Builder.CreateSelect(EmitCmp(
CK_Less), EmitCmpRes(CmpInfo.
getLess()),
1025 Select = Builder.CreateSelect(EmitCmp(
CK_Equal),
1027 SelectOne,
"sel.eq");
1029 Value *SelectEq = Builder.CreateSelect(
1034 SelectEq,
"sel.gt");
1035 Select = Builder.CreateSelect(
1036 EmitCmp(
CK_Less), EmitCmpRes(CmpInfo.
getLess()), SelectGT,
"sel.lt");
1051 void AggExprEmitter::VisitBinaryOperator(
const BinaryOperator *E) {
1053 VisitPointerToDataMemberBinaryOperator(E);
1058 void AggExprEmitter::VisitPointerToDataMemberBinaryOperator(
1061 EmitFinalDestCopy(E->
getType(), LV);
1071 if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
1073 return (var && var->
hasAttr<BlocksAttr>());
1082 if (op->isAssignmentOp() || op->isPtrMemOp())
1086 if (op->getOpcode() == BO_Comma)
1094 = dyn_cast<AbstractConditionalOperator>(E)) {
1100 = dyn_cast<OpaqueValueExpr>(E)) {
1101 if (
const Expr *src = op->getSourceExpr())
1108 }
else if (
const CastExpr *
cast = dyn_cast<CastExpr>(E)) {
1109 if (
cast->getCastKind() == CK_LValueToRValue)
1115 }
else if (
const UnaryOperator *uop = dyn_cast<UnaryOperator>(E)) {
1119 }
else if (
const MemberExpr *mem = dyn_cast<MemberExpr>(E)) {
1135 &&
"Invalid assignment");
1151 if (LHS.getType()->isAtomicType() ||
1190 EmitFinalDestCopy(E->
getType(), LHS);
1193 void AggExprEmitter::
1215 assert(CGF.
HaveInsertPoint() &&
"expression evaluation ended with no IP!");
1216 CGF.
Builder.CreateBr(ContBlock);
1232 void AggExprEmitter::VisitChooseExpr(
const ChooseExpr *CE) {
1236 void AggExprEmitter::VisitVAArgExpr(
VAArgExpr *VE) {
1261 if (!wasExternallyDestructed)
1271 void AggExprEmitter::VisitCXXInheritedCtorInitExpr(
1280 AggExprEmitter::VisitLambdaExpr(
LambdaExpr *E) {
1287 llvm::Instruction *CleanupDominator =
nullptr;
1292 i != e; ++i, ++CurField) {
1295 if (CurField->hasCapturedVLAType()) {
1300 EmitInitializationToLValue(*i, LV);
1304 CurField->getType().isDestructedType()) {
1307 if (!CleanupDominator)
1310 llvm::Constant::getNullValue(CGF.
Int8PtrTy),
1322 for (
unsigned i = Cleanups.size(); i != 0; --i)
1326 if (CleanupDominator)
1327 CleanupDominator->eraseFromParent();
1356 return IL->getValue() == 0;
1359 return FL->getValue().isPosZero();
1361 if ((isa<ImplicitValueInitExpr>(E) || isa<CXXScalarValueInitExpr>(E)) &&
1365 if (
const CastExpr *ICE = dyn_cast<CastExpr>(E))
1366 return ICE->getCastKind() == CK_NullToPointer &&
1371 return CL->getValue() == 0;
1379 AggExprEmitter::EmitInitializationToLValue(
Expr *E,
LValue LV) {
1386 }
else if (isa<ImplicitValueInitExpr>(E) || isa<CXXScalarValueInitExpr>(E)) {
1387 return EmitNullInitializationToLValue(LV);
1388 }
else if (isa<NoInitExpr>(E)) {
1415 llvm_unreachable(
"bad evaluation kind");
1418 void AggExprEmitter::EmitNullInitializationToLValue(
LValue lv) {
1445 void AggExprEmitter::VisitInitListExpr(
InitListExpr *E) {
1452 if (llvm::Constant* C = CGF.
CGM.EmitConstantExpr(E, E->
getType(), &CGF)) {
1453 llvm::GlobalVariable* GV =
1454 new llvm::GlobalVariable(CGF.
CGM.
getModule(), C->getType(),
true,
1489 llvm::Instruction *cleanupDominator =
nullptr;
1492 if (!cleanupDominator)
1498 unsigned curInitIndex = 0;
1501 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(record)) {
1502 assert(E->
getNumInits() >= CXXRD->getNumBases() &&
1503 "missing initializer for base class");
1504 for (
auto &
Base : CXXRD->bases()) {
1505 assert(!
Base.isVirtual() &&
"should not see vbases here");
1506 auto *BaseRD =
Base.getType()->getAsCXXRecordDecl();
1519 Base.getType().isDestructedType()) {
1538 for (
const auto *Field : record->
fields())
1539 assert(Field->isUnnamedBitfield() &&
"Only unnamed bitfields allowed");
1548 if (NumInitElements) {
1550 EmitInitializationToLValue(E->
getInit(0), FieldLoc);
1553 EmitNullInitializationToLValue(FieldLoc);
1561 for (
const auto *field : record->
fields()) {
1563 if (field->getType()->isIncompleteArrayType())
1567 if (field->isUnnamedBitfield())
1573 if (curInitIndex == NumInitElements && Dest.
isZeroed() &&
1582 if (curInitIndex < NumInitElements) {
1584 EmitInitializationToLValue(E->
getInit(curInitIndex++), LV);
1587 EmitNullInitializationToLValue(LV);
1593 bool pushedCleanup =
false;
1595 = field->getType().isDestructedType()) {
1601 pushedCleanup =
true;
1607 if (!pushedCleanup && LV.
isSimple())
1608 if (llvm::GetElementPtrInst *GEP =
1609 dyn_cast<llvm::GetElementPtrInst>(LV.
getPointer(CGF)))
1610 if (GEP->use_empty())
1611 GEP->eraseFromParent();
1616 assert((cleanupDominator || cleanups.empty()) &&
1617 "Missing cleanupDominator before deactivating cleanup blocks");
1618 for (
unsigned i = cleanups.size(); i != 0; --i)
1622 if (cleanupDominator)
1623 cleanupDominator->eraseFromParent();
1632 uint64_t numElements = E->
getArraySize().getZExtValue();
1640 llvm::Value *begin = Builder.CreateInBoundsGEP(destPtr.getPointer(), indices,
1655 llvm::BasicBlock *entryBB = Builder.GetInsertBlock();
1660 llvm::PHINode *index =
1661 Builder.CreatePHI(zero->getType(), 2,
"arrayinit.index");
1662 index->addIncoming(zero, entryBB);
1663 llvm::Value *element = Builder.CreateInBoundsGEP(begin, index);
1669 if (outerBegin->getType() != element->getType())
1670 outerBegin = Builder.
CreateBitCast(outerBegin, element->getType());
1694 AggExprEmitter(CGF, elementSlot,
false)
1695 .VisitArrayInitLoopExpr(InnerLoop, outerBegin);
1697 EmitInitializationToLValue(E->
getSubExpr(), elementLV);
1702 index, llvm::ConstantInt::get(CGF.
SizeTy, 1),
"arrayinit.next");
1703 index->addIncoming(nextIndex, Builder.GetInsertBlock());
1707 nextIndex, llvm::ConstantInt::get(CGF.
SizeTy, numElements),
1710 Builder.CreateCondBr(done, endBB, bodyBB);
1723 EmitInitializationToLValue(E->
getBase(), DestLV);
1744 ILE = dyn_cast<InitListExpr>(ILE->
getInit(0));
1752 if (!RT->isUnionType()) {
1756 unsigned ILEElement = 0;
1757 if (
auto *CXXRD = dyn_cast<CXXRecordDecl>(SD))
1758 while (ILEElement != CXXRD->getNumBases())
1761 for (
const auto *Field : SD->
fields()) {
1764 if (Field->getType()->isIncompleteArrayType() ||
1767 if (Field->isUnnamedBitfield())
1773 if (Field->getType()->isReferenceType())
1780 return NumNonZeroBytes;
1786 for (
unsigned i = 0, e = ILE->
getNumInits(); i != e; ++i)
1788 return NumNonZeroBytes;
1805 const CXXRecordDecl *RD = cast<CXXRecordDecl>(RT->getDecl());
1818 if (NumNonZeroBytes*4 > Size)
1840 assert(E && hasAggregateEvaluationKind(E->
getType()) &&
1841 "Invalid aggregate expression to emit");
1843 "slot has bits but no address");
1848 AggExprEmitter(*
this, Slot, Slot.
isIgnored()).Visit(const_cast<Expr*>(E));
1852 assert(hasAggregateEvaluationKind(E->
getType()) &&
"Invalid argument!");
1871 const ASTRecordLayout &Layout = getContext().getASTRecordLayout(ClassRD);
1873 getContext().getTypeSize(FD->
getType()) <=
1894 getContext().getASTRecordLayout(BaseRD).getSize() <=
1918 "Trying to aggregate-copy a type without a trivial copy/move " 1919 "constructor or assignment operator");
1940 std::pair<CharUnits, CharUnits>
TypeInfo;
1942 TypeInfo = getContext().getTypeInfoDataSizeInChars(Ty);
1944 TypeInfo = getContext().getTypeInfoInChars(Ty);
1947 if (TypeInfo.first.isZero()) {
1949 if (
auto *VAT = dyn_cast_or_null<VariableArrayType>(
1950 getContext().getAsArrayType(Ty))) {
1952 SizeVal = emitArrayLength(VAT, BaseEltTy, DestPtr);
1953 TypeInfo = getContext().getTypeInfoInChars(BaseEltTy);
1954 assert(!TypeInfo.first.isZero());
1955 SizeVal = Builder.CreateNUWMul(
1957 llvm::ConstantInt::get(SizeTy, TypeInfo.first.getQuantity()));
1961 SizeVal = llvm::ConstantInt::get(SizeTy, TypeInfo.first.getQuantity());
1986 CGM.getObjCRuntime().EmitGCMemmoveCollectable(*
this, DestPtr, SrcPtr,
1991 QualType BaseType = getContext().getBaseElementType(Ty);
1994 CGM.getObjCRuntime().EmitGCMemmoveCollectable(*
this, DestPtr, SrcPtr,
2001 auto Inst = Builder.
CreateMemCpy(DestPtr, SrcPtr, SizeVal, isVolatile);
2006 if (llvm::MDNode *TBAAStructTag = CGM.getTBAAStructInfo(Ty))
2007 Inst->setMetadata(llvm::LLVMContext::MD_tbaa_struct, TBAAStructTag);
2009 if (CGM.getCodeGenOpts().NewStructPathTBAA) {
2012 CGM.DecorateInstructionWithTBAA(Inst, TBAAInfo);
const llvm::DataLayout & getDataLayout() const
const Expr * getSubExpr() const
ReturnValueSlot - Contains the address where the return value of a function can be stored...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Address CreateStructGEP(Address Addr, unsigned Index, const llvm::Twine &Name="")
Defines the clang::ASTContext interface.
Expr * getChosenSubExpr() const
getChosenSubExpr - Return the subexpression chosen according to the condition.
Address getAddress() const
void end(CodeGenFunction &CGF)
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
A (possibly-)qualified type.
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
llvm::Type * ConvertTypeForMem(QualType T)
void EmitBranchOnBoolExpr(const Expr *Cond, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock, uint64_t TrueCount)
EmitBranchOnBoolExpr - Emit a branch on a boolean condition (e.g.
RValue EmitCoyieldExpr(const CoyieldExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
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...
void enterFullExpression(const FullExpr *E)
bool HaveInsertPoint() const
HaveInsertPoint - True if an insertion point is defined.
Expr * getResultExpr()
Return the result expression of this controlling expression.
CompoundStmt * getSubStmt()
const Expr * getInit(unsigned Init) const
Stmt - This represents one statement.
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...
llvm::Constant * tryEmitForInitializer(const VarDecl &D)
Try to emit the initiaizer of the given declaration as an abstract constant.
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
NeedsGCBarriers_t requiresGCollection() const
llvm::Value * getPointer() const
bool isRecordType() const
Address EmitVAArg(VAArgExpr *VE, Address &VAListAddr)
Generate code to get an argument from the passed in pointer and update it accordingly.
virtual void EmitGCMemmoveCollectable(CodeGen::CodeGenFunction &CGF, Address DestPtr, Address SrcPtr, llvm::Value *Size)=0
RValue EmitPseudoObjectRValue(const PseudoObjectExpr *e, AggValueSlot slot=AggValueSlot::ignored())
RValue EmitCoawaitExpr(const CoawaitExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
bool isTransparent() const
Is this a transparent initializer list (that is, an InitListExpr that is purely syntactic, and whose semantics are that of the sole contained initializer)?
Defines the C++ template declaration subclasses.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
ParenExpr - This represents a parethesized expression, e.g.
Expr * getFalseExpr() const
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined...
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
EmitComplexExprIntoLValue - Emit the given expression of complex type and place its result into the s...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Represents a call to a C++ constructor.
bool hasTrivialMoveConstructor() const
Determine whether this class has a trivial move constructor (C++11 [class.copy]p12) ...
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
void setZeroed(bool V=true)
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
LValue EmitLValueForFieldInitialization(LValue Base, const FieldDecl *Field)
EmitLValueForFieldInitialization - Like EmitLValueForField, except that if the Field is a reference...
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
IsAliased_t isPotentiallyAliased() const
void EmitAtomicStore(RValue rvalue, LValue lvalue, bool isInit)
QualType getElementType() const
static bool isBlockVarRef(const Expr *E)
Is the value of the given expression possibly a reference to or into a __block variable?
static Expr * findPeephole(Expr *op, CastKind kind)
Attempt to look through various unimportant expressions to find a cast of the given kind...
Represents a variable declaration or definition.
CompoundLiteralExpr - [C99 6.5.2.5].
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
const T * getAs() const
Member-template getAs<specific type>'.
AggValueSlot::Overlap_t getOverlapForFieldInit(const FieldDecl *FD)
Determine whether a field initialization may overlap some other object.
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
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. ...
IsZeroed_t isZeroed() const
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
llvm::Value * getPointer() const
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
A C++ throw-expression (C++ [except.throw]).
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst, llvm::Value **Result=nullptr)
EmitStoreThroughBitfieldLValue - Store Src into Dst with same constraints as EmitStoreThroughLValue.
The collection of all-type qualifiers we support.
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g., it is a floating-point type or a vector thereof.
static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF)
GetNumNonZeroBytesInInit - Get an approximate count of the number of non-zero bytes that will be stor...
Represents a struct/union/class.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
const TargetInfo & getTarget() const
An object to manage conditionally-evaluated expressions.
Expr * getSemanticForm()
Get an equivalent semantic form for this expression.
IsDestructed_t isExternallyDestructed() const
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
llvm::Value * EmitDynamicCast(Address V, const CXXDynamicCastExpr *DCE)
RValue EmitReferenceBindingToExpr(const Expr *E)
Emits a reference binding to the passed in expression.
field_range fields() const
Represents a member of a struct/union/class.
llvm::IntegerType * SizeTy
Represents a place-holder for an object not to be initialized by anything.
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
bool Zero(InterpState &S, CodePtr OpPC)
bool isReferenceType() const
bool hasTrivialMoveAssignment() const
Determine whether this class has a trivial move assignment operator (C++11 [class.copy]p25)
Denotes a cleanup that should run when a scope is exited using exceptional control flow (a throw stat...
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
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.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
CharUnits getPreferredSize(ASTContext &Ctx, QualType Type) const
Get the preferred size to use when storing a value to this slot.
bool isPaddedAtomicType(QualType type)
static bool isTrivialFiller(Expr *E)
Determine if E is a trivial array filler, that is, one that is equivalent to zero-initialization.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
specific_decl_iterator< FieldDecl > field_iterator
bool hadArrayRangeDesignator() const
bool GE(InterpState &S, CodePtr OpPC)
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...
void setNonGC(bool Value)
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.
void pushFullExprCleanup(CleanupKind kind, As... A)
pushFullExprCleanup - Push a cleanup to be run at the end of the current full-expression.
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...
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
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...
static bool hasScalarEvaluationKind(QualType T)
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...
CharUnits - This is an opaque type for sizes expressed in character units.
bool isPartial() const
True iff the comparison is not totally ordered.
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
CharUnits getAlignment() const
Return the alignment of this pointer.
A builtin binary operation expression such as "x + y" or "x <= y".
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind...
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
llvm::CallInst * CreateMemCpy(Address Dest, Address Src, llvm::Value *Size, bool IsVolatile=false)
void EmitLambdaVLACapture(const VariableArrayType *VAT, LValue LV)
Scope - A scope is a transient data structure that is used while parsing the program.
field_iterator field_begin() const
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
void EmitIgnoredExpr(const Expr *E)
EmitIgnoredExpr - Emit an expression in a context which ignores the result.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents binding an expression to a temporary.
RValue EmitAtomicExpr(AtomicExpr *E)
CXXTemporary * getTemporary()
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
CharUnits getPointerAlign() const
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
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...
const ComparisonCategoryInfo & getInfoForType(QualType Ty) const
Return the comparison category information as specified by getCategoryForType(Ty).
void callCStructMoveConstructor(LValue Dst, LValue Src)
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
A default argument (C++ [dcl.fct.default]).
void begin(CodeGenFunction &CGF)
Checking the operand of a load. Must be suitably sized and aligned.
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor)
isTypeConstant - Determine whether an object of this type can be emitted as a constant.
const Expr * getExpr() const
Get the initialization expression that will be used.
RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, ReturnValueSlot Return=ReturnValueSlot())
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
void EmitCXXConstructExpr(const CXXConstructExpr *E, AggValueSlot Dest)
static CharUnits One()
One - Construct a CharUnits quantity of one.
ASTContext & getContext() const
CastKind
CastKind - The kind of operation required for a conversion.
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
InitListExpr * getUpdater() const
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Represents a call to the builtin function __builtin_va_arg.
bool isPointerZeroInitializable(QualType T)
Check if the pointer type can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer...
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
static TypeEvaluationKind getEvaluationKind(QualType T)
getEvaluationKind - Return the TypeEvaluationKind of QualType T.
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
void callCStructMoveAssignmentOperator(LValue Dst, LValue Src)
This represents one expression.
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)
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Address getAddress(CodeGenFunction &CGF) const
Qualifiers getQualifiers() const
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
const T * castAs() const
Member-template castAs<specific type>.
Address EmitCompoundStmt(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
EmitCompoundStmt - Emit a compound statement {..} node.
unsigned getNumInits() const
Expr * getSubExpr() const
Get the initializer to use for each array element.
AggValueSlot CreateAggTemp(QualType T, const Twine &Name="tmp")
CreateAggTemp - Create a temporary memory object for the given aggregate type.
field_iterator field_end() const
llvm::PointerType * getType() const
Return the type of the pointer value.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
bool isAnyComplexType() const
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
An RAII object to record that we're evaluating a statement expression.
TBAAAccessInfo getTBAAInfo() const
CharUnits alignmentOfArrayElement(CharUnits elementSize) const
Given that this is the alignment of the first element of an array, return the minimum alignment of an...
An expression that sends a message to the given Objective-C object or class.
llvm::CallInst * CreateMemSet(Address Dest, llvm::Value *Value, llvm::Value *Size, bool IsVolatile=false)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
const AstTypeMatcher< AtomicType > atomicType
Matches atomic types.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
The scope of a CXXDefaultInitExpr.
bool hasTrivialCopyConstructor() const
Determine whether this class has a trivial copy constructor (C++ [class.copy]p6, C++11 [class...
Expr * getTrueExpr() const
const Expr * getSubExpr() const
const Expr * getSubExpr() const
ASTContext & getContext() const
RValue EmitAtomicLoad(LValue LV, SourceLocation SL, AggValueSlot Slot=AggValueSlot::ignored())
void callCStructCopyAssignmentOperator(LValue Dst, LValue Src)
RecordDecl * getDecl() const
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
The scope of an ArrayInitLoopExpr.
const ValueInfo * getGreater() const
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Address CreateBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name="")
Represents a call to an inherited base class constructor from an inheriting constructor.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
void pushDestroy(QualType::DestructionKind dtorKind, Address addr, QualType type)
pushDestroy - Push the standard destructor for the given type as at least a normal cleanup...
bool hasTrivialCopyAssignment() const
Determine whether this class has a trivial copy assignment operator (C++ [class.copy]p11, C++11 [class.copy]p25)
bool LValueIsSuitableForInlineAtomic(LValue Src)
An LValue is a candidate for having its loads and stores be made atomic if we are operating under /vo...
LangAS getAddressSpace() const
Return the address space of this type.
A saved depth on the scope stack.
Expr * getSubExpr() const
LValue EmitCheckedLValue(const Expr *E, TypeCheckKind TCK)
Same as EmitLValue but additionally we generate checking code to guard against undefined behavior...
CastKind getCastKind() const
const ValueInfo * getLess() const
llvm::Value * getPointer(CodeGenFunction &CGF) const
LValue EmitAggExprToLValue(const Expr *E)
EmitAggExprToLValue - Emit the computation of the specified expression of aggregate type into a tempo...
void DeactivateCleanupBlock(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *DominatingIP)
DeactivateCleanupBlock - Deactivates the given cleanup block.
The type is a struct containing a field whose type is neither PCK_Trivial nor PCK_VolatileTrivial.
llvm::Value * EmitLifetimeStart(uint64_t Size, llvm::Value *Addr)
Emit a lifetime.begin marker if some criteria are satisfied.
A scoped helper to set the current debug location to the specified location or preferred location of ...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
void EmitCXXTemporary(const CXXTemporary *Temporary, QualType TempType, Address Ptr)
Emits all the code to cause the given temporary to be cleaned up.
static void CheckAggExprForMemSetUse(AggValueSlot &Slot, const Expr *E, CodeGenFunction &CGF)
CheckAggExprForMemSetUse - If the initializer is large and has a lot of zeros in it, emit a memset and avoid storing the individual zeros.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
LValue EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E)
PrimitiveCopyKind isNonTrivialToPrimitiveCopy() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
RValue EmitCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue=ReturnValueSlot())
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
const Expr * getInitializer() const
void setExternallyDestructed(bool destructed=true)
Represents a C11 generic selection.
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type, returning the result.
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.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
QualType withVolatile() const
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
This class organizes the cross-function state that is used while generating LLVM code.
void setVolatile(bool flag)
Dataflow Directional Tag Classes.
[C99 6.4.2.2] - A predefined identifier such as func.
AggValueSlot::Overlap_t getOverlapForBaseInit(const CXXRecordDecl *RD, const CXXRecordDecl *BaseRD, bool IsVirtual)
Determine whether a base class initialization may overlap some other object.
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored...
A scope within which we are constructing the fields of an object which might use a CXXDefaultInitExpr...
LValue getOrCreateOpaqueLValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its LValue mapping if it exists, otherwise create one...
llvm::LoadInst * CreateAlignedLoad(llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
LValue EmitPseudoObjectLValue(const PseudoObjectExpr *e)
bool hasUserDeclaredConstructor() const
Determine whether this class has any user-declared constructors.
Represents a 'co_yield' expression.
const Expr * getExpr() const
U cast(CodeGen::Address addr)
llvm::Constant * EmitNullConstant(QualType T)
Return the result of value-initializing the given type, i.e.
Checking the destination of a store. Must be suitably sized and aligned.
CXXRecordDecl * Record
The declaration for the comparison category type from the standard library.
A pointer to member type per C++ 8.3.3 - Pointers to members.
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
llvm::Module & getModule() const
QualType getCallReturnType(const ASTContext &Ctx) const
getCallReturnType - Get the return type of the call expr.
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
void EmitAggExpr(const Expr *E, AggValueSlot AS)
EmitAggExpr - Emit the computation of the specified expression of aggregate type. ...
void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)
Emit type info if type of an expression is a variably modified type.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
CodeGenTypes & getTypes() const
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
llvm::Type * getElementType() const
Return the type of the values stored in this address.
const llvm::APInt & getSize() const
bool isAtomicType() const
Represents a 'co_await' expression.
llvm::PointerType * Int8PtrTy
llvm::Value * getAggregatePointer() const
Expr * getReplacement() const
void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
A use of a default initializer in a constructor or in aggregate initialization.
llvm::IntegerType * PtrDiffTy
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Overlap_t mayOverlap() const
void callCStructCopyConstructor(LValue Dst, LValue Src)
static llvm::Value * EmitCompare(CGBuilderTy &Builder, CodeGenFunction &CGF, const BinaryOperator *E, llvm::Value *LHS, llvm::Value *RHS, CompareKind Kind, const char *NameSuffix="")
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
void ErrorUnsupported(const Stmt *S, const char *Type)
ErrorUnsupported - Print out an error that codegen doesn't support the specified stmt yet...
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.
Represents a C++ struct/union/class.
Represents a loop initializing the elements of an array.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
llvm::Type * ConvertType(QualType T)
LValue EmitLValue(const Expr *E)
EmitLValue - Emit code to compute a designator that specifies the location of the expression...
const ValueInfo * getEqualOrEquiv() const
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
unsigned kind
All of the diagnostics that can be emitted by the frontend.
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
void finalize(llvm::GlobalVariable *global)
RetTy Visit(PTR(Stmt) S, ParamTys... P)
CGCXXABI & getCXXABI() const
bool hasVolatileMember(QualType T)
hasVolatileMember - returns true if aggregate type has a volatile member.
void EmitAggregateCopy(LValue Dest, LValue Src, QualType EltTy, AggValueSlot::Overlap_t MayOverlap, bool isVolatile=false)
EmitAggregateCopy - Emit an aggregate copy.
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression...
A rewritten comparison expression that was originally written using operator syntax.
A reference to a declared variable, function, enum, etc.
static RValue get(llvm::Value *V)
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
bool isPointerType() const
bool hasObjectMember() const
void EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr)
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
static RValue getAggregate(Address addr, bool isVolatile=false)
LValue - This represents an lvalue references.
const LangOptions & getLangOpts() const
unsigned getTargetAddressSpace(QualType T) const
const ValueInfo * getUnordered() const
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
llvm::APInt getArraySize() const
Represents the canonical version of C arrays with a specified constant size.
bool isZeroInitializable(QualType T)
IsZeroInitializable - Return whether a type can be zero-initialized (in the C++ sense) with an LLVM z...
Represents an implicitly-generated value initialization of an object of a given type.
void EmitCXXThrowExpr(const CXXThrowExpr *E, bool KeepInsertionPoint=true)
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 ...
void EmitNullInitialization(Address DestPtr, QualType Ty)
EmitNullInitialization - Generate code to set a value of the given type to null, If the type contains...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
ComparisonCategories CompCategories
Types and expressions required to build C++2a three-way comparisons using operator<=>, including the values return by builtin <=> operators.