clang: lib/CodeGen/CodeGenFunction.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H
14#define LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H
15
38#include "llvm/ADT/ArrayRef.h"
39#include "llvm/ADT/DenseMap.h"
40#include "llvm/ADT/MapVector.h"
41#include "llvm/ADT/SmallVector.h"
42#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
43#include "llvm/IR/Instructions.h"
44#include "llvm/IR/ValueHandle.h"
45#include "llvm/Support/Debug.h"
46#include "llvm/Transforms/Utils/SanitizerStats.h"
47#include
48
49namespace llvm {
50class BasicBlock;
51class LLVMContext;
52class MDNode;
53class SwitchInst;
54class Twine;
56class CanonicalLoopInfo;
57}
58
60class ASTContext;
61class CXXDestructorDecl;
62class CXXForRangeStmt;
63class CXXTryStmt;
65class LabelDecl;
66class FunctionDecl;
67class FunctionProtoType;
68class LabelStmt;
69class ObjCContainerDecl;
70class ObjCInterfaceDecl;
71class ObjCIvarDecl;
72class ObjCMethodDecl;
73class ObjCImplementationDecl;
74class ObjCPropertyImplDecl;
75class TargetInfo;
76class VarDecl;
77class ObjCForCollectionStmt;
78class ObjCAtTryStmt;
79class ObjCAtThrowStmt;
80class ObjCAtSynchronizedStmt;
81class ObjCAutoreleasePoolStmt;
82class OMPUseDevicePtrClause;
83class OMPUseDeviceAddrClause;
84class SVETypeFlags;
85class OMPExecutableDirective;
86
87namespace analyze_os_log {
88class OSLogBufferLayout;
89}
90
91namespace CodeGen {
92class CodeGenTypes;
93class CGCallee;
94class CGFunctionInfo;
95class CGBlockInfo;
96class CGCXXABI;
97class BlockByrefHelpers;
98class BlockByrefInfo;
99class BlockFieldFlags;
100class RegionCodeGenTy;
101class TargetCodeGenInfo;
102struct OMPTaskDataTy;
103struct CGCoroData;
104
105
106
107
108
109
115
116#define LIST_SANITIZER_CHECKS \
117 SANITIZER_CHECK(AddOverflow, add_overflow, 0) \
118 SANITIZER_CHECK(BuiltinUnreachable, builtin_unreachable, 0) \
119 SANITIZER_CHECK(CFICheckFail, cfi_check_fail, 0) \
120 SANITIZER_CHECK(DivremOverflow, divrem_overflow, 0) \
121 SANITIZER_CHECK(DynamicTypeCacheMiss, dynamic_type_cache_miss, 0) \
122 SANITIZER_CHECK(FloatCastOverflow, float_cast_overflow, 0) \
123 SANITIZER_CHECK(FunctionTypeMismatch, function_type_mismatch, 0) \
124 SANITIZER_CHECK(ImplicitConversion, implicit_conversion, 0) \
125 SANITIZER_CHECK(InvalidBuiltin, invalid_builtin, 0) \
126 SANITIZER_CHECK(InvalidObjCCast, invalid_objc_cast, 0) \
127 SANITIZER_CHECK(LoadInvalidValue, load_invalid_value, 0) \
128 SANITIZER_CHECK(MissingReturn, missing_return, 0) \
129 SANITIZER_CHECK(MulOverflow, mul_overflow, 0) \
130 SANITIZER_CHECK(NegateOverflow, negate_overflow, 0) \
131 SANITIZER_CHECK(NullabilityArg, nullability_arg, 0) \
132 SANITIZER_CHECK(NullabilityReturn, nullability_return, 1) \
133 SANITIZER_CHECK(NonnullArg, nonnull_arg, 0) \
134 SANITIZER_CHECK(NonnullReturn, nonnull_return, 1) \
135 SANITIZER_CHECK(OutOfBounds, out_of_bounds, 0) \
136 SANITIZER_CHECK(PointerOverflow, pointer_overflow, 0) \
137 SANITIZER_CHECK(ShiftOutOfBounds, shift_out_of_bounds, 0) \
138 SANITIZER_CHECK(SubOverflow, sub_overflow, 0) \
139 SANITIZER_CHECK(TypeMismatch, type_mismatch, 1) \
140 SANITIZER_CHECK(AlignmentAssumption, alignment_assumption, 0) \
141 SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0) \
142 SANITIZER_CHECK(BoundsSafety, bounds_safety, 0)
143
145#define SANITIZER_CHECK(Enum, Name, Version) Enum,
147#undef SANITIZER_CHECK
149
150
151
153 typedef llvm::PointerIntPair<llvm::Value*, 1, bool> saved_type;
154
155
157 if (!value)
158 return false;
159
160
161 if (!isallvm::Instruction(value)) return false;
162
163
164 llvm::BasicBlock *block = castllvm::Instruction(value)->getParent();
165 return (block != &block->getParent()->getEntryBlock());
166 }
167
170};
171
172
173
178 }
179};
180
181
184
191 };
192
196 return true;
197 return false;
198 }
203 }
208 }
209};
210
211
215 enum Kind { ScalarLiteral, ScalarAddress, AggregateLiteral,
216 AggregateAddress, ComplexAddress };
217 union {
218 struct {
222 };
223 LLVM_PREFERRED_TYPE(Kind)
224 unsigned K : 3;
225
228
231 : Vals{Val1, Val2}, K(ComplexAddress) {}
232
234 : AggregateAddr(AggregateAddr), K(K) {}
235
236 public:
240
241
242 };
243
245 return saved_type::needsSaving(value);
246 }
248 return saved_type::save(CGF, value);
249 }
251 return value.restore(CGF);
252 }
253};
254
255
256
260
262public:
263
264
268 unsigned Index)
269 : Block(Block), ScopeDepth(Depth), Index(Index) {}
270
271 bool isValid() const { return Block != nullptr; }
272 llvm::BasicBlock *getBlock() const { return Block; }
275
276
278 ScopeDepth = depth;
279 }
280
281 private:
282 llvm::BasicBlock *Block;
284 unsigned Index;
285 };
286
289
290
292
293 typedef std::pair<llvm::Value *, llvm::Value *> ComplexPairTy;
296
297
298
300
301
302
303
304
305
306
307
308
309
310
311
312
314
315
317
318
320
321
322
324
325
330 const unsigned, const bool)>
332
333
334 typedef llvm::function_ref<std::pair<LValue, LValue>(
337
338
339 typedef llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
343
344
345
346 void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
347 llvm::BasicBlock::iterator InsertPt) const;
348
349
350
352
356 llvm::Function *CurFn = nullptr;
357
358
360
361
362
363
369 };
371
374 }
375
378 }
379
380
381
382
385 };
387
388
389
390
391
392
393
394
396 Twine const &SuspendPointName,
398
399
401
402
403
405
406
408
409
410
412
413
414
416
417
418
420
421
423 if (CurLexicalScope)
424 return CurLexicalScope->hasLabels();
425 return !LabelMap.empty();
426 }
427
428
429
431
432private:
433
434
435
436
437
438
439
440
441 llvm::AssertingVHllvm::Instruction PostAllocaInsertPt = nullptr;
442
443public:
444
445
447 if (!PostAllocaInsertPt) {
449 "Expected static alloca insertion point at function prologue");
450 assert(AllocaInsertPt->getParent()->isEntryBlock() &&
451 "EBB should be entry block of the current code gen function");
453 PostAllocaInsertPt->setName("postallocapt");
455 }
456
457 return PostAllocaInsertPt;
458 }
459
460
462 public:
464 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {}
467 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {
468
470 S.getCapturedRecordDecl()->field_begin();
472 E = S.capture_end();
473 I != E; ++I, ++Field) {
474 if (I->capturesThis())
475 CXXThisFieldDecl = *Field;
476 else if (I->capturesVariable())
477 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
478 else if (I->capturesVariableByCopy())
479 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
480 }
481 }
482
484
486
488
490
491
494 }
495
498
500 return true;
501 }
502
503
507 }
508
509
510 virtual StringRef getHelperName() const { return "__captured_stmt"; }
511
512
514 return CaptureFields;
515 }
516
517 private:
518
520
521
522 llvm::SmallDenseMap<const VarDecl *, FieldDecl *> CaptureFields;
523
524
525
526 llvm::Value *ThisValue;
527
528
530 };
532
533
535 private:
538 public:
543 }
545 };
546
547
549
550 const Decl *CalleeDecl;
551
552 public:
557 return isa_and_nonnull(CalleeDecl);
558 }
561 if (const auto *FD = dyn_cast(CalleeDecl))
562 return FD->getNumParams();
563 return cast(CalleeDecl)->param_size();
564 }
566 if (const auto *FD = dyn_cast(CalleeDecl))
567 return FD->getParamDecl(I);
568 return *(cast(CalleeDecl)->param_begin() + I);
569 }
570 };
571
572
574
575
577
578
581 public:
584 };
585
586
587
589
590
592
593
594
596
598
599
600
602
603
604
606
607
609
610
612
613
615
616
618
619
621 HLSLControlFlowHintAttr::SpellingNotCalculated;
622
623
624
626
627
628
632 return false;
633
634
635
636
637
638
639
640
641
643 }
644
645
646
647
649
652
655
656
657
658 llvm::DenseMap<const VarDecl *, llvm::Value *> NRVOFlags;
659
662
663
664
665
666
667
668
669
670
674 };
676
677
678
687
689 assert( && "Deactivating already deactivated scope");
693 Stack[I - 1].DominatingIP);
694 Stack[I - 1].DominatingIP->eraseFromParent();
695 }
698 }
699
702 return;
704 }
705 };
706
708
710
712 bool isRedundantBeforeReturn() override { return true; }
713
714 llvm::Value *Addr;
715 llvm::Value *Size;
716
717 public:
719 : Addr(addr.getPointer()), Size(size) {}
720
723 }
724 };
725
726
728
730
733
734 LLVM_PREFERRED_TYPE(bool)
736
740 };
741
742
744
746
747
749
750
751
753
754
755
757
758
759
760
762
763
765
766
768
770
771
778
779
783
784 public:
788 : CGF(CGF),
791 }
794 }
795 };
796
797 template
800 }
801
803 public:
807
808 private:
809 void ConstructorHelper(FPOptions FPFeatures);
812 llvm::fp::ExceptionBehavior OldExcept;
813 llvm::RoundingMode OldRounding;
814 std::optionalCGBuilderTy::FastMathFlagGuard FMFGuard;
815 };
817
818public:
819
820
822
823
825
827
828
829 llvm::FunctionCallee BeginCatchFn;
830
831
832
833 llvm::AllocaInst *ForEHVar = nullptr;
834
835
836
837 llvm::AllocaInst *SavedExnVar = nullptr;
838
839 public:
841 llvm::FunctionCallee beginCatchFn,
842 llvm::FunctionCallee endCatchFn, llvm::FunctionCallee rethrowFn);
844 };
845
846
848
849
852 }
853
854
855
856
857 template <class T, class... As>
859
860
862 return EHStack.pushCleanup<T>(kind, A...);
863
864
865 typedef std::tuple<typename DominatingValue::saved_type...> SavedTuple;
867
871 }
872
873
874
875 template <class T, class... As>
878 return pushCleanupAfterFullExprWithActiveFlag(
880
883 "cleanup active flag should never need saving");
884
885 typedef std::tuple<typename DominatingValue::saved_type...> SavedTuple;
887
889 pushCleanupAfterFullExprWithActiveFlag(Kind, ActiveFlag, Saved);
890 }
891
892 template <class T, class... As>
897
901 (Header.IsConditional ? sizeof(ActiveFlag) : 0));
902
903 static_assert(sizeof(Header) % alignof(T) == 0,
904 "Cleanup will be allocated on misaligned address");
907 new (Buffer + sizeof(Header)) T(A...);
909 new (Buffer + sizeof(Header) + sizeof(T)) RawAddress(ActiveFlag);
910 }
911
912
913
914
915 template <class T, class... As>
917
918 llvm::Instruction *DominatingIP =
920 EHStack.pushCleanup<T>(Kind, A...);
923 }
924
925
926
929 }
930
933
934
935
936
937
939
940
941
942
945
946
947
950
951
952
953
954
955
956
957
958
960 llvm::Instruction *DominatingIP);
961
962
963
964
965
966
967
968
970 llvm::Instruction *DominatingIP);
971
972
973
976 size_t LifetimeExtendedCleanupStackSize;
978 bool OldDidCallStackSave;
979 protected:
981 private:
982
985
986 protected:
988
989 public:
990
994 LifetimeExtendedCleanupStackSize =
996 OldDidCallStackSave = CGF.DidCallStackSave;
997 CGF.DidCallStackSave = false;
1000 }
1001
1002
1006 }
1007
1008
1011 }
1012
1013
1014
1015
1016
1017
1018
1019 void ForceCleanup(std::initializer_listllvm::Value\*\* ValuesToReload = {}) {
1021 CGF.DidCallStackSave = OldDidCallStackSave;
1023 CGF.PopCleanupBlocks(CleanupStackDepth, LifetimeExtendedCleanupStackSize,
1024 ValuesToReload);
1027 }
1028 };
1029
1030
1033
1038
1040 void operator=(const LexicalScope &) = delete;
1041
1042 public:
1043
1046 CGF.CurLexicalScope = this;
1048 DI->EmitLexicalBlockStart(CGF.Builder, Range.getBegin());
1049 }
1050
1052 assert(PerformCleanup && "adding label to dead scope?");
1053 Labels.push_back(label);
1054 }
1055
1056
1057
1061
1062
1063
1067 }
1068 }
1069
1070
1071
1073 CGF.CurLexicalScope = ParentScope;
1075
1076 if (!Labels.empty())
1078 }
1079
1081 return !Labels.empty();
1082 }
1083
1085 };
1086
1087 typedef llvm::DenseMap<const Decl *, Address> DeclMapTy;
1088
1089
1094 void operator=(const OMPMapVars &) = delete;
1095
1096 public:
1099 assert(SavedLocals.empty() && "Did not restored original addresses.");
1100 };
1101
1102
1103
1104
1108
1109 if (SavedLocals.count(LocalVD)) return false;
1110
1111
1112 auto it = CGF.LocalDeclMap.find(LocalVD);
1113 if (it != CGF.LocalDeclMap.end())
1114 SavedLocals.try_emplace(LocalVD, it->second);
1115 else
1117
1118
1123 TempAddr = Temp;
1124 }
1125 SavedTempAddresses.try_emplace(LocalVD, TempAddr);
1126
1127 return true;
1128 }
1129
1130
1131
1132
1134 copyInto(SavedTempAddresses, CGF.LocalDeclMap);
1135 SavedTempAddresses.clear();
1136 return !SavedLocals.empty();
1137 }
1138
1139
1141 if (!SavedLocals.empty()) {
1142 copyInto(SavedLocals, CGF.LocalDeclMap);
1143 SavedLocals.clear();
1144 }
1145 }
1146
1147 private:
1148
1149
1151 for (auto &[Decl, Addr] : Src) {
1152 if (!Addr.isValid())
1153 Dest.erase(Decl);
1154 else
1155 Dest.insert_or_assign(Decl, Addr);
1156 }
1157 }
1158 };
1159
1160
1161
1162
1167
1168 public:
1169
1171
1172
1173
1174
1175
1176
1178 assert(PerformCleanup && "adding private to dead scope");
1179 return MappedVars.setVarAddr(CGF, LocalVD, Addr);
1180 }
1181
1182
1183
1184
1185
1186
1187
1188
1189
1191
1195 }
1196
1197
1201 }
1202
1203
1207 }
1208
1209
1210
1211
1213 };
1214
1215
1216
1217
1221
1222 public:
1224 : CGF(CGF), SavedMap(CGF.LocalDeclMap) {}
1226 };
1227
1228
1229
1230 void
1232 std::initializer_list<llvm::Value **> ValuesToReload = {});
1233
1234
1235
1236
1237 void
1239 size_t OldLifetimeExtendedStackSize,
1240 std::initializer_list<llvm::Value **> ValuesToReload = {});
1241
1243
1244
1245
1246
1251 }
1252
1253
1254
1255
1258 }
1259
1260
1261
1262
1264
1265
1266
1267
1269
1270
1271
1272
1274
1277 llvm::BasicBlock *
1279
1280
1282 llvm::BasicBlock *StartBB;
1283
1284 public:
1286 : StartBB(CGF.Builder.GetInsertBlock()) {}
1287
1289 assert(CGF.OutermostConditional != this);
1290 if (!CGF.OutermostConditional)
1291 CGF.OutermostConditional = this;
1292 }
1293
1295 assert(CGF.OutermostConditional != nullptr);
1296 if (CGF.OutermostConditional == this)
1297 CGF.OutermostConditional = nullptr;
1298 }
1299
1300
1301
1303 return StartBB;
1304 }
1305 };
1306
1307
1308
1310
1314 llvm::BasicBlock *block = OutermostConditional->getStartingBlock();
1315 auto store = new llvm::StoreInst(value, addr.emitRawPointer(CGF),
1316 block->back().getIterator());
1318 }
1319
1320
1321
1324
1325
1326
1327
1329
1330 public:
1332 : CGF(CGF), SavedOutermostConditional(CGF.OutermostConditional) {
1333 CGF.OutermostConditional = nullptr;
1334 }
1335
1337 CGF.OutermostConditional = SavedOutermostConditional;
1339 }
1340 };
1341
1342
1343
1344
1346 llvm::Instruction *Inst = nullptr;
1348
1349 public:
1351 };
1352
1353
1354
1355
1356
1357
1358
1361 bool BoundLValue;
1363
1365 bool boundLValue)
1366 : OpaqueValue(ov), BoundLValue(boundLValue) {}
1367 public:
1369
1371
1372
1373
1374
1375
1376 return expr->isGLValue() ||
1377 expr->getType()->isFunctionType() ||
1379 }
1380
1383 const Expr *e) {
1387 }
1388
1393 CGF.OpaqueLValues.insert(std::make_pair(ov, lv));
1395 }
1396
1401 CGF.OpaqueRValues.insert(std::make_pair(ov, rv));
1402
1404
1405
1406
1407
1409
1410 return data;
1411 }
1412
1413 bool isValid() const { return OpaqueValue != nullptr; }
1414 void clear() { OpaqueValue = nullptr; }
1415
1417 assert(OpaqueValue && "no data to unbind!");
1418
1419 if (BoundLValue) {
1420 CGF.OpaqueLValues.erase(OpaqueValue);
1421 } else {
1422 CGF.OpaqueRValues.erase(OpaqueValue);
1424 }
1425 }
1426 };
1427
1428
1432
1433 public:
1436 }
1437
1438
1439
1440
1441
1442
1445 if (isa(op))
1446
1447 return;
1448
1452 }
1453
1454
1455
1457 : CGF(CGF) {
1458 if (OV) {
1459 assert(OV->getSourceExpr() && "wrong form of OpaqueValueMapping used "
1460 "for OVE with no source expression");
1462 }
1463 }
1464
1469 }
1470
1475 }
1476
1478 Data.unbind(CGF);
1479 Data.clear();
1480 }
1481
1483 if (Data.isValid()) Data.unbind(CGF);
1484 }
1485 };
1486
1487private:
1489
1490 unsigned VLAExprCounter = 0;
1491 bool DisableDebugInfo = false;
1492
1493
1494
1495 bool DidCallStackSave = false;
1496
1497
1498
1499
1500
1501 llvm::IndirectBrInst *IndirectBranch = nullptr;
1502
1503
1504
1506
1507
1508
1509 llvm::DenseMap<const ParmVarDecl *, EHScopeStack::stable_iterator>
1510 CalleeDestructedParamCleanups;
1511
1512
1513
1514
1515 llvm::SmallDenseMap<const ParmVarDecl *, const ImplicitParamDecl *, 2>
1516 SizeArguments;
1517
1518
1519
1520 llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals;
1521
1522
1523 llvm::DenseMap<const LabelDecl*, JumpDest> LabelMap;
1524
1525
1526
1527 struct BreakContinue {
1528 BreakContinue(JumpDest Break, JumpDest Continue)
1529 : BreakBlock(Break), ContinueBlock(Continue) {}
1530
1531 JumpDest BreakBlock;
1532 JumpDest ContinueBlock;
1533 };
1534 SmallVector<BreakContinue, 8> BreakContinueStack;
1535
1536
1537 class OpenMPCancelExitStack {
1538
1539
1540 struct CancelExit {
1541 CancelExit() = default;
1543 JumpDest ContBlock)
1544 : Kind(Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
1546
1547
1548 bool HasBeenEmitted = false;
1549 JumpDest ExitBlock;
1550 JumpDest ContBlock;
1551 };
1552
1553 SmallVector<CancelExit, 8> Stack;
1554
1555 public:
1556 OpenMPCancelExitStack() : Stack(1) {}
1557 ~OpenMPCancelExitStack() = default;
1558
1559 JumpDest getExitBlock() const { return Stack.back().ExitBlock; }
1560
1561
1563 const llvm::function_ref<void(CodeGenFunction &)> CodeGen) {
1564 if (Stack.back().Kind == Kind && getExitBlock().isValid()) {
1565 assert(CGF.getOMPCancelDestination(Kind).isValid());
1566 assert(CGF.HaveInsertPoint());
1567 assert(!Stack.back().HasBeenEmitted);
1568 auto IP = CGF.Builder.saveAndClearIP();
1569 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1570 CodeGen(CGF);
1571 CGF.EmitBranch(Stack.back().ContBlock.getBlock());
1572 CGF.Builder.restoreIP(IP);
1573 Stack.back().HasBeenEmitted = true;
1574 }
1575 CodeGen(CGF);
1576 }
1577
1578
1579
1580
1581 void enter(CodeGenFunction &CGF, OpenMPDirectiveKind Kind, bool HasCancel) {
1582 Stack.push_back({Kind,
1583 HasCancel ? CGF.getJumpDestInCurrentScope("cancel.exit")
1584 : JumpDest(),
1585 HasCancel ? CGF.getJumpDestInCurrentScope("cancel.cont")
1586 : JumpDest()});
1587 }
1588
1589
1590 void exit(CodeGenFunction &CGF) {
1591 if (getExitBlock().isValid()) {
1592 assert(CGF.getOMPCancelDestination(Stack.back().Kind).isValid());
1593 bool HaveIP = CGF.HaveInsertPoint();
1594 if (!Stack.back().HasBeenEmitted) {
1595 if (HaveIP)
1596 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1597 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1598 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1599 }
1600 CGF.EmitBlock(Stack.back().ContBlock.getBlock());
1601 if (!HaveIP) {
1602 CGF.Builder.CreateUnreachable();
1603 CGF.Builder.ClearInsertionPoint();
1604 }
1605 }
1606 Stack.pop_back();
1607 }
1608 };
1609 OpenMPCancelExitStack OMPCancelStack;
1610
1611
1612 llvm::Value *emitCondLikelihoodViaExpectIntrinsic(llvm::Value *Cond,
1614
1615 CodeGenPGO PGO;
1616
1617
1619
1620
1621 llvm::MDNode *createProfileWeights(uint64_t TrueCount,
1622 uint64_t FalseCount) const;
1623 llvm::MDNode *createProfileWeights(ArrayRef<uint64_t> Weights) const;
1624 llvm::MDNode *createProfileWeightsForLoop(const Stmt *Cond,
1625 uint64_t LoopCount) const;
1626
1627public:
1629
1631 PGO.markStmtAsUsed(Skipped, S);
1632 }
1634
1635
1636
1639 ->hasFnAttribute(llvm::Attribute::NoProfile) &&
1640 ->hasFnAttribute(llvm::Attribute::SkipProfile)) {
1642 PGO.emitCounterSetOrIncrement(Builder, S, StepV);
1643 }
1644 PGO.setCurrentStmt(S);
1645 }
1646
1650 ->hasFnAttribute(llvm::Attribute::NoProfile));
1651 }
1652
1653
1654
1657 PGO.emitMCDCParameters(Builder);
1658 MCDCCondBitmapAddr =
1660 }
1661 }
1662
1664 const BinaryOperator *BOp = dyn_cast(E->IgnoreParens());
1666 }
1667
1668
1671 PGO.emitMCDCCondBitmapReset(Builder, E, MCDCCondBitmapAddr);
1672 PGO.setCurrentStmt(E);
1673 }
1674 }
1675
1676
1677
1680 PGO.emitMCDCTestVectorBitmapUpdate(Builder, E, MCDCCondBitmapAddr, *this);
1681 PGO.setCurrentStmt(E);
1682 }
1683 }
1684
1685
1688 PGO.emitMCDCCondBitmapUpdate(Builder, E, MCDCCondBitmapAddr, Val, *this);
1689 PGO.setCurrentStmt(E);
1690 }
1691 }
1692
1693
1695 return PGO.getStmtCount(S).value_or(0);
1696 }
1697
1698
1700 PGO.setCurrentRegionCount(Count);
1701 }
1702
1703
1704
1706 return PGO.getCurrentRegionCount();
1707 }
1708
1709private:
1710
1711
1712
1713 llvm::SwitchInst *SwitchInsn = nullptr;
1714
1716
1717
1719
1720
1721
1722 llvm::BasicBlock *CaseRangeBlock = nullptr;
1723
1724
1725
1726 llvm::DenseMap<const OpaqueValueExpr *, LValue> OpaqueLValues;
1727 llvm::DenseMap<const OpaqueValueExpr *, RValue> OpaqueRValues;
1728
1729
1730
1731
1732
1733
1734
1735 llvm::DenseMap<const Expr*, llvm::Value*> VLASizeMap;
1736
1737
1738
1739 llvm::BasicBlock *UnreachableBlock = nullptr;
1740
1741
1742 unsigned NumReturnExprs = 0;
1743
1744
1745 unsigned NumSimpleReturnExprs = 0;
1746
1747
1749
1750public:
1751
1752
1756
1757
1758
1759
1761 public:
1763 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1764 CGF.CXXDefaultInitExprThis = This;
1765 }
1767 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1768 }
1769
1770 private:
1772 Address OldCXXDefaultInitExprThis;
1773 };
1774
1775
1776
1778 public:
1785 }
1789 }
1790
1791 public:
1796 };
1797
1801 };
1802
1803
1804
1806 public:
1808 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1809 CGF.ArrayInitIndex = Index;
1810 }
1812 CGF.ArrayInitIndex = OldArrayInitIndex;
1813 }
1814
1815 private:
1817 llvm::Value *OldArrayInitIndex;
1818 };
1819
1821 public:
1823 : CGF(CGF), OldCurGD(CGF.CurGD), OldCurFuncDecl(CGF.CurFuncDecl),
1825 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1826 OldCXXABIThisValue(CGF.CXXABIThisValue),
1827 OldCXXThisValue(CGF.CXXThisValue),
1828 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1829 OldCXXThisAlignment(CGF.CXXThisAlignment),
1831 OldCXXInheritedCtorInitExprArgs(
1832 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1835 cast(GD.getDecl());
1836 CGF.CXXABIThisDecl = nullptr;
1837 CGF.CXXABIThisValue = nullptr;
1838 CGF.CXXThisValue = nullptr;
1839 CGF.CXXABIThisAlignment = CharUnits();
1840 CGF.CXXThisAlignment = CharUnits();
1843 CGF.CXXInheritedCtorInitExprArgs.clear();
1844 }
1846 CGF.CurGD = OldCurGD;
1847 CGF.CurFuncDecl = OldCurFuncDecl;
1848 CGF.CurCodeDecl = OldCurCodeDecl;
1849 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1850 CGF.CXXABIThisValue = OldCXXABIThisValue;
1851 CGF.CXXThisValue = OldCXXThisValue;
1852 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1853 CGF.CXXThisAlignment = OldCXXThisAlignment;
1854 CGF.ReturnValue = OldReturnValue;
1855 CGF.FnRetTy = OldFnRetTy;
1856 CGF.CXXInheritedCtorInitExprArgs =
1857 std::move(OldCXXInheritedCtorInitExprArgs);
1858 }
1859
1860 private:
1863 const Decl *OldCurFuncDecl;
1864 const Decl *OldCurCodeDecl;
1866 llvm::Value *OldCXXABIThisValue;
1867 llvm::Value *OldCXXThisValue;
1868 CharUnits OldCXXABIThisAlignment;
1872 CallArgList OldCXXInheritedCtorInitExprArgs;
1873 };
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1887
1891
1893
1894
1896
1897 private:
1898 llvm::CallInst *RTLFnCI;
1899
1900 public:
1902 RLFnCI->removeFromParent();
1903 }
1904
1907 return;
1908 CGF.Builder.Insert(RTLFnCI);
1909 }
1910 };
1911
1912
1913
1914
1915
1916
1917
1921
1922
1925
1926
1927
1928
1929
1930
1932 StringRef FirstSeparator = ".",
1933 StringRef Separator = ".");
1934
1935
1936
1938 CGBuilderTy::InsertPointGuard IPG(CGF.Builder);
1939 assert(IP.getBlock()->end() != IP.getPoint() &&
1940 "OpenMP IR Builder should cause terminated block!");
1941
1942 llvm::BasicBlock *IPBB = IP.getBlock();
1943 llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
1944 assert(DestBB && "Finalization block should have one successor!");
1945
1946
1947 IPBB->getTerminator()->eraseFromParent();
1948 CGF.Builder.SetInsertPoint(IPBB);
1951 }
1952
1953
1954
1955
1956
1957
1958
1959
1961 const Stmt *RegionBodyStmt,
1964 Twine RegionName);
1965
1967 llvm::BasicBlock &FiniBB, llvm::Function *Fn,
1969 llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
1970 if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
1971 CodeGenIPBBTI->eraseFromParent();
1972
1973 CGF.Builder.SetInsertPoint(CodeGenIPBB);
1974
1975 if (Fn->doesNotThrow())
1977 else
1979
1980 if (CGF.Builder.saveIP().isSet())
1981 CGF.Builder.CreateBr(&FiniBB);
1982 }
1983
1984
1985
1986
1987
1988
1989
1990
1991
1993 const Stmt *RegionBodyStmt,
1996 Twine RegionName);
1997
1998
2000
2001 llvm::AssertingVHllvm::Instruction OldAllocaIP;
2004
2005 public:
2007 llvm::BasicBlock &RetBB)
2008 : CGF(cgf) {
2009 assert(AllocaIP.isSet() &&
2010 "Must specify Insertion point for allocas of outlined function");
2013
2016 }
2017
2021 }
2022 };
2023
2024
2026
2027 llvm::AssertingVHllvm::Instruction OldAllocaIP;
2029
2030 public:
2032 llvm::BasicBlock &FiniBB)
2033 : CGF(cgf) {
2034
2035
2036
2037
2038 assert((!AllocaIP.isSet() ||
2039 CGF.AllocaInsertPt->getParent() == AllocaIP.getBlock()) &&
2040 "Insertion point should be in the entry block of containing "
2041 "function!");
2043 if (AllocaIP.isSet())
2045
2046
2047
2048
2049
2050
2052 }
2053
2055 };
2056 };
2057
2058private:
2059
2060
2062 llvm::Value *CXXABIThisValue = nullptr;
2063 llvm::Value *CXXThisValue = nullptr;
2066
2067
2068
2070
2071
2072
2073 llvm::Value *ArrayInitIndex = nullptr;
2074
2075
2076
2077 CallArgList CXXInheritedCtorInitExprArgs;
2078
2079
2080
2082 llvm::Value *CXXStructorImplicitParamValue = nullptr;
2083
2084
2085
2086
2087 ConditionalEvaluation *OutermostConditional = nullptr;
2088
2089
2090 LexicalScope *CurLexicalScope = nullptr;
2091
2092
2093
2095
2096
2097
2098 llvm::DenseMap<const ValueDecl *, BlockByrefInfo> BlockByrefInfos;
2099
2100
2101
2102 llvm::Value *RetValNullabilityPrecondition = nullptr;
2103
2104
2105
2106 bool requiresReturnValueNullabilityCheck() const {
2107 return RetValNullabilityPrecondition;
2108 }
2109
2110
2111
2113
2114
2115 bool requiresReturnValueCheck() const;
2116
2119
2120 llvm::BasicBlock *TerminateLandingPad = nullptr;
2121 llvm::BasicBlock *TerminateHandler = nullptr;
2123
2124
2125 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
2126
2127
2128
2129 unsigned LargestVectorWidth = 0;
2130
2131
2132
2133 bool ShouldEmitLifetimeMarkers;
2134
2135
2136
2137 void EmitKernelMetadata(const FunctionDecl *FD, llvm::Function *Fn);
2138
2139public:
2142
2146 if (DisableDebugInfo)
2147 return nullptr;
2148 return DebugInfo;
2149 }
2152
2155 }
2156
2158
2159
2160
2163
2164
2165
2168
2170
2172 if (!UnreachableBlock) {
2174 new llvm::UnreachableInst(getLLVMContext(), UnreachableBlock);
2175 }
2176 return UnreachableBlock;
2177 }
2178
2182 }
2183
2185
2190 }
2191
2192
2193
2194
2195
2197
2199 Address arrayEndPointer,
2204 llvm::Value *arrayEnd,
2208
2214 Destroyer *destroyer, bool useEHCleanupForArray);
2219 bool useEHCleanupForArray);
2222 bool useEHCleanupForArray);
2224 llvm::Value *CompletePtr,
2228 std::pair<llvm::Value *, llvm::Value *> AddrSizePair);
2230 bool useEHCleanupForArray);
2233 bool useEHCleanupForArray,
2238 bool checkZeroLength, bool useEHCleanup);
2239
2241
2242
2243
2245 switch (kind) {
2247 return false;
2255 }
2256 llvm_unreachable("bad destruction kind");
2257 }
2258
2261 }
2262
2263
2264
2265
2266
2268
2270
2271
2277 llvm::Constant *AtomicHelperFn);
2278
2281
2282
2283
2288 llvm::Constant *AtomicHelperFn);
2289
2290
2291
2292
2293
2294
2295
2296
2297
2299
2303 bool IsLambdaConversionToBlock,
2304 bool BuildGlobalBlock);
2305
2306
2308
2316
2319
2321
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2341 bool LoadBlockVarAddr, bool CanThrow);
2342
2344 llvm::Value *ptr);
2345
2348
2349
2350
2352 bool followForward = true);
2355 bool followForward,
2356 const llvm::Twine &name);
2357
2359
2361
2364
2365
2366
2368
2369
2370
2371
2374 llvm::Function *Fn,
2379
2381
2387
2391 llvm::Constant *CallOpFn = nullptr);
2398 llvm::Function **ImplFn);
2402 }
2404
2405
2406
2407
2408
2410
2411
2412
2414
2417
2419 const ThunkInfo *Thunk, bool IsUnprototyped);
2420
2422
2423
2425 llvm::FunctionCallee Callee);
2426
2427
2430 bool IsUnprototyped);
2431
2435
2438
2440
2441
2447 };
2448
2449
2451
2453
2456
2458 CharUnits OffsetFromNearestVBase,
2459 bool BaseIsNonVirtualPrimaryBase,
2462
2464
2465
2466
2467
2471 UnsafeUbsanStrip
2472 };
2473
2474
2475 llvm::Value *
2479
2488 };
2489
2490
2491
2492
2495
2496
2497
2500
2501
2502
2505
2506
2507
2508
2511
2512
2513
2514
2516
2517
2519 llvm::Value *VTable,
2520 llvm::Type *VTableTy,
2521 uint64_t VTableByteOffset);
2522
2523
2524
2525
2526
2528
2529
2530
2532
2533
2534
2536
2537
2538
2540
2541
2542
2544
2545
2546
2548
2549
2550
2552
2553
2554
2555
2557 llvm::Function *Fn,
2559
2560
2561
2564
2565
2567
2568
2570
2571
2573
2574
2576
2577
2578
2580
2581
2582
2583
2585
2589 llvm::Type *LLVMTy = nullptr);
2592 }
2593
2594
2595
2597
2598
2600
2601
2603
2606 }
2607
2610 }
2611
2612
2614 llvm::Function *parent = nullptr,
2615 llvm::BasicBlock *before = nullptr) {
2616 return llvm::BasicBlock::Create(getLLVMContext(), name, parent, before);
2617 }
2618
2619
2620
2622
2623
2624
2625
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636 void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false);
2637
2638
2639
2641
2642
2643
2644
2645
2646
2647
2648
2649
2651
2652
2653
2655 return Builder.GetInsertBlock() != nullptr;
2656 }
2657
2658
2659
2660
2661
2665 }
2666
2667
2668
2670
2671
2672
2673
2674
2676 llvm::BasicBlock *LHSBlock,
2677 llvm::BasicBlock *RHSBlock,
2678 llvm::BasicBlock *MergeBlock,
2680 Builder.SetInsertPoint(MergeBlock);
2681 llvm::PHINode *PtrPhi = Builder.CreatePHI(LHS.getType(), 2, "cond");
2682 PtrPhi->addIncoming(LHS.getBasePointer(), LHSBlock);
2683 PtrPhi->addIncoming(RHS.getBasePointer(), RHSBlock);
2686 return LHS;
2687 }
2688
2689
2690
2691
2692
2695 bool ForPointeeType = false, LValueBaseInfo *BaseInfo = nullptr,
2698 if (Alignment.isZero())
2699 Alignment =
2703 IsKnownNonNull);
2704 }
2705
2710 }
2711
2715 }
2716
2721 }
2722
2723
2724
2730 }
2731
2737 }
2738
2739
2740
2742
2746
2747
2748
2750
2752
2763 }
2764
2765
2766
2767
2772
2773private:
2774 struct AllocaTracker {
2775 void Add(llvm::AllocaInst *I) { Allocas.push_back(I); }
2777
2778 private:
2780 };
2781 AllocaTracker *Allocas = nullptr;
2782
2783public:
2784
2787 : CGF(CGF), OldTracker(CGF.Allocas) {
2788 CGF.Allocas = &Tracker;
2789 }
2791
2793
2794 private:
2796 AllocaTracker *OldTracker;
2797 AllocaTracker Tracker;
2798 };
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826 llvm::AllocaInst *CreateTempAlloca(llvm::Type *Ty, const Twine &Name = "tmp",
2827 llvm::Value *ArraySize = nullptr);
2829 const Twine &Name = "tmp",
2830 llvm::Value *ArraySize = nullptr,
2833 const Twine &Name = "tmp",
2834 llvm::Value *ArraySize = nullptr);
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2847 const Twine &Name = "tmp");
2848
2849
2850
2851
2852
2853
2854
2855
2856
2858
2859
2860
2861
2865 const Twine &Name = "tmp",
2867
2868
2869
2872 const Twine &Name = "tmp");
2873
2874
2875
2882 }
2883
2884
2885
2887
2888
2889
2890
2891
2895
2896
2897
2899 llvm::Value *Dst, QualType DstType,
2902
2903
2905
2906
2907
2908
2909
2910
2911
2914 bool ignoreResult = false);
2915
2916
2917
2919
2920
2921
2922
2924
2925
2926
2928
2929
2930
2932 Qualifiers Quals, bool IsInitializer);
2933
2935
2936
2940
2941
2942
2944 bool capturedByInit);
2945
2946
2947
2950 const RecordDecl *RD = cast(RT->getDecl());
2952 }
2953 return false;
2954 }
2955
2956
2958
2959
2960
2962 }
2963
2964
2966
2967
2968
2971 bool IsVirtual);
2972
2973
2977 }
2978
2982 }
2983
2984
2985
2986
2987
2988
2989
2990
2993 bool isVolatile = false);
2994
2995
2997 auto it = LocalDeclMap.find(VD);
2998 assert(it != LocalDeclMap.end() &&
2999 "Invalid argument to GetAddrOfLocalVar(), no decl!");
3000 return it->second;
3001 }
3002
3003
3004
3006
3007
3008
3010
3011
3013
3014
3015
3017
3020
3021
3023
3024
3025
3026
3028
3029
3030
3031
3032
3033
3034
3036
3037
3038
3039
3040
3041
3042
3043
3044
3047
3048
3049
3053
3054
3055
3056
3057
3059
3063
3065 };
3066
3067
3068
3071
3072
3073
3074
3075
3078
3079
3080
3082 assert(CXXThisValue && "no 'this' value for this function");
3083 return CXXThisValue;
3084 }
3086
3087
3088
3089
3090
3092 assert(CXXStructorImplicitParamValue && "no VTT value for this function");
3093 return CXXStructorImplicitParamValue;
3094 }
3095
3096
3097
3102 bool BaseIsVirtual);
3103
3105
3106
3107
3113
3118 bool NullCheckValue);
3119
3120
3121
3122
3123
3126
3131
3132
3133
3134
3137
3138
3139
3140
3141
3144 bool ForVirtualBase,
3147
3148
3149
3150
3152 bool ForVirtualBase, Address This,
3153 bool InheritedFromVBase,
3155
3157 bool ForVirtualBase, bool Delegating,
3159
3161 bool ForVirtualBase, bool Delegating,
3165 llvm::CallBase **CallOrInvoke = nullptr);
3166
3167
3168
3170
3171
3173
3177
3182 bool NewPointerIsChecked,
3183 bool ZeroInitialization = false);
3184
3186 llvm::Value *NumElements,
3189 bool NewPointerIsChecked,
3190 bool ZeroInitialization = false);
3191
3193
3197
3199 llvm::Type *ElementTy, Address NewPtr,
3200 llvm::Value *NumElements,
3201 llvm::Value *AllocSizeWithoutCookie);
3202
3205
3210
3213
3216
3218 QualType DeleteTy, llvm::Value *NumElements = nullptr,
3220
3222 const CallExpr *TheCallExpr, bool IsDelete);
3223
3227
3228
3229
3230
3232
3234
3236
3237
3238
3240
3241
3243
3244
3246
3248
3249
3251
3252
3254
3255
3257
3258
3260
3262
3263
3266
3267
3269
3270
3272
3273
3274
3276
3279 llvm::Value *ArraySize = nullptr) {
3281 return;
3283 SkippedChecks, ArraySize);
3284 }
3285
3289 llvm::Value *ArraySize = nullptr) {
3291 return;
3293 SkippedChecks, ArraySize);
3294 }
3295
3296
3297
3298
3302 llvm::Value *ArraySize = nullptr);
3303
3304
3305
3306
3308 QualType IndexType, bool Accessed);
3310 llvm::Value *Index, QualType IndexType,
3311 QualType IndexedType, bool Accessed);
3312
3313
3314
3318 uint64_t &Offset);
3319
3323
3324
3328
3330 bool isInc, bool isPre);
3332 bool isInc, bool isPre);
3333
3334
3336
3337
3339
3340
3341
3342
3343
3344
3345
3346
3347
3349
3350
3351
3352
3354
3356 bool capturedByInit);
3357
3360
3361
3362
3364
3365
3366
3367
3369
3372
3374
3375
3376
3377
3378
3380
3381 llvm::Value *NRVOFlag;
3382
3383
3384
3385 bool IsEscapingByRef;
3386
3387
3388
3389 bool IsConstantAggregate;
3390
3391
3392 llvm::Value *SizeForLifetimeMarkers;
3393
3394
3395
3397
3398 struct Invalid {};
3402
3403 AutoVarEmission(const VarDecl &variable)
3404 : Variable(&variable), Addr(Address::invalid()), NRVOFlag(nullptr),
3405 IsEscapingByRef(false), IsConstantAggregate(false),
3406 SizeForLifetimeMarkers(nullptr), AllocaAddr(RawAddress::invalid()) {}
3407
3408 bool wasEmittedAsGlobal() const { return !Addr.isValid(); }
3409
3410 public:
3412
3414 return SizeForLifetimeMarkers != nullptr;
3415 }
3418 return SizeForLifetimeMarkers;
3419 }
3420
3421
3422
3423
3425 return Addr;
3426 }
3427
3428
3430
3431
3432
3433
3435 if (!IsEscapingByRef) return Addr;
3436
3438 }
3439 };
3445
3446
3447
3448
3449
3450
3453 bool EmitDebugInfo);
3454
3456 llvm::GlobalValue::LinkageTypes Linkage);
3457
3459 union {
3462 };
3463
3464 bool IsIndirect;
3465
3468
3469 public:
3472 }
3476 }
3477
3482 assert(.hasOffset() && "unexpected offset");
3484 }
3485
3489 }
3490
3493 return Addr;
3494 }
3495 };
3496
3497
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3511
3515 llvm::Value *Alignment,
3516 llvm::Value *OffsetValue,
3517 llvm::Value *TheCheck,
3518 llvm::Instruction *Assumption);
3519
3522 llvm::Value *Alignment,
3523 llvm::Value *OffsetValue = nullptr);
3524
3527 llvm::Value *Alignment,
3528 llvm::Value *OffsetValue = nullptr);
3529
3530
3531
3532
3533
3534
3536
3537
3538
3539
3540
3541
3542
3544
3545
3546
3547
3548
3549
3550
3552
3556 bool GetLast = false,
3559
3560
3561
3563
3569
3582
3588
3593 bool ignoreResult = false);
3597 bool ignoreResult = false);
3600
3603
3611
3613 llvm::Function *FinallyFunc);
3615 const Stmt *OutlinedStmt);
3616
3619
3622
3624 llvm::Value *ParentFP,
3625 llvm::Value *EntryEBP);
3629
3630
3632
3633
3634
3635
3637 bool IsFilter);
3638
3639
3640
3641
3642
3643
3646 llvm::Value *ParentFP);
3647
3650
3651
3654
3655 public:
3657 bool HasCancel)
3658 : CGF(CGF) {
3659 CGF.OMPCancelStack.enter(CGF, Kind, HasCancel);
3660 }
3662 };
3663
3664
3676
3677
3678
3679
3680
3681
3682
3683
3684
3687 const llvm::function_ref<void(Address, Address)> CopyGen);
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3719 const llvm::function_ref<RValue(RValue)> CommonGen);
3726 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3727 CaptureDeviceAddrMap);
3730 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3731 CaptureDeviceAddrMap);
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3757
3758
3759
3760
3761
3762
3763
3765 bool NoFinals,
3766 llvm::Value *IsLastIterCond = nullptr);
3767
3770
3771
3772
3775 const llvm::function_ref<llvm::Value *(CodeGenFunction &)> CondGen);
3776
3777
3778
3779
3780
3781
3782
3785 bool ForInscan = false);
3786
3787
3788
3789
3790
3793
3794
3795
3796
3797
3798
3800
3801 typedef const llvm::function_ref<void(CodeGenFunction & ,
3802 llvm::Function * ,
3822 };
3868 void
3871 void
3879 void
3881 void
3901 void
3926
3927
3929 StringRef ParentName,
3931 static void
3934
3938
3942
3943 static void
3946
3950
3954
3956 StringRef ParentName,
3958
3959
3963
3964
3968
3969
3973
3977
3978
3979
3980
3981
3982
3984 int Depth);
3985
3986
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
4001 const Expr *LoopCond, const Expr *IncExpr,
4002 const llvm::function_ref<void(CodeGenFunction &)> BodyGen,
4003 const llvm::function_ref<void(CodeGenFunction &)> PostIncGen);
4004
4006
4009
4010
4012
4013
4014
4015
4019
4020
4023
4024
4028 const llvm::function_ref<llvm::Value *(CodeGenFunction &)> CondGen);
4029
4030
4032
4033private:
4034
4036
4037
4038 struct OMPLoopArguments {
4039
4041
4043
4045
4047
4048 llvm::Value *Chunk = nullptr;
4049
4050 Expr *EUB = nullptr;
4051
4052 Expr *IncExpr = nullptr;
4053
4054 Expr *Init = nullptr;
4055
4056 Expr *Cond = nullptr;
4057
4058 Expr *NextLB = nullptr;
4059
4060 Expr *NextUB = nullptr;
4061
4063 OMPLoopArguments() = default;
4065 llvm::Value *Chunk = nullptr, Expr *EUB = nullptr,
4066 Expr *IncExpr = nullptr, Expr *Init = nullptr,
4067 Expr *Cond = nullptr, Expr *NextLB = nullptr,
4068 Expr *NextUB = nullptr)
4069 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
4070 IncExpr(IncExpr), Init(Init), Cond(Cond), NextLB(NextLB),
4071 NextUB(NextUB) {}
4072 };
4073 void EmitOMPOuterLoop(bool DynamicOrOrdered, bool IsMonotonic,
4075 const OMPLoopArguments &LoopArgs,
4078 void EmitOMPForOuterLoop(const OpenMPScheduleTy &ScheduleKind,
4080 OMPPrivateScope &LoopScope, bool Ordered,
4081 const OMPLoopArguments &LoopArgs,
4085 OMPPrivateScope &LoopScope,
4086 const OMPLoopArguments &LoopArgs,
4088
4090
4091public:
4092
4093
4094
4096
4097
4098
4099 EmitStmt(S.getStructuredBlock());
4100 }
4101
4103
4104
4105
4107 }
4108
4110
4111
4112
4114 }
4115
4117
4118
4119
4120 EmitStmt(S.getStructuredBlock());
4121 }
4122
4124
4125
4126 }
4127
4129
4130
4131 }
4132
4134
4135
4136
4137 EmitStmt(S.getStructuredBlock());
4138 }
4139
4141
4142
4143 }
4144
4146
4147
4148 }
4149
4151
4152
4153 }
4154
4156
4157
4158 }
4159
4161
4162
4163 }
4164
4165
4166
4167
4168
4169
4171
4172
4174
4175
4176
4177
4179 const char *Name);
4180
4181
4182
4184 const char *Name);
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4204
4205private:
4207
4208public:
4209
4210
4211
4213
4216
4218
4220
4223
4225 llvm::AtomicOrdering AO, bool IsVolatile = false,
4227
4229
4231 bool IsVolatile, bool isInit);
4232
4235 llvm::AtomicOrdering Success =
4236 llvm::AtomicOrdering::SequentiallyConsistent,
4237 llvm::AtomicOrdering Failure =
4238 llvm::AtomicOrdering::SequentiallyConsistent,
4240
4241
4242
4244 llvm::AtomicRMWInst::BinOp Op, Address Addr, llvm::Value *Val,
4245 llvm::AtomicOrdering Order = llvm::AtomicOrdering::SequentiallyConsistent,
4246 llvm::SyncScope::ID SSID = llvm::SyncScope::System,
4248
4250 const llvm::function_ref<RValue(RValue)> &UpdateOp,
4251 bool IsVolatile);
4252
4253
4254
4256
4257
4258
4260
4261
4262
4263
4264
4267
4268
4269
4270
4274 bool isNontemporal = false) {
4277 }
4278
4282 bool isNontemporal = false);
4283
4284
4285
4286
4287
4289
4290
4291
4292
4296 bool isInit = false, bool isNontemporal = false) {
4299 }
4300
4304 bool isInit = false, bool isNontemporal = false);
4305
4306
4307
4308
4309
4310
4312
4313
4314
4315
4320
4321
4325
4326
4327
4328
4332
4333
4334
4335
4336
4337
4338
4340 llvm::Value **Result=nullptr);
4341
4342
4346 llvm::Value *&Result);
4347
4348
4351
4353 llvm::CallBase **CallOrInvoke = nullptr);
4354
4362 bool Accessed = false);
4366 bool IsLowerBound = true);
4378
4383
4385
4387
4391
4393 llvm::PointerIntPair<llvm::Constant*, 1, bool> ValueAndIsReference;
4396 public:
4400 }
4403 }
4404
4405 explicit operator bool() const {
4406 return ValueAndIsReference.getOpaqueValue() != nullptr;
4407 }
4408
4409 bool isReference() const { return ValueAndIsReference.getInt(); }
4414 }
4415
4418 return ValueAndIsReference.getPointer();
4419 }
4420 };
4421
4425
4429
4437 llvm::Value *ThisValue);
4438
4439
4440
4441
4444
4447 unsigned CVRQualifiers);
4448
4453
4460
4461
4462
4463
4464
4465
4466
4467
4470 llvm::CallBase **CallOrInvoke, bool IsMustTail,
4472 bool IsVirtualFunctionPointerThunk = false);
4475 llvm::CallBase **CallOrInvoke = nullptr,
4476 bool IsMustTail = false) {
4479 }
4482 llvm::CallBase **CallOrInvoke = nullptr,
4484
4485
4486
4489 llvm::CallBase **CallOrInvoke = nullptr);
4491 llvm::CallBase **CallOrInvoke = nullptr);
4493
4496
4498 const Twine &name = "");
4501 const Twine &name = "");
4503 const Twine &name = "");
4506 const Twine &name = "");
4509 const Twine &name = "");
4510
4513
4516 const Twine &Name = "");
4519 const Twine &name = "");
4521 const Twine &name = "");
4524
4527 llvm::Type *Ty);
4528
4532
4534
4535
4537 llvm::Value *Discriminator);
4539 llvm::Value *StorageAddress,
4542
4545
4548
4552 bool IsKnownNonNull);
4556
4560
4565
4567
4570 }
4571
4572
4573
4576 bool IsVolatile,
4578
4579
4582 bool IsVolatile,
4584
4585
4586
4594
4598 llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *E,
4599 CallArgList *RtlArgs, llvm::CallBase **CallOrInvoke);
4601 llvm::Value *This, QualType ThisTy,
4602 llvm::Value *ImplicitParam,
4604 llvm::CallBase **CallOrInvoke = nullptr);
4607 llvm::CallBase **CallOrInvoke = nullptr);
4611 const Expr *Base, llvm::CallBase **CallOrInvoke);
4612
4614 llvm::Value *memberPtr,
4620 llvm::CallBase **CallOrInvoke);
4621
4625 llvm::CallBase **CallOrInvoke);
4627
4630 llvm::CallBase **CallOrInvoke);
4631
4634
4637
4639
4640
4642
4643
4645
4647
4651
4653 llvm::CallBase **CallOrInvoke);
4654
4655
4656
4659
4661 const llvm::CmpInst::Predicate Fp,
4662 const llvm::CmpInst::Predicate Ip,
4663 const llvm::Twine &Name = "");
4666 llvm::Triple::ArchType Arch);
4669 llvm::Triple::ArchType Arch);
4672 llvm::Triple::ArchType Arch);
4677
4679 unsigned LLVMIntrinsic,
4680 unsigned AltLLVMIntrinsic,
4681 const char *NameHint,
4682 unsigned Modifier,
4686 llvm::Triple::ArchType Arch);
4687
4689 unsigned Modifier, llvm::Type *ArgTy,
4693 const char *name,
4694 unsigned shift = 0, bool rightshift = false);
4696 const llvm::ElementCount &Count);
4699 bool negateForRightShift);
4701 llvm::Type *Ty, bool usgn, const char *name);
4703
4704
4705
4707
4717 llvm::Type *ReturnType,
4721 llvm::Value *EmitSVEDupX(llvm::Value *Scalar, llvm::Type *Ty);
4725 unsigned BuiltinID);
4728 unsigned BuiltinID);
4730 llvm::ScalableVectorType *VTy);
4732 llvm::StructType *Ty);
4735 unsigned IntID);
4738 unsigned IntID);
4741 unsigned BuiltinID, bool IsZExtReturn);
4744 unsigned BuiltinID);
4747 unsigned BuiltinID);
4750 unsigned IntID);
4753 unsigned IntID);
4756 unsigned IntID);
4758
4761 unsigned IntID);
4764 unsigned IntID);
4767 unsigned IntID);
4770 unsigned IntID);
4771
4775
4777
4779 llvm::Triple::ArchType Arch);
4781
4798
4804
4808 llvm::AtomicOrdering &AO,
4809 llvm::SyncScope::ID &SSID);
4810
4811 enum class MSVCIntrin;
4813
4815
4826
4827
4828
4832 }
4833
4834
4847 bool resultIgnored);
4849 bool resultIgnored);
4860
4863 llvm::Type *returnType);
4865
4866 std::pair<LValue,llvm::Value*>
4868 std::pair<LValue,llvm::Value*>
4870 std::pair<LValue,llvm::Value*>
4872
4874 llvm::Type *returnType);
4876 llvm::Type *returnType);
4878
4882
4885 bool allowUnsafeClaim);
4889
4891
4893
4899
4905
4906
4908
4909
4910
4911
4912
4913
4914
4915
4916
4918
4919
4920
4923
4924
4925
4929
4930
4931
4932
4934
4935
4936
4938
4940
4941
4942
4945
4946
4947
4949 bool DstIsVolatile);
4950
4951
4952
4954
4955
4956
4958 bool IgnoreReal = false,
4959 bool IgnoreImag = false);
4960
4961
4962
4964
4965
4967
4968
4970
4975
4978
4979
4980
4981
4982
4983 llvm::GlobalVariable *
4985 llvm::GlobalVariable *GV);
4986
4987
4989
4990
4991
4993 bool PerformInit);
4994
4996 llvm::Constant *Addr);
4997
4999 llvm::FunctionCallee Dtor,
5000 llvm::Constant *Addr,
5001 llvm::FunctionCallee &AtExit);
5002
5003
5004
5006 llvm::Constant *addr);
5007
5008
5009
5011 llvm::Constant *addr);
5012
5013
5015
5016
5018
5019
5020
5021
5022
5023
5025 bool PerformInit);
5026
5028
5029
5031 llvm::BasicBlock *InitBlock,
5032 llvm::BasicBlock *NoInitBlock,
5034
5035
5036
5037 void
5041
5042
5043
5045 llvm::Function *Fn,
5046 ArrayRef<std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
5047 llvm::Constant *>>
5048 DtorsOrStermFinalizers);
5049
5052 llvm::GlobalVariable *Addr,
5053 bool PerformInit);
5054
5056
5058
5060
5062
5063
5064
5065
5066
5067
5069 llvm::Value *AnnotatedVal,
5070 StringRef AnnotationStr,
5072 const AnnotateAttr *Attr);
5073
5074
5076
5077
5078
5080
5081
5082
5083
5084
5085
5086
5087
5089
5090
5091
5092
5094
5095
5096
5098
5099
5100
5101
5103 bool AllowLabels = false);
5104
5105
5106
5107
5109 bool AllowLabels = false);
5110
5111
5113
5114
5115
5117
5118
5119
5120
5121
5123 llvm::BasicBlock *TrueBlock,
5124 llvm::BasicBlock *FalseBlock,
5125 uint64_t TrueCount = 0,
5127 const Expr *CntrIdx = nullptr);
5128
5129
5130
5131
5132
5133
5135 llvm::BasicBlock *FalseBlock, uint64_t TrueCount,
5137 const Expr *ConditionalOp = nullptr);
5138
5139
5140
5142
5143
5144
5146
5147
5148
5149
5150
5151
5154 bool SignedIndices,
5157 const Twine &Name = "");
5158
5160 llvm::Type *elementType, bool SignedIndices,
5162 CharUnits Align, const Twine &Name = "");
5163
5164
5165
5170 };
5171
5172
5173
5175
5176
5177
5179
5180
5181
5183
5184
5185
5187
5188
5189
5191
5194
5195
5196
5197
5198 void
5200 Checked,
5203
5204
5205
5207 llvm::Value *Cond, llvm::ConstantInt *TypeId,
5208 llvm::Value *Ptr,
5210
5211
5212
5214
5215
5216
5218 bool NoMerge = false);
5219
5220
5221
5223
5224
5226
5227
5229
5230
5231
5234
5237 unsigned ParmNum);
5238
5239
5241
5242
5244
5245
5246
5247
5250
5251
5252
5254
5255
5256
5258
5259
5260
5262
5263
5265
5266
5268 unsigned NumElementsDst,
5269 const llvm::Twine &Name = "");
5270
5271private:
5272
5273
5274 llvm::ConvergenceControlInst *emitConvergenceLoopToken(llvm::BasicBlock *BB);
5275
5276
5277
5278 llvm::CallBase *addConvergenceControlToken(llvm::CallBase *Input);
5279
5280
5281
5282 llvm::ConvergenceControlInst *
5283 getOrEmitConvergenceEntryToken(llvm::Function *F);
5284
5285private:
5286 llvm::MDNode *getRangeForLoadFromType(QualType Ty);
5288
5289 void deferPlaceholderReplacement(llvm::Instruction *Old, llvm::Value *New);
5290
5292 DeferredReplacements;
5293
5294
5295 void setAddrOfLocalVar(const VarDecl *VD, Address Addr) {
5296 assert(!LocalDeclMap.count(VD) && "Decl already exists in LocalDeclMap!");
5297 LocalDeclMap.insert({VD, Addr});
5298 }
5299
5300
5301
5302
5303
5304 void ExpandTypeFromArgs(QualType Ty, LValue Dst,
5305 llvm::Function::arg_iterator &AI);
5306
5307
5308
5309
5310 void ExpandTypeToArgs(QualType Ty, CallArg Arg, llvm::FunctionType *IRFuncTy,
5312 unsigned &IRCallArgPos);
5313
5314 std::pair<llvm::Value *, llvm::Type *>
5316 std::string &ConstraintStr);
5317
5318 std::pair<llvm::Value *, llvm::Type *>
5320 QualType InputType, std::string &ConstraintStr,
5322
5323
5324
5325
5326
5327
5328 llvm::Value *evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type,
5329 llvm::IntegerType *ResType,
5330 llvm::Value *EmittedE,
5331 bool IsDynamic);
5332
5333
5334
5335
5336 llvm::Value *emitBuiltinObjectSize(const Expr *E, unsigned Type,
5337 llvm::IntegerType *ResType,
5338 llvm::Value *EmittedE,
5339 bool IsDynamic);
5340
5341 llvm::Value *emitFlexibleArrayMemberSize(const Expr *E, unsigned Type,
5342 llvm::IntegerType *ResType);
5343
5345 Address Loc);
5346
5347public:
5349
5351
5353
5355 };
5356
5357
5358
5360 llvm::PointerUnion<const FunctionProtoType *, const ObjCMethodDecl *> P;
5361
5364 };
5365
5367 llvm::iterator_rangeCallExpr::const\_arg\_iterator ArgRange,
5369 unsigned ParamsToSkip = 0,
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5393
5394
5395
5396
5398
5400
5405
5407 std::optional Arch = std::nullopt)
5409 };
5410
5411
5412
5413
5422
5423private:
5425
5426 void EmitDeclMetadata();
5427
5428 BlockByrefHelpers *buildByrefHelpers(llvm::StructType &byrefType,
5430
5431 void AddObjCARCExceptionMetadata(llvm::Instruction *Inst);
5432
5433 llvm::Value *GetValueForARMHint(unsigned BuiltinID);
5434 llvm::Value *EmitX86CpuIs(const CallExpr *E);
5435 llvm::Value *EmitX86CpuIs(StringRef CPUStr);
5436 llvm::Value *EmitX86CpuSupports(const CallExpr *E);
5438 llvm::Value *EmitX86CpuSupports(std::array<uint32_t, 4> FeatureMask);
5439 llvm::Value *EmitX86CpuInit();
5440 llvm::Value *FormX86ResolverCondition(const FMVResolverOption &RO);
5441 llvm::Value *EmitAArch64CpuInit();
5442 llvm::Value *FormAArch64ResolverCondition(const FMVResolverOption &RO);
5443 llvm::Value *EmitAArch64CpuSupports(const CallExpr *E);
5445};
5446
5450
5451
5453 CGF.CGM.getDataLayout().getPrefTypeAlign(value->getType()));
5455 CGF.CreateTempAlloca(value->getType(), align, "cond-cleanup.save");
5457
5459}
5460
5463
5464 if (!value.getInt()) return value.getPointer();
5465
5466
5467 auto alloca = castllvm::AllocaInst(value.getPointer());
5469 alloca->getAlign());
5470}
5471
5472}
5473
5474
5475
5476llvm::fp::ExceptionBehavior
5478}
5479
5480#endif
Enums/classes describing ABI related information about constructors, destructors and thunks.
static bool CanThrow(Expr *E, ASTContext &Ctx)
enum clang::sema::@1727::IndirectLocalPathEntry::EntryKind Kind
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::MachO::Architecture Architecture
llvm::MachO::Target Target
Defines some OpenMP-specific enums and functions.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
C Language Family Type Representation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
Represents an attribute applied to a statement.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
A builtin binary operation expression such as "x + y" or "x <= y".
static bool isLogicalOp(Opcode Opc)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
BreakStmt - This represents a break.
Represents a call to a CUDA kernel function.
Represents binding an expression to a temporary.
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
A call to an overloaded operator written using operator syntax.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
Represents a C++ temporary.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Describes the capture of either a variable, or 'this', or variable-length array type.
This captures a statement into a function.
CaseStmt - Represent a case statement.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
const CXXBaseSpecifier *const * path_const_iterator
CharUnits - This is an opaque type for sizes expressed in character units.
bool isZero() const
isZero - Test whether the quantity equals zero.
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Represents a 'co_await' expression.
bool hasProfileClangInstr() const
Check if Clang profile instrumenation is on.
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * getBasePointer() const
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
CharUnits getAlignment() const
llvm::Type * getElementType() const
Return the type of the values stored in this address.
void setAlignment(CharUnits Value)
llvm::Value * getOffset() const
void replaceBasePointer(llvm::Value *P)
This function is used in situations where the caller is doing some sort of opaque "laundering" of the...
llvm::PointerType * getType() const
Return the type of the pointer value.
static AggValueSlot ignored()
ignored - Returns an aggregate value slot indicating that the aggregate value is being ignored.
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.
A scoped helper to set the current debug location to the specified location or preferred location of ...
static ApplyDebugLocation CreateArtificial(CodeGenFunction &CGF)
Apply TemporaryLocation if it is valid.
A pair of helper functions for a __block variable.
Information about the layout of a __block variable.
CGBlockInfo - Information to generate a block literal.
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
llvm::LoadInst * CreateFlagLoad(llvm::Value *Addr, const llvm::Twine &Name="")
Emit a load from an i1 flag variable.
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Implements C++ ABI-specific code generation functions.
All available information about a concrete callee.
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
CGFunctionInfo - Class to encapsulate the information about a function definition.
CallArgList - Type for representing both the value and type of arguments in a call.
An abstract representation of regular/ObjC call/message targets.
AbstractCallee(const ObjCMethodDecl *OMD)
const ParmVarDecl * getParamDecl(unsigned I) const
const Decl * getDecl() const
unsigned getNumParams() const
bool hasFunctionDecl() const
AbstractCallee(const FunctionDecl *FD)
The scope of an ArrayInitLoopExpr.
ArrayInitLoopExprScope(CodeGenFunction &CGF, llvm::Value *Index)
~ArrayInitLoopExprScope()
Address getAllocatedAddress() const
Returns the raw, allocated address, which is not necessarily the address of the object itself.
llvm::Value * getSizeForLifetimeMarkers() const
bool useLifetimeMarkers() const
RawAddress getOriginalAllocatedAddress() const
Returns the address for the original alloca instruction.
Address getObjectAddress(CodeGenFunction &CGF) const
Returns the address of the object within this declaration.
static AutoVarEmission invalid()
API for captured statement code generation.
CapturedRegionKind getKind() const
virtual llvm::Value * getContextValue() const
virtual ~CGCapturedStmtInfo()
static bool classof(const CGCapturedStmtInfo *)
virtual void setContextValue(llvm::Value *V)
bool isCXXThisExprCaptured() const
virtual FieldDecl * getThisFieldDecl() const
llvm::SmallDenseMap< const VarDecl *, FieldDecl * > getCaptureFields()
Get the CaptureFields.
CGCapturedStmtInfo(CapturedRegionKind K=CR_Default)
virtual void EmitBody(CodeGenFunction &CGF, const Stmt *S)
Emit the captured statement body.
virtual StringRef getHelperName() const
Get the name of the capture helper.
CGCapturedStmtInfo(const CapturedStmt &S, CapturedRegionKind K=CR_Default)
virtual const FieldDecl * lookup(const VarDecl *VD) const
Lookup the captured field decl for a variable.
RAII for correct setting/restoring of CapturedStmtInfo.
CGCapturedStmtRAII(CodeGenFunction &CGF, CGCapturedStmtInfo *NewCapturedStmtInfo)
The scope of a CXXDefaultInitExpr.
CharUnits OldCXXThisAlignment
~CXXDefaultInitExprScope()
SourceLocExprScopeGuard SourceLocScope
llvm::Value * OldCXXThisValue
CXXDefaultInitExprScope(CodeGenFunction &CGF, const CXXDefaultInitExpr *E)
void Emit(CodeGenFunction &CGF, Flags flags) override
Emit the cleanup.
CallLifetimeEnd(RawAddress addr, llvm::Value *size)
An object to manage conditionally-evaluated expressions.
llvm::BasicBlock * getStartingBlock() const
Returns a block which will be executed prior to each evaluation of the conditional code.
void begin(CodeGenFunction &CGF)
ConditionalEvaluation(CodeGenFunction &CGF)
void end(CodeGenFunction &CGF)
static ConstantEmission forValue(llvm::Constant *C)
static ConstantEmission forReference(llvm::Constant *C)
llvm::Constant * getValue() const
LValue getReferenceLValue(CodeGenFunction &CGF, Expr *refExpr) const
A scope within which we are constructing the fields of an object which might use a CXXDefaultInitExpr...
FieldConstructionScope(CodeGenFunction &CGF, Address This)
~FieldConstructionScope()
A class controlling the emission of a finally block.
void exit(CodeGenFunction &CGF)
void enter(CodeGenFunction &CGF, const Stmt *Finally, llvm::FunctionCallee beginCatchFn, llvm::FunctionCallee endCatchFn, llvm::FunctionCallee rethrowFn)
Enters a finally block for an implementation using zero-cost exceptions.
InlinedInheritingConstructorScope(CodeGenFunction &CGF, GlobalDecl GD)
~InlinedInheritingConstructorScope()
void rescopeLabels()
Change the cleanup scope of the labels in this lexical scope to match the scope of the enclosing cont...
void addLabel(const LabelDecl *label)
LexicalScope(CodeGenFunction &CGF, SourceRange Range)
Enter a new cleanup scope.
void ForceCleanup()
Force the emission of cleanups now, instead of waiting until this object is destroyed.
~LexicalScope()
Exit this cleanup scope, emitting any accumulated cleanups.
RAII for preserving necessary info during inlined region body codegen.
InlinedRegionBodyRAII(CodeGenFunction &cgf, InsertPointTy &AllocaIP, llvm::BasicBlock &FiniBB)
Cleanup action for allocate support.
OMPAllocateCleanupTy(llvm::CallInst *RLFnCI)
void Emit(CodeGenFunction &CGF, Flags) override
Emit the cleanup.
RAII for preserving necessary info during Outlined region body codegen.
OutlinedRegionBodyRAII(CodeGenFunction &cgf, InsertPointTy &AllocaIP, llvm::BasicBlock &RetBB)
~OutlinedRegionBodyRAII()
Controls insertion of cancellation exit blocks in worksharing constructs.
OMPCancelStackRAII(CodeGenFunction &CGF, OpenMPDirectiveKind Kind, bool HasCancel)
Save/restore original map of previously emitted local vars in case when we need to duplicate emission...
OMPLocalDeclMapRAII(CodeGenFunction &CGF)
The class used to assign some variables some temporarily addresses.
bool apply(CodeGenFunction &CGF)
Applies new addresses to the list of the variables.
void restore(CodeGenFunction &CGF)
Restores original addresses of the variables.
bool setVarAddr(CodeGenFunction &CGF, const VarDecl *LocalVD, Address TempAddr)
Sets the address of the variable LocalVD to be TempAddr in function CGF.
The scope used to remap some variables as private in the OpenMP loop body (or other captured region e...
void restoreMap()
Restore all mapped variables w/o clean up.
bool Privatize()
Privatizes local variables previously registered as private.
bool isGlobalVarCaptured(const VarDecl *VD) const
Checks if the global variable is captured in current function.
OMPPrivateScope(CodeGenFunction &CGF)
Enter a new OpenMP private scope.
~OMPPrivateScope()
Exit scope - all the mapped variables are restored.
bool addPrivate(const VarDecl *LocalVD, Address Addr)
Registers LocalVD variable as a private with Addr as the address of the corresponding private variabl...
A non-RAII class containing all the information about a bound opaque value.
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const LValue &lv)
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const RValue &rv)
static bool shouldBindAsLValue(const Expr *expr)
void unbind(CodeGenFunction &CGF)
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const Expr *e)
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *OV)
Build the opaque value mapping for an OpaqueValueExpr whose source expression is set to the expressio...
OpaqueValueMapping(CodeGenFunction &CGF, const AbstractConditionalOperator *op)
Build the opaque value mapping for the given conditional operator if it's the GNU ?...
static bool shouldBindAsLValue(const Expr *expr)
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *opaqueValue, RValue rvalue)
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *opaqueValue, LValue lvalue)
llvm::Value * getDirectValue() const
Address getIndirectAddress() const
static ParamValue forIndirect(Address addr)
static ParamValue forDirect(llvm::Value *value)
llvm::Value * getAnyValue() const
Manages parent directive for scan directives.
ParentLoopDirectiveForScanRegion(CodeGenFunction &CGF, const OMPExecutableDirective &ParentLoopDirectiveForScan)
~ParentLoopDirectiveForScanRegion()
An object which temporarily prevents a value from being destroyed by aggressive peephole optimization...
PeepholeProtection()=default
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited.
RunCleanupsScope(CodeGenFunction &CGF)
Enter a new cleanup scope.
~RunCleanupsScope()
Exit this cleanup scope, emitting any accumulated cleanups.
void ForceCleanup(std::initializer_list< llvm::Value ** > ValuesToReload={})
Force the emission of cleanups now, instead of waiting until this object is destroyed.
bool requiresCleanups() const
Determine whether this scope requires any cleanups.
RAII object to set/unset CodeGenFunction::IsSanitizerScope.
An RAII object to record that we're evaluating a statement expression.
StmtExprEvaluation(CodeGenFunction &CGF)
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
void GenerateObjCCtorDtorMethod(ObjCImplementationDecl *IMP, ObjCMethodDecl *MD, bool ctor)
llvm::Value * EmitAArch64BuiltinExpr(unsigned BuiltinID, const CallExpr *E, llvm::Triple::ArchType Arch)
void emitAutoVarTypeCleanup(const AutoVarEmission &emission, QualType::DestructionKind dtorKind)
EHScopeStack::stable_iterator CurrentCleanupScopeDepth
llvm::Value * EmitFromMemory(llvm::Value *Value, QualType Ty)
EmitFromMemory - Change a scalar value from its memory representation to its value representation.
void GenerateCXXGlobalInitFunc(llvm::Function *Fn, ArrayRef< llvm::Function * > CXXThreadLocals, ConstantAddress Guard=ConstantAddress::invalid())
GenerateCXXGlobalInitFunc - Generates code for initializing global variables.
llvm::Value * EmitPointerAuthAuth(const CGPointerAuthInfo &Info, llvm::Value *Pointer)
LValue EmitOpaqueValueLValue(const OpaqueValueExpr *e)
RValue EmitLoadOfGlobalRegLValue(LValue LV)
void EmitGotoStmt(const GotoStmt &S)
void EmitSynthesizedCXXCopyCtorCall(const CXXConstructorDecl *D, Address This, Address Src, const CXXConstructExpr *E)
void EmitDestructorBody(FunctionArgList &Args)
void EmitOMPTaskBasedDirective(const OMPExecutableDirective &S, const OpenMPDirectiveKind CapturedRegion, const RegionCodeGenTy &BodyGen, const TaskGenTy &TaskGen, OMPTaskDataTy &Data)
void StartObjCMethod(const ObjCMethodDecl *MD, const ObjCContainerDecl *CD)
llvm::BasicBlock * getEHDispatchBlock(EHScopeStack::stable_iterator scope)
void EmitOMPTargetTeamsDirective(const OMPTargetTeamsDirective &S)
void pushCallObjectDeleteCleanup(const FunctionDecl *OperatorDelete, llvm::Value *CompletePtr, QualType ElementType)
llvm::Value * EmitMSVCBuiltinExpr(MSVCIntrin BuiltinID, const CallExpr *E)
void EmitBranchToCounterBlock(const Expr *Cond, BinaryOperator::Opcode LOp, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock, uint64_t TrueCount=0, Stmt::Likelihood LH=Stmt::LH_None, const Expr *CntrIdx=nullptr)
EmitBranchToCounterBlock - Emit a conditional branch to a new block that increments a profile counter...
LValue EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E)
void EmitARCDestroyWeak(Address addr)
void FinishFunction(SourceLocation EndLoc=SourceLocation())
FinishFunction - Complete IR generation of the current function.
LValue EmitCompoundLiteralLValue(const CompoundLiteralExpr *E)
void EmitNullInitialization(Address DestPtr, QualType Ty)
EmitNullInitialization - Generate code to set a value of the given type to null, If the type contains...
void enterByrefCleanup(CleanupKind Kind, Address Addr, BlockFieldFlags Flags, bool LoadBlockVarAddr, bool CanThrow)
Enter a cleanup to destroy a __block variable.
void CreateCoercedStore(llvm::Value *Src, Address Dst, llvm::TypeSize DstSize, bool DstIsVolatile)
Create a store to.
void EmitOMPParallelGenericLoopDirective(const OMPLoopDirective &S)
void EmitOMPAggregateAssign(Address DestAddr, Address SrcAddr, QualType OriginalType, const llvm::function_ref< void(Address, Address)> CopyGen)
Perform element by element copying of arrays with type OriginalType from SrcAddr to DestAddr using co...
llvm::Value * EmitLifetimeStart(llvm::TypeSize Size, llvm::Value *Addr)
void EmitPointerAuthOperandBundle(const CGPointerAuthInfo &Info, SmallVectorImpl< llvm::OperandBundleDef > &Bundles)
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, llvm::Value *V, QualType Type, CharUnits Alignment=CharUnits::Zero(), SanitizerSet SkippedChecks=SanitizerSet(), llvm::Value *ArraySize=nullptr)
Emit a check that V is the address of storage of the appropriate size and alignment for an object of ...
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
llvm::Value * GetVTablePtr(Address This, llvm::Type *VTableTy, const CXXRecordDecl *VTableClass, VTableAuthMode AuthMode=VTableAuthMode::Authenticate)
GetVTablePtr - Return the Value of the vtable pointer member pointed to by This.
Address EmitCXXMemberDataPointerAddress(const Expr *E, Address base, llvm::Value *memberPtr, const MemberPointerType *memberPtrType, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr)
void EmitOMPMaskedTaskLoopSimdDirective(const OMPMaskedTaskLoopSimdDirective &S)
std::pair< RValue, llvm::Value * > EmitAtomicCompareExchange(LValue Obj, RValue Expected, RValue Desired, SourceLocation Loc, llvm::AtomicOrdering Success=llvm::AtomicOrdering::SequentiallyConsistent, llvm::AtomicOrdering Failure=llvm::AtomicOrdering::SequentiallyConsistent, bool IsWeak=false, AggValueSlot Slot=AggValueSlot::ignored())
void EmitAsanPrologueOrEpilogue(bool Prologue)
llvm::Value * EmitARCExtendBlockObject(const Expr *expr)
bool checkIfLoopMustProgress(const Expr *, bool HasEmptyBody)
Returns true if a loop must make progress, which means the mustprogress attribute can be added.
void DeactivateCleanupBlock(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *DominatingIP)
DeactivateCleanupBlock - Deactivates the given cleanup block.
llvm::Value * EmitNonNullRValueCheck(RValue RV, QualType T)
Create a check that a scalar RValue is non-null.
static TypeEvaluationKind getEvaluationKind(QualType T)
getEvaluationKind - Return the TypeEvaluationKind of QualType T.
static bool ContainsLabel(const Stmt *S, bool IgnoreCaseStmts=false)
ContainsLabel - Return true if the statement contains a label in it.
LValue EmitCastLValue(const CastExpr *E)
void EnterSEHTryStmt(const SEHTryStmt &S)
CurrentSourceLocExprScope CurSourceLocExprScope
Source location information about the default argument or member initializer expression we're evaluat...
void checkTargetFeatures(SourceLocation Loc, const FunctionDecl *TargetDecl)
llvm::Value * EmitSVEPredicateCast(llvm::Value *Pred, llvm::ScalableVectorType *VTy)
Address getExceptionSlot()
Returns a pointer to the function's exception object and selector slot, which is assigned in every la...
RawAddress CreateMemTemp(QualType T, CharUnits Align, const Twine &Name="tmp", RawAddress *Alloca=nullptr)
bool isBinaryLogicalOp(const Expr *E) const
void EmitBranchOnBoolExpr(const Expr *Cond, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock, uint64_t TrueCount, Stmt::Likelihood LH=Stmt::LH_None, const Expr *ConditionalOp=nullptr)
EmitBranchOnBoolExpr - Emit a branch on a boolean condition (e.g.
void VolatilizeTryBlocks(llvm::BasicBlock *BB, llvm::SmallPtrSet< llvm::BasicBlock *, 10 > &V)
void EmitLambdaInAllocaImplFn(const CXXMethodDecl *CallOp, const CGFunctionInfo **ImplFnInfo, llvm::Function **ImplFn)
llvm::Function * GenerateSEHFinallyFunction(CodeGenFunction &ParentCGF, const SEHFinallyStmt &Finally)
llvm::CallInst * EmitTrapCall(llvm::Intrinsic::ID IntrID)
Emit a call to trap or debugtrap and attach function attribute "trap-func-name" if specified.
llvm::Function * GenerateSEHFilterFunction(CodeGenFunction &ParentCGF, const SEHExceptStmt &Except)
static Destroyer destroyNonTrivialCStruct
JumpDest getJumpDestInCurrentScope(llvm::BasicBlock *Target)
The given basic block lies in the current EH scope, but may be a target of a potentially scope-crossi...
bool sanitizePerformTypeCheck() const
Whether any type-checking sanitizers are enabled.
void EmitCallAndReturnForThunk(llvm::FunctionCallee Callee, const ThunkInfo *Thunk, bool IsUnprototyped)
void EmitDelegateCXXConstructorCall(const CXXConstructorDecl *Ctor, CXXCtorType CtorType, const FunctionArgList &Args, SourceLocation Loc)
void EmitSanitizerStatReport(llvm::SanitizerStatKind SSK)
static bool cxxDestructorCanThrow(QualType T)
Check if T is a C++ class that has a destructor that can throw.
void EmitDelegatingCXXConstructorCall(const CXXConstructorDecl *Ctor, const FunctionArgList &Args)
llvm::Function * GenerateVarArgsThunk(llvm::Function *Fn, const CGFunctionInfo &FnInfo, GlobalDecl GD, const ThunkInfo &Thunk)
SanitizerSet SanOpts
Sanitizers enabled for this function.
RValue EmitBuiltinIsAligned(const CallExpr *E)
Emit IR for __builtin_is_aligned.
LValue EmitCoawaitLValue(const CoawaitExpr *E)
llvm::BasicBlock * getInvokeDestImpl()
LValue getOrCreateOpaqueLValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its LValue mapping if it exists, otherwise create one.
void EmitSehCppScopeBegin()
void EmitOMPCopy(QualType OriginalType, Address DestAddr, Address SrcAddr, const VarDecl *DestVD, const VarDecl *SrcVD, const Expr *Copy)
Emit proper copying of data from one variable to another.
void EmitIfStmt(const IfStmt &S)
void EmitForwardingCallToLambda(const CXXMethodDecl *LambdaCallOperator, CallArgList &CallArgs, const CGFunctionInfo *CallOpFnInfo=nullptr, llvm::Constant *CallOpFn=nullptr)
void EmitWhileStmt(const WhileStmt &S, ArrayRef< const Attr * > Attrs={})
void EmitOMPOrderedDirective(const OMPOrderedDirective &S)
void EmitOMPTargetDirective(const OMPTargetDirective &S)
RawAddress createCleanupActiveFlag()
void PushDestructorCleanup(const CXXDestructorDecl *Dtor, QualType T, Address Addr)
PushDestructorCleanup - Push a cleanup to call the complete-object variant of the given destructor on...
llvm::DenseMap< const VarDecl *, llvm::Value * > NRVOFlags
A mapping from NRVO variables to the flags used to indicate when the NRVO has been applied to this va...
LValue EmitAggExprToLValue(const Expr *E)
EmitAggExprToLValue - Emit the computation of the specified expression of aggregate type into a tempo...
bool IsOutlinedSEHHelper
True if the current function is an outlined SEH helper.
void EmitNonNullArgCheck(RValue RV, QualType ArgType, SourceLocation ArgLoc, AbstractCallee AC, unsigned ParmNum)
Create a check for a function parameter that may potentially be declared as non-null.
bool EmitOMPFirstprivateClause(const OMPExecutableDirective &D, OMPPrivateScope &PrivateScope)
void EmitARCMoveWeak(Address dst, Address src)
LValue EmitScalarCompoundAssignWithComplex(const CompoundAssignOperator *E, llvm::Value *&Result)
RValue EmitBlockCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue, llvm::CallBase **CallOrInvoke)
void EmitAArch64MultiVersionResolver(llvm::Function *Resolver, ArrayRef< FMVResolverOption > Options)
void EmitOMPReductionClauseInit(const OMPExecutableDirective &D, OMPPrivateScope &PrivateScope, bool ForInscan=false)
Emit initial code for reduction variables.
llvm::Value * EmitHLSLBuiltinExpr(unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue)
void EmitOMPAtomicDirective(const OMPAtomicDirective &S)
void EmitVTableAssumptionLoad(const VPtr &vptr, Address This)
Emit assumption that vptr load == global vtable.
void unprotectFromPeepholes(PeepholeProtection protection)
Address getAsNaturalAddressOf(Address Addr, QualType PointeeTy)
llvm::CallInst * EmitRuntimeCall(llvm::FunctionCallee callee, ArrayRef< llvm::Value * > args, const Twine &name="")
void startOutlinedSEHHelper(CodeGenFunction &ParentCGF, bool IsFilter, const Stmt *OutlinedStmt)
void EmitOMPTargetEnterDataDirective(const OMPTargetEnterDataDirective &S)
llvm::Value * EmitHexagonBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
void EmitOMPParallelMasterTaskLoopDirective(const OMPParallelMasterTaskLoopDirective &S)
SmallVector< Address, 1 > SEHCodeSlotStack
A stack of exception code slots.
JumpDest getJumpDestInCurrentScope(StringRef Name=StringRef())
The given basic block lies in the current EH scope, but may be a target of a potentially scope-crossi...
void generateObjCGetterBody(const ObjCImplementationDecl *classImpl, const ObjCPropertyImplDecl *propImpl, const ObjCMethodDecl *GetterMothodDecl, llvm::Constant *AtomicHelperFn)
void EmitAutoVarDecl(const VarDecl &D)
EmitAutoVarDecl - Emit an auto variable declaration.
void GetAArch64SVEProcessedOperands(unsigned BuiltinID, const CallExpr *E, SmallVectorImpl< llvm::Value * > &Ops, SVETypeFlags TypeFlags)
llvm::Value * EmitIvarOffsetAsPointerDiff(const ObjCInterfaceDecl *Interface, const ObjCIvarDecl *Ivar)
llvm::Value * EmitAMDGPUBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
llvm::Constant * createAtExitStub(const VarDecl &VD, llvm::FunctionCallee Dtor, llvm::Constant *Addr)
void EmitLambdaStaticInvokeBody(const CXXMethodDecl *MD)
bool ShouldInstrumentFunction()
ShouldInstrumentFunction - Return true if the current function should be instrumented with __cyg_prof...
void EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr)
LValue MakeAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment, AlignmentSource Source=AlignmentSource::Type)
Address EmitCompoundStmtWithoutScope(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
static void EmitOMPTargetTeamsDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetTeamsDirective &S)
Emit device code for the target teams directive.
void pushLifetimeExtendedDestroy(CleanupKind kind, Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
void callCStructDefaultConstructor(LValue Dst)
void EmitOMPReverseDirective(const OMPReverseDirective &S)
static bool hasScalarEvaluationKind(QualType T)
llvm::Value * EmitObjCAutoreleasePoolPush()
bool isCleanupPadScope() const
Returns true while emitting a cleanuppad.
llvm::Value * EmitNeonSplat(llvm::Value *V, llvm::Constant *Idx)
void EmitVTablePtrCheckForCall(const CXXRecordDecl *RD, llvm::Value *VTable, CFITypeCheckKind TCK, SourceLocation Loc)
EmitVTablePtrCheckForCall - Virtual method MD is being called via VTable.
void EmitOpenACCExitDataConstruct(const OpenACCExitDataConstruct &S)
llvm::Value * EmitARCRetainAutoreleaseNonBlock(llvm::Value *value)
void EmitObjCMRRAutoreleasePoolPop(llvm::Value *Ptr)
const BlockByrefInfo & getBlockByrefInfo(const VarDecl *var)
AwaitSuspendWrapperInfo CurAwaitSuspendWrapper
RValue EmitCUDAKernelCallExpr(const CUDAKernelCallExpr *E, ReturnValueSlot ReturnValue, llvm::CallBase **CallOrInvoke)
void EmitMultiVersionResolver(llvm::Function *Resolver, ArrayRef< FMVResolverOption > Options)
llvm::function_ref< std::pair< llvm::Value *, llvm::Value * >(CodeGenFunction &, const OMPExecutableDirective &S, Address LB, Address UB)> CodeGenDispatchBoundsTy
LValue EmitCompoundAssignmentLValue(const CompoundAssignOperator *E)
FieldDecl * LambdaThisCaptureField
CGCapturedStmtInfo * CapturedStmtInfo
void EmitCallArgs(CallArgList &Args, PrototypeWrapper Prototype, llvm::iterator_range< CallExpr::const_arg_iterator > ArgRange, AbstractCallee AC=AbstractCallee(), unsigned ParamsToSkip=0, EvaluationOrder Order=EvaluationOrder::Default)
BuiltinCheckKind
Specifies which type of sanitizer check to apply when handling a particular builtin.
void EmitIndirectGotoStmt(const IndirectGotoStmt &S)
LValue EmitCallExprLValue(const CallExpr *E, llvm::CallBase **CallOrInvoke=nullptr)
void EmitDecl(const Decl &D)
EmitDecl - Emit a declaration.
LValue MakeNaturalAlignPointeeRawAddrLValue(llvm::Value *V, QualType T)
Same as MakeNaturalAlignPointeeAddrLValue except that the pointer is known to be unsigned.
void EmitBoundsCheck(const Expr *E, const Expr *Base, llvm::Value *Index, QualType IndexType, bool Accessed)
Emit a check that Base points into an array object, which we can access at index Index.
Address authPointerToPointerCast(Address Ptr, QualType SourceType, QualType DestType)
void EmitCXXTryStmt(const CXXTryStmt &S)
void EmitBitfieldConversionCheck(llvm::Value *Src, QualType SrcType, llvm::Value *Dst, QualType DstType, const CGBitFieldInfo &Info, SourceLocation Loc)
Emit a check that an [implicit] conversion of a bitfield.
void EmitTrapCheck(llvm::Value *Checked, SanitizerHandler CheckHandlerID, bool NoMerge=false)
Create a basic block that will call the trap intrinsic, and emit a conditional branch to it,...
std::pair< LValue, llvm::Value * > EmitARCStoreStrong(const BinaryOperator *e, bool ignored)
void EmitKCFIOperandBundle(const CGCallee &Callee, SmallVectorImpl< llvm::OperandBundleDef > &Bundles)
RValue EmitCXXMemberOrOperatorCall(const CXXMethodDecl *Method, const CGCallee &Callee, ReturnValueSlot ReturnValue, llvm::Value *This, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *E, CallArgList *RtlArgs, llvm::CallBase **CallOrInvoke)
llvm::Value * EmitCheckedArgForBuiltin(const Expr *E, BuiltinCheckKind Kind)
Emits an argument for a call to a builtin.
bool EmitSimpleStmt(const Stmt *S, ArrayRef< const Attr * > Attrs)
EmitSimpleStmt - Try to emit a "simple" statement which does not necessarily require an insertion poi...
LValue EmitHLSLArrayAssignLValue(const BinaryOperator *E)
void generateThunk(llvm::Function *Fn, const CGFunctionInfo &FnInfo, GlobalDecl GD, const ThunkInfo &Thunk, bool IsUnprototyped)
Generate a thunk for the given method.
void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin, Address arrayEndPointer, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
llvm::Value * EmitARCRetainAutoreleasedReturnValue(llvm::Value *value)
bool inSuspendBlock() const
void emitAlignmentAssumptionCheck(llvm::Value *Ptr, QualType Ty, SourceLocation Loc, SourceLocation AssumptionLoc, llvm::Value *Alignment, llvm::Value *OffsetValue, llvm::Value *TheCheck, llvm::Instruction *Assumption)
llvm::BlockAddress * GetAddrOfLabel(const LabelDecl *L)
static void EmitOMPTargetTeamsDistributeDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetTeamsDistributeDirective &S)
Emit device code for the target teams distribute directive.
Address EmitLoadOfPointer(Address Ptr, const PointerType *PtrTy, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr)
Load a pointer with type PtrTy stored at address Ptr.
RawAddress CreateDefaultAlignTempAlloca(llvm::Type *Ty, const Twine &Name="tmp")
CreateDefaultAlignedTempAlloca - This creates an alloca with the default ABI alignment of the given L...
void EmitSynthesizedCXXCopyCtor(Address Dest, Address Src, const Expr *Exp)
static void EmitOMPTargetParallelForSimdDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetParallelForSimdDirective &S)
Emit device code for the target parallel for simd directive.
llvm::Value * EmitObjCAllocWithZone(llvm::Value *value, llvm::Type *returnType)
void EmitCXXAggrConstructorCall(const CXXConstructorDecl *D, llvm::Value *NumElements, Address ArrayPtr, const CXXConstructExpr *E, bool NewPointerIsChecked, bool ZeroInitialization=false)
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...
VlaSizePair getVLASize(const VariableArrayType *vla)
Returns an LLVM value that corresponds to the size, in non-variably-sized elements,...
llvm::Value * EmitSVEGatherLoad(const SVETypeFlags &TypeFlags, llvm::SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
LValue EmitHLSLOutArgExpr(const HLSLOutArgExpr *E, CallArgList &Args, QualType Ty)
void EmitCXXAggrConstructorCall(const CXXConstructorDecl *D, const ArrayType *ArrayTy, Address ArrayPtr, const CXXConstructExpr *E, bool NewPointerIsChecked, bool ZeroInitialization=false)
void popCatchScope()
popCatchScope - Pops the catch scope at the top of the EHScope stack, emitting any required code (oth...
CleanupKind getARCCleanupKind()
Retrieves the default cleanup kind for an ARC cleanup.
void EmitEndEHSpec(const Decl *D)
EmitEndEHSpec - Emit the end of the exception spec.
llvm::Value * EmitRISCVCpuSupports(const CallExpr *E)
AggValueSlot::Overlap_t getOverlapForBaseInit(const CXXRecordDecl *RD, const CXXRecordDecl *BaseRD, bool IsVirtual)
Determine whether a base class initialization may overlap some other object.
void EmitLabel(const LabelDecl *D)
EmitLabel - Emit the block for the given label.
const OMPExecutableDirective * OMPParentLoopDirectiveForScan
Parent loop-based directive for scan directive.
llvm::Value * EmitNVPTXBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
bool shouldUseFusedARCCalls()
void EmitOpenACCInitConstruct(const OpenACCInitConstruct &S)
void EmitOMPTeamsDistributeParallelForDirective(const OMPTeamsDistributeParallelForDirective &S)
bool CurFuncIsThunk
In C++, whether we are code generating a thunk.
void EmitOMPTaskDirective(const OMPTaskDirective &S)
RValue EmitRValueForField(LValue LV, const FieldDecl *FD, SourceLocation Loc)
void EmitOMPScanDirective(const OMPScanDirective &S)
void EmitAnyExprToExn(const Expr *E, Address Addr)
void EmitOMPTaskLoopDirective(const OMPTaskLoopDirective &S)
JumpDest getOMPCancelDestination(OpenMPDirectiveKind Kind)
void EmitCXXDestructorCall(const CXXDestructorDecl *D, CXXDtorType Type, bool ForVirtualBase, bool Delegating, Address This, QualType ThisTy)
RValue EmitCXXMemberOrOperatorMemberCallExpr(const CallExpr *CE, const CXXMethodDecl *MD, ReturnValueSlot ReturnValue, bool HasQualifier, NestedNameSpecifier *Qualifier, bool IsArrow, const Expr *Base, llvm::CallBase **CallOrInvoke)
void EmitOMPMasterTaskLoopSimdDirective(const OMPMasterTaskLoopSimdDirective &S)
llvm::Value * EmitARCAutoreleaseReturnValue(llvm::Value *value)
SmallVector< llvm::ConvergenceControlInst *, 4 > ConvergenceTokenStack
Stack to track the controlled convergence tokens.
llvm::Value * EmitAArch64SVEBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
void GenerateObjCMethod(const ObjCMethodDecl *OMD)
void EmitOMPUseDevicePtrClause(const OMPUseDevicePtrClause &C, OMPPrivateScope &PrivateScope, const llvm::DenseMap< const ValueDecl *, llvm::Value * > CaptureDeviceAddrMap)
RValue emitBuiltinOSLogFormat(const CallExpr &E)
Emit IR for __builtin_os_log_format.
LValue EmitLValue(const Expr *E, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
EmitLValue - Emit code to compute a designator that specifies the location of the expression.
bool isSEHTryScope() const
Returns true inside SEH __try blocks.
void EmitVTablePtrCheckForCast(QualType T, Address Derived, bool MayBeNull, CFITypeCheckKind TCK, SourceLocation Loc)
Derived is the presumed address of an object of type T after a cast.
llvm::Value * EmitARCAutorelease(llvm::Value *value)
llvm::Value * emitPointerAuthResignCall(llvm::Value *Pointer, const CGPointerAuthInfo &CurInfo, const CGPointerAuthInfo &NewInfo)
RValue EmitAtomicLoad(LValue LV, SourceLocation SL, AggValueSlot Slot=AggValueSlot::ignored())
void EmitExtendGCLifetime(llvm::Value *object)
EmitExtendGCLifetime - Given a pointer to an Objective-C object, make sure it survives garbage collec...
llvm::Value * EmitVAStartEnd(llvm::Value *ArgValue, bool IsStart)
Emits a call to an LLVM variable-argument intrinsic, either llvm.va_start or llvm....
void EmitOMPDistributeLoop(const OMPLoopDirective &S, const CodeGenLoopTy &CodeGenLoop, Expr *IncExpr)
Emit code for the distribute loop-based directive.
void EmitARCNoopIntrinsicUse(ArrayRef< llvm::Value * > values)
bool hasVolatileMember(QualType T)
hasVolatileMember - returns true if aggregate type has a volatile member.
llvm::Value * EmitSVEMaskedStore(const CallExpr *, SmallVectorImpl< llvm::Value * > &Ops, unsigned BuiltinID)
llvm::Constant * GenerateObjCAtomicGetterCopyHelperFunction(const ObjCPropertyImplDecl *PID)
void callCStructCopyAssignmentOperator(LValue Dst, LValue Src)
void EmitOMPTaskLoopBasedDirective(const OMPLoopDirective &S)
void callCStructMoveConstructor(LValue Dst, LValue Src)
llvm::Value * EmitIvarOffset(const ObjCInterfaceDecl *Interface, const ObjCIvarDecl *Ivar)
llvm::Value * EmitSVEReinterpret(llvm::Value *Val, llvm::Type *Ty)
llvm::SmallVector< DeferredDeactivateCleanup > DeferredDeactivationCleanupStack
llvm::Value * EmitARCStoreWeak(Address addr, llvm::Value *value, bool ignored)
void EmitSEHExceptionCodeSave(CodeGenFunction &ParentCGF, llvm::Value *ParentFP, llvm::Value *EntryEBP)
llvm::Value * getAsNaturalPointerTo(Address Addr, QualType PointeeType)
llvm::BasicBlock * getEHResumeBlock(bool isCleanup)
static void EmitOMPTargetDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetDirective &S)
Emit device code for the target directive.
void EmitDeleteCall(const FunctionDecl *DeleteFD, llvm::Value *Ptr, QualType DeleteTy, llvm::Value *NumElements=nullptr, CharUnits CookieSize=CharUnits())
LValue EmitBinaryOperatorLValue(const BinaryOperator *E)
void EmitVariablyModifiedType(QualType Ty)
EmitVLASize - Capture all the sizes for the VLA expressions in the given variably-modified type and s...
void callCStructCopyConstructor(LValue Dst, LValue Src)
void EmitCaseStmt(const CaseStmt &S, ArrayRef< const Attr * > Attrs)
RawAddress CreateTempAllocaWithoutCast(llvm::Type *Ty, CharUnits align, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
void EmitAtomicUpdate(LValue LVal, llvm::AtomicOrdering AO, const llvm::function_ref< RValue(RValue)> &UpdateOp, bool IsVolatile)
RValue EmitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *E)
LValue EmitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *E)
llvm::Value * EmitSEHExceptionInfo()
RValue EmitBuiltinAlignTo(const CallExpr *E, bool AlignUp)
Emit IR for __builtin_align_up/__builtin_align_down.
llvm::Value * EmitARCLoadWeakRetained(Address addr)
void EmitDefaultStmt(const DefaultStmt &S, ArrayRef< const Attr * > Attrs)
const LangOptions & getLangOpts() const
llvm::Value * LoadPassedObjectSize(const Expr *E, QualType EltTy)
If E references a parameter with pass_object_size info or a constant array size modifier,...
llvm::Value * EmitLoadOfCountedByField(const Expr *Base, const FieldDecl *FAMDecl, const FieldDecl *CountDecl)
Build an expression accessing the "counted_by" field.
static void EmitOMPTargetSimdDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetSimdDirective &S)
Emit device code for the target simd directive.
void EmitOMPDistributeSimdDirective(const OMPDistributeSimdDirective &S)
llvm::Value * EmitObjCProtocolExpr(const ObjCProtocolExpr *E)
void EmitFunctionEpilog(const CGFunctionInfo &FI, bool EmitRetDbgLoc, SourceLocation EndLoc)
EmitFunctionEpilog - Emit the target specific LLVM code to return the given temporary.
llvm::Value * EmitObjCStringLiteral(const ObjCStringLiteral *E)
void ProcessOrderScopeAMDGCN(llvm::Value *Order, llvm::Value *Scope, llvm::AtomicOrdering &AO, llvm::SyncScope::ID &SSID)
void EmitOMPPrivateLoopCounters(const OMPLoopDirective &S, OMPPrivateScope &LoopScope)
Emit initial code for loop counters of loop-based directives.
llvm::Constant * EmitCheckTypeDescriptor(QualType T)
Emit a description of a type in a format suitable for passing to a runtime sanitizer handler.
void pushEHDestroy(QualType::DestructionKind dtorKind, Address addr, QualType type)
void EmitOMPDistributeParallelForDirective(const OMPDistributeParallelForDirective &S)
llvm::BasicBlock * EHResumeBlock
EHResumeBlock - Unified block containing a call to llvm.eh.resume.
LValue EmitLValueForFieldInitialization(LValue Base, const FieldDecl *Field)
EmitLValueForFieldInitialization - Like EmitLValueForField, except that if the Field is a reference,...
void EmitOpenACCShutdownConstruct(const OpenACCShutdownConstruct &S)
LValue EmitInitListLValue(const InitListExpr *E)
llvm::Value * EmitARCRetainAutorelease(QualType type, llvm::Value *value)
void emitArrayDestroy(llvm::Value *begin, llvm::Value *end, QualType elementType, CharUnits elementAlign, Destroyer *destroyer, bool checkZeroLength, bool useEHCleanup)
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
bool InNoConvergentAttributedStmt
True if the current statement has noconvergent attribute.
void EmitOMPLastprivateClauseFinal(const OMPExecutableDirective &D, bool NoFinals, llvm::Value *IsLastIterCond=nullptr)
Emit final copying of lastprivate values to original variables at the end of the worksharing or simd ...
void EmitOMPInterchangeDirective(const OMPInterchangeDirective &S)
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, Address Addr, QualType Type, CharUnits Alignment=CharUnits::Zero(), SanitizerSet SkippedChecks=SanitizerSet(), llvm::Value *ArraySize=nullptr)
llvm::Function * generateAwaitSuspendWrapper(Twine const &CoroName, Twine const &SuspendPointName, CoroutineSuspendExpr const &S)
void EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S)
void EmitUnreachable(SourceLocation Loc)
Emit a reached-unreachable diagnostic if Loc is valid and runtime checking is enabled.
static bool isInstrumentedCondition(const Expr *C)
isInstrumentedCondition - Determine whether the given condition is an instrumentable condition (i....
SmallVector< llvm::Value *, 8 > ObjCEHValueStack
ObjCEHValueStack - Stack of Objective-C exception values, used for rethrows.
void EmitOMPTeamsGenericLoopDirective(const OMPTeamsGenericLoopDirective &S)
bool ConstantFoldsToSimpleInteger(const Expr *Cond, llvm::APSInt &Result, bool AllowLabels=false)
ConstantFoldsToSimpleInteger - If the specified expression does not fold to a constant,...
void pushDestroyAndDeferDeactivation(QualType::DestructionKind dtorKind, Address addr, QualType type)
void EmitFunctionBody(const Stmt *Body)
VlaSizePair getVLAElements1D(QualType vla)
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...
llvm::Value * EmitSVETupleCreate(const SVETypeFlags &TypeFlags, llvm::Type *ReturnType, ArrayRef< llvm::Value * > Ops)
const CodeGen::CGBlockInfo * BlockInfo
void EmitOMPTeamsDistributeDirective(const OMPTeamsDistributeDirective &S)
void EmitAggregateCopyCtor(LValue Dest, LValue Src, AggValueSlot::Overlap_t MayOverlap)
llvm::Value * EmitVTableTypeCheckedLoad(const CXXRecordDecl *RD, llvm::Value *VTable, llvm::Type *VTableTy, uint64_t VTableByteOffset)
Emit a type checked load from the given vtable.
void pushDestroyAndDeferDeactivation(CleanupKind cleanupKind, Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
void EmitRISCVMultiVersionResolver(llvm::Function *Resolver, ArrayRef< FMVResolverOption > Options)
Address makeNaturalAddressForPointer(llvm::Value *Ptr, QualType T, CharUnits Alignment=CharUnits::Zero(), bool ForPointeeType=false, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
Construct an address with the natural alignment of T.
SmallVector< llvm::OperandBundleDef, 1 > getBundlesForFunclet(llvm::Value *Callee)
void markStmtAsUsed(bool Skipped, const Stmt *S)
void EmitOpenACCWaitConstruct(const OpenACCWaitConstruct &S)
llvm::Value * EmitObjCBoxedExpr(const ObjCBoxedExpr *E)
llvm::AllocaInst * EHSelectorSlot
The selector slot.
llvm::Value * EmitCheckedArgForAssume(const Expr *E)
Emits an argument for a call to a __builtin_assume.
Address EmitLoadOfReference(LValue RefLVal, LValueBaseInfo *PointeeBaseInfo=nullptr, TBAAAccessInfo *PointeeTBAAInfo=nullptr)
void EmitOMPParallelMaskedTaskLoopDirective(const OMPParallelMaskedTaskLoopDirective &S)
void EmitExprAsInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
EmitExprAsInit - Emits the code necessary to initialize a location in memory with the given initializ...
llvm::CallBase * EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee, const Twine &name="")
void emitByrefStructureInit(const AutoVarEmission &emission)
void SimplifyForwardingBlocks(llvm::BasicBlock *BB)
SimplifyForwardingBlocks - If the given basic block is only a branch to another basic block,...
ComplexPairTy EmitComplexExpr(const Expr *E, bool IgnoreReal=false, bool IgnoreImag=false)
EmitComplexExpr - Emit the computation of the specified expression of complex type,...
void callCStructDestructor(LValue Dst)
RValue EmitLoadOfLValue(LValue V, SourceLocation Loc)
EmitLoadOfLValue - Given an expression that represents a value lvalue, this method emits the address ...
llvm::Value * EmitObjCRetainNonBlock(llvm::Value *value, llvm::Type *returnType)
llvm::Value * GetVTTParameter(GlobalDecl GD, bool ForVirtualBase, bool Delegating)
GetVTTParameter - Return the VTT parameter that should be passed to a base constructor/destructor wit...
RValue convertTempToRValue(Address addr, QualType type, SourceLocation Loc)
void EmitOMPParallelDirective(const OMPParallelDirective &S)
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...
llvm::Value * EmitObjCAutorelease(llvm::Value *value, llvm::Type *returnType)
Address EmitExtVectorElementLValue(LValue V)
void EmitOMPSimdFinal(const OMPLoopDirective &D, const llvm::function_ref< llvm::Value *(CodeGenFunction &)> CondGen)
void EmitAnyExprToMem(const Expr *E, Address Location, Qualifiers Quals, bool IsInitializer)
EmitAnyExprToMem - Emits the code necessary to evaluate an arbitrary expression into the given memory...
TypeCheckKind
Situations in which we might emit a check for the suitability of a pointer or glvalue.
@ TCK_DowncastPointer
Checking the operand of a static_cast to a derived pointer type.
@ TCK_DowncastReference
Checking the operand of a static_cast to a derived reference type.
@ TCK_MemberAccess
Checking the object expression in a non-static data member access.
@ TCK_ConstructorCall
Checking the 'this' pointer for a constructor call.
@ TCK_Store
Checking the destination of a store. Must be suitably sized and aligned.
@ TCK_NonnullAssign
Checking the value assigned to a _Nonnull pointer. Must not be null.
@ TCK_UpcastToVirtualBase
Checking the operand of a cast to a virtual base object.
@ TCK_MemberCall
Checking the 'this' pointer for a call to a non-static member function.
@ TCK_DynamicOperation
Checking the operand of a dynamic_cast or a typeid expression.
@ TCK_ReferenceBinding
Checking the bound value in a reference binding.
@ TCK_Load
Checking the operand of a load. Must be suitably sized and aligned.
@ TCK_Upcast
Checking the operand of a cast to a base object.
void EmitBlockAfterUses(llvm::BasicBlock *BB)
EmitBlockAfterUses - Emit the given block somewhere hopefully near its uses, and leave the insertion ...
llvm::Value * EmitSMELdrStr(const SVETypeFlags &TypeFlags, llvm::SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
LValue MakeAddrLValue(Address Addr, QualType T, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
void SetDivFPAccuracy(llvm::Value *Val)
Set the minimum required accuracy of the given sqrt operation based on CodeGenOpts.
RValue EmitObjCMessageExpr(const ObjCMessageExpr *E, ReturnValueSlot Return=ReturnValueSlot())
void EmitContinueStmt(const ContinueStmt &S)
void setCurrentProfileCount(uint64_t Count)
Set the profiler's current count.
RawAddress getNormalCleanupDestSlot()
llvm::BasicBlock * getTerminateFunclet()
getTerminateLandingPad - Return a cleanup funclet that just calls terminate.
void EmitIgnoredExpr(const Expr *E)
EmitIgnoredExpr - Emit an expression in a context which ignores the result.
llvm::Value * EmitARCStoreStrongCall(Address addr, llvm::Value *value, bool resultIgnored)
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo, bool isInit=false, bool isNontemporal=false)
bool InNoMergeAttributedStmt
True if the current statement has nomerge attribute.
LValue EmitUnsupportedLValue(const Expr *E, const char *Name)
EmitUnsupportedLValue - Emit a dummy l-value using the type of E and issue an ErrorUnsupported style ...
llvm::Value * EmitNeonSplat(llvm::Value *V, llvm::Constant *Idx, const llvm::ElementCount &Count)
VPtrsVector getVTablePointers(const CXXRecordDecl *VTableClass)
void PopCleanupBlocks(EHScopeStack::stable_iterator OldCleanupStackSize, std::initializer_list< llvm::Value ** > ValuesToReload={})
Takes the old cleanup stack size and emits the cleanup blocks that have been added.
llvm::Type * ConvertTypeForMem(QualType T)
llvm::Function * createTLSAtExitStub(const VarDecl &VD, llvm::FunctionCallee Dtor, llvm::Constant *Addr, llvm::FunctionCallee &AtExit)
Address EmitCheckedInBoundsGEP(Address Addr, ArrayRef< llvm::Value * > IdxList, llvm::Type *elementType, bool SignedIndices, bool IsSubtraction, SourceLocation Loc, CharUnits Align, const Twine &Name="")
void EmitOMPDistributeParallelForSimdDirective(const OMPDistributeParallelForSimdDirective &S)
llvm::Value * EmitARCUnsafeUnretainedScalarExpr(const Expr *expr)
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
LValue MakeAddrLValueWithoutTBAA(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitAutoVarInit(const AutoVarEmission &emission)
llvm::BasicBlock * getUnreachableBlock()
void EmitOMPForSimdDirective(const OMPForSimdDirective &S)
llvm::AssertingVH< llvm::Instruction > AllocaInsertPt
AllocaInsertPoint - This is an instruction in the entry block before which we prefer to insert alloca...
void EmitAggregateAssign(LValue Dest, LValue Src, QualType EltTy)
Emit an aggregate assignment.
void GenerateOpenMPCapturedVars(const CapturedStmt &S, SmallVectorImpl< llvm::Value * > &CapturedVars)
void EmitNonNullArgCheck(Address Addr, QualType ArgType, SourceLocation ArgLoc, AbstractCallee AC, unsigned ParmNum)
llvm::Value * EmitObjCDictionaryLiteral(const ObjCDictionaryLiteral *E)
bool isPointerKnownNonNull(const Expr *E)
RawAddress CreateMemTempWithoutCast(QualType T, CharUnits Align, const Twine &Name="tmp")
bool currentFunctionUsesSEHTry() const
llvm::Value * EmitSVEMaskedLoad(const CallExpr *, llvm::Type *ReturnTy, SmallVectorImpl< llvm::Value * > &Ops, unsigned BuiltinID, bool IsZExtReturn)
bool AlwaysEmitXRayCustomEvents() const
AlwaysEmitXRayCustomEvents - Return true if we must unconditionally emit XRay custom event handling c...
llvm::SmallVector< const JumpDest *, 2 > SEHTryEpilogueStack
CodeGenFunction * ParentCGF
void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue, bool capturedByInit)
JumpDest ReturnBlock
ReturnBlock - Unified return block.
DominatingValue< T >::saved_type saveValueInCond(T value)
const llvm::function_ref< void(CodeGenFunction &, llvm::Function *, const OMPTaskDataTy &)> TaskGenTy
static void EmitOMPTargetTeamsGenericLoopDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetTeamsGenericLoopDirective &S)
Emit device code for the target teams loop directive.
llvm::Value * ExceptionSlot
The exception slot.
unsigned getDebugInfoFIndex(const RecordDecl *Rec, unsigned FieldIndex)
Get the record field index as represented in debug info.
LValue EmitLValueForField(LValue Base, const FieldDecl *Field)
llvm::Value * EmitARCRetainBlock(llvm::Value *value, bool mandatory)
QualType TypeOfSelfObject()
TypeOfSelfObject - Return type of object that this self represents.
LValue EmitCheckedLValue(const Expr *E, TypeCheckKind TCK)
Same as EmitLValue but additionally we generate checking code to guard against undefined behavior.
llvm::Value * EmitSVEDupX(llvm::Value *Scalar)
RawAddress CreateMemTemp(QualType T, const Twine &Name="tmp", RawAddress *Alloca=nullptr)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen and cas...
void EmitOMPFlushDirective(const OMPFlushDirective &S)
void EmitStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
void EmitOMPMaskedTaskLoopDirective(const OMPMaskedTaskLoopDirective &S)
void markStmtMaybeUsed(const Stmt *S)
void EmitSEHLeaveStmt(const SEHLeaveStmt &S)
static Destroyer destroyCXXObject
llvm::Value * EmitObjCArrayLiteral(const ObjCArrayLiteral *E)
@ ForceLeftToRight
! Language semantics require left-to-right evaluation.
@ Default
! No language constraints on evaluation order.
@ ForceRightToLeft
! Language semantics require right-to-left evaluation.
void EmitLambdaBlockInvokeBody()
void EmitAttributedStmt(const AttributedStmt &S)
void EmitVarAnnotations(const VarDecl *D, llvm::Value *V)
Emit local annotations for the local variable V, declared by D.
llvm::BasicBlock * OMPBeforeScanBlock
void registerGlobalDtorWithLLVM(const VarDecl &D, llvm::FunctionCallee fn, llvm::Constant *addr)
Registers the dtor using 'llvm.global_dtors' for platforms that do not support an 'atexit()' function...
Destroyer * getDestroyer(QualType::DestructionKind destructionKind)
void EmitOMPCancelDirective(const OMPCancelDirective &S)
llvm::SmallPtrSet< const CXXRecordDecl *, 4 > VisitedVirtualBasesSetTy
void EmitNewArrayInitializer(const CXXNewExpr *E, QualType elementType, llvm::Type *ElementTy, Address NewPtr, llvm::Value *NumElements, llvm::Value *AllocSizeWithoutCookie)
RawAddress CreateMemTempWithoutCast(QualType T, const Twine &Name="tmp")
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen without...
void EmitOMPGenericLoopDirective(const OMPGenericLoopDirective &S)
llvm::Value * EmitPointerAuthSign(const CGPointerAuthInfo &Info, llvm::Value *Pointer)
void EmitOMPTargetTeamsDistributeDirective(const OMPTargetTeamsDistributeDirective &S)
void EmitObjCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst, llvm::Value **Result=nullptr)
EmitStoreThroughBitfieldLValue - Store Src into Dst with same constraints as EmitStoreThroughLValue.
void pushCleanupAndDeferDeactivation(CleanupKind Kind, As... A)
void EmitAtomicInit(Expr *E, LValue lvalue)
static const Expr * stripCond(const Expr *C)
Ignore parentheses and logical-NOT to track conditions consistently.
void EmitCfiCheckStub()
Emit a stub for the cross-DSO CFI check function.
static std::string getNonTrivialDestructorStr(QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx)
llvm::DenseMap< const Decl *, Address > DeclMapTy
void EmitCaseStmtRange(const CaseStmt &S, ArrayRef< const Attr * > Attrs)
llvm::Value * EmitObjCConsumeObject(QualType T, llvm::Value *Ptr)
PeepholeProtection protectFromPeepholes(RValue rvalue)
protectFromPeepholes - Protect a value that we're intending to store to the side, but which will prob...
ConstantEmission tryEmitAsConstant(DeclRefExpr *refExpr)
llvm::Value * EmitARCLoadWeak(Address addr)
const TargetInfo & getTarget() const
void initFullExprCleanup()
Set up the last cleanup that was pushed as a conditional full-expression cleanup.
LValue EmitCXXConstructLValue(const CXXConstructExpr *E)
llvm::Value * EmitCMSEClearRecord(llvm::Value *V, llvm::IntegerType *ITy, QualType RTy)
void EmitOMPTaskgroupDirective(const OMPTaskgroupDirective &S)
static void EmitOMPTargetTeamsDistributeParallelForDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetTeamsDistributeParallelForDirective &S)
void emitOMPSimpleStore(LValue LVal, RValue RVal, QualType RValTy, SourceLocation Loc)
bool isInConditionalBranch() const
isInConditionalBranch - Return true if we're currently emitting one branch or the other of a conditio...
void EmitOMPInnerLoop(const OMPExecutableDirective &S, bool RequiresCleanup, const Expr *LoopCond, const Expr *IncExpr, const llvm::function_ref< void(CodeGenFunction &)> BodyGen, const llvm::function_ref< void(CodeGenFunction &)> PostIncGen)
Emit inner loop of the worksharing/simd construct.
llvm::DebugLoc SourceLocToDebugLoc(SourceLocation Location)
Converts Location to a DebugLoc, if debug information is enabled.
void EmitCXXForRangeStmt(const CXXForRangeStmt &S, ArrayRef< const Attr * > Attrs={})
llvm::Value * EmitPointerAuthBlendDiscriminator(llvm::Value *StorageAddress, llvm::Value *Discriminator)
Create the discriminator from the storage address and the entity hash.
llvm::Constant * GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo)
llvm::Value * vectorWrapScalar16(llvm::Value *Op)
llvm::Function * LookupNeonLLVMIntrinsic(unsigned IntrinsicID, unsigned Modifier, llvm::Type *ArgTy, const CallExpr *E)
llvm::Value * getTypeSize(QualType Ty)
Returns calculated size of the specified type.
std::pair< LValue, llvm::Value * > EmitARCStoreAutoreleasing(const BinaryOperator *e)
void EmitLabelStmt(const LabelStmt &S)
void emitDestroy(Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
void EmitFunctionProlog(const CGFunctionInfo &FI, llvm::Function *Fn, const FunctionArgList &Args)
EmitFunctionProlog - Emit the target specific LLVM code to load the arguments for the given function.
llvm::Value * EmitObjCAllocInit(llvm::Value *value, llvm::Type *resultType)
LValue EmitVAArgExprLValue(const VAArgExpr *E)
llvm::Value * EmitSEHExceptionCode()
bool EmitScalarRangeCheck(llvm::Value *Value, QualType Ty, SourceLocation Loc)
Check if the scalar Value is within the valid range for the given type Ty.
llvm::Value * EmitObjCCollectionLiteral(const Expr *E, const ObjCMethodDecl *MethodWithObjects)
void EmitOMPDepobjDirective(const OMPDepobjDirective &S)
llvm::Function * generateDestroyHelper(Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray, const VarDecl *VD)
Address EmitPointerWithAlignment(const Expr *Addr, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
EmitPointerWithAlignment - Given an expression with a pointer type, emit the value and compute our be...
llvm::Value * EmitMatrixIndexExpr(const Expr *E)
llvm::Value * EmitTargetBuiltinExpr(unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue)
EmitTargetBuiltinExpr - Emit the given builtin call.
void GenerateCXXGlobalCleanUpFunc(llvm::Function *Fn, ArrayRef< std::tuple< llvm::FunctionType *, llvm::WeakTrackingVH, llvm::Constant * > > DtorsOrStermFinalizers)
GenerateCXXGlobalCleanUpFunc - Generates code for cleaning up global variables.
void EmitCXXGuardedInit(const VarDecl &D, llvm::GlobalVariable *DeclPtr, bool PerformInit)
Emit code in this function to perform a guarded variable initialization.
const Expr * RetExpr
If a return statement is being visited, this holds the return statment's result expression.
void EmitARCRelease(llvm::Value *value, ARCPreciseLifetime_t precise)
void EmitCXXGlobalVarDeclInit(const VarDecl &D, llvm::GlobalVariable *GV, bool PerformInit)
EmitCXXGlobalVarDeclInit - Create the initializer for a C++ variable with global storage.
LValue EmitCoyieldLValue(const CoyieldExpr *E)
void EmitSehCppScopeEnd()
void EmitInitializerForField(FieldDecl *Field, LValue LHS, Expr *Init)
llvm::Value * EmitObjCThrowOperand(const Expr *expr)
void EmitX86MultiVersionResolver(llvm::Function *Resolver, ArrayRef< FMVResolverOption > Options)
RValue EmitAnyExprToTemp(const Expr *E)
EmitAnyExprToTemp - Similarly to EmitAnyExpr(), however, the result will always be accessible even if...
void pushCleanupAfterFullExpr(CleanupKind Kind, As... A)
Queue a cleanup to be pushed after finishing the current full-expression, potentially with an active ...
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
EmitComplexExprIntoLValue - Emit the given expression of complex type and place its result into the s...
RValue EmitCXXMemberCallExpr(const CXXMemberCallExpr *E, ReturnValueSlot ReturnValue, llvm::CallBase **CallOrInvoke=nullptr)
llvm::Value * emitPointerAuthResign(llvm::Value *Pointer, QualType PointerType, const CGPointerAuthInfo &CurAuthInfo, const CGPointerAuthInfo &NewAuthInfo, bool IsKnownNonNull)
void EmitVTablePtrCheck(const CXXRecordDecl *RD, llvm::Value *VTable, CFITypeCheckKind TCK, SourceLocation Loc)
EmitVTablePtrCheck - Emit a check that VTable is a valid virtual table for RD using llvm....
void EmitOMPSingleDirective(const OMPSingleDirective &S)
std::pair< LValue, llvm::Value * > EmitARCStoreUnsafeUnretained(const BinaryOperator *e, bool ignored)
ComplexPairTy EmitPromotedComplexExpr(const Expr *E, QualType PromotionType)
void pushFullExprCleanup(CleanupKind kind, As... A)
pushFullExprCleanup - Push a cleanup to be run at the end of the current full-expression.
RValue EmitCoroutineIntrinsic(const CallExpr *E, unsigned int IID)
void initFullExprCleanupWithFlag(RawAddress ActiveFlag)
llvm::Value * EmitAArch64SMEBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
void EmitOMPTargetTeamsGenericLoopDirective(const OMPTargetTeamsGenericLoopDirective &S)
RValue EmitAMDGPUDevicePrintfCallExpr(const CallExpr *E)
void EmitReturnValueCheck(llvm::Value *RV)
Emit a test that checks if the return value RV is nonnull.
llvm::BasicBlock * getInvokeDest()
Address EmitArrayToPointerDecay(const Expr *Array, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr)
RValue EmitBuiltinNewDeleteCall(const FunctionProtoType *Type, const CallExpr *TheCallExpr, bool IsDelete)
llvm::Value * EmitRISCVCpuInit()
Address mergeAddressesInConditionalExpr(Address LHS, Address RHS, llvm::BasicBlock *LHSBlock, llvm::BasicBlock *RHSBlock, llvm::BasicBlock *MergeBlock, QualType MergedType)
llvm::CanonicalLoopInfo * EmitOMPCollapsedCanonicalLoopNest(const Stmt *S, int Depth)
Emit the Stmt S and return its topmost canonical loop, if any.
llvm::Value * EmitRISCVCpuSupports(ArrayRef< StringRef > FeaturesStrs)
LValue EmitUnaryOpLValue(const UnaryOperator *E)
void EmitBlockWithFallThrough(llvm::BasicBlock *BB, const Stmt *S)
llvm::Value * LoadObjCSelf()
LoadObjCSelf - Load the value of self.
bool ShouldEmitVTableTypeCheckedLoad(const CXXRecordDecl *RD)
Returns whether we should perform a type checked load when loading a virtual function for virtual cal...
ComplexPairTy EmitComplexPrePostIncDec(const UnaryOperator *E, LValue LV, bool isInc, bool isPre)
RValue EmitUnsupportedRValue(const Expr *E, const char *Name)
EmitUnsupportedRValue - Emit a dummy r-value using the type of E and issue an ErrorUnsupported style ...
void EmitAtomicStore(RValue rvalue, LValue lvalue, llvm::AtomicOrdering AO, bool IsVolatile, bool isInit)
llvm::Value * EmitARCRetainAutoreleaseReturnValue(llvm::Value *value)
void EmitARCCopyWeak(Address dst, Address src)
void maybeResetMCDCCondBitmap(const Expr *E)
Zero-init the MCDC temp value.
static unsigned getAccessedFieldNo(unsigned Idx, const llvm::Constant *Elts)
getAccessedFieldNo - Given an encoded value and a result number, return the input field number being ...
void EmitSimpleOMPExecutableDirective(const OMPExecutableDirective &D)
Emit simple code for OpenMP directives in Simd-only mode.
void EmitForStmt(const ForStmt &S, ArrayRef< const Attr * > Attrs={})
void EmitCheck(ArrayRef< std::pair< llvm::Value *, SanitizerKind::SanitizerOrdinal > > Checked, SanitizerHandler Check, ArrayRef< llvm::Constant * > StaticArgs, ArrayRef< llvm::Value * > DynamicArgs)
Create a basic block that will either trap or call a handler function in the UBSan runtime with the p...
void pushSEHCleanup(CleanupKind kind, llvm::Function *FinallyFunc)
RValue EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue)
void PushDestructorCleanup(QualType T, Address Addr)
PushDestructorCleanup - Push a cleanup to call the complete-object destructor of an object of the giv...
void EmitCXXConstructorCall(const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, AggValueSlot ThisAVS, const CXXConstructExpr *E)
void EmitOMPDistributeDirective(const OMPDistributeDirective &S)
CGCallee BuildAppleKextVirtualDestructorCall(const CXXDestructorDecl *DD, CXXDtorType Type, const CXXRecordDecl *RD)
void EmitOpenACCCombinedConstruct(const OpenACCCombinedConstruct &S)
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 EmitOMPParallelForDirective(const OMPParallelForDirective &S)
void EmitOMPTeamsDirective(const OMPTeamsDirective &S)
bool ShouldSkipSanitizerInstrumentation()
ShouldSkipSanitizerInstrumentation - Return true if the current function should not be instrumented w...
uint64_t getCurrentProfileCount()
Get the profiler's current count.
auto getIsCounterPair(const Stmt *S) const
void EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound, llvm::Value *Index, QualType IndexType, QualType IndexedType, bool Accessed)
llvm::Value * BlockPointer
llvm::Value * EmitSVEDupX(llvm::Value *Scalar, llvm::Type *Ty)
llvm::Value * EmitSVEPrefetchLoad(const SVETypeFlags &TypeFlags, SmallVectorImpl< llvm::Value * > &Ops, unsigned BuiltinID)
SmallVector< const BinaryOperator *, 16 > MCDCLogOpStack
Stack to track the Logical Operator recursion nest for MC/DC.
llvm::Value * EmitAArch64CompareBuiltinExpr(llvm::Value *Op, llvm::Type *Ty, const llvm::CmpInst::Predicate Fp, const llvm::CmpInst::Predicate Ip, const llvm::Twine &Name="")
void setBlockContextParameter(const ImplicitParamDecl *D, unsigned argNum, llvm::Value *ptr)
void defaultInitNonTrivialCStructVar(LValue Dst)
void StartFunction(GlobalDecl GD, QualType RetTy, llvm::Function *Fn, const CGFunctionInfo &FnInfo, const FunctionArgList &Args, SourceLocation Loc=SourceLocation(), SourceLocation StartLoc=SourceLocation())
Emit code for the start of a function.
void EmitCfiCheckFail()
Emit a cross-DSO CFI failure handling function.
AggValueSlot CreateAggTemp(QualType T, const Twine &Name="tmp", RawAddress *Alloca=nullptr)
CreateAggTemp - Create a temporary memory object for the given aggregate type.
RValue EmitLoadOfExtVectorElementLValue(LValue V)
llvm::ScalableVectorType * getSVEType(const SVETypeFlags &TypeFlags)
void EmitOMPUnrollDirective(const OMPUnrollDirective &S)
void EmitSehTryScopeBegin()
void EmitOMPParallelMasterTaskLoopSimdDirective(const OMPParallelMasterTaskLoopSimdDirective &S)
void EmitSehTryScopeEnd()
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::CallBase **CallOrInvoke=nullptr, bool IsMustTail=false)
void EmitDelegateCallArg(CallArgList &args, const VarDecl *param, SourceLocation loc)
EmitDelegateCallArg - We are performing a delegate call; that is, the current function is delegating ...
void EmitOMPTargetDataDirective(const OMPTargetDataDirective &S)
RValue EmitCoyieldExpr(const CoyieldExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
ComplexPairTy EmitLoadOfComplex(LValue src, SourceLocation loc)
EmitLoadOfComplex - Load a complex number from the specified l-value.
static bool ShouldNullCheckClassCastValue(const CastExpr *Cast)
bool isMCDCCoverageEnabled() const
bool HaveInsertPoint() const
HaveInsertPoint - True if an insertion point is defined.
RValue emitRotate(const CallExpr *E, bool IsRotateRight)
llvm::Value * EmitComplexToScalarConversion(ComplexPairTy Src, QualType SrcTy, QualType DstTy, SourceLocation Loc)
Emit a conversion from the specified complex type to the specified destination type,...
llvm::Constant * EmitCheckSourceLocation(SourceLocation Loc)
Emit a description of a source location in a format suitable for passing to a runtime sanitizer handl...
void markAsIgnoreThreadCheckingAtRuntime(llvm::Function *Fn)
Annotate the function with an attribute that disables TSan checking at runtime.
void EmitSwitchStmt(const SwitchStmt &S)
LValue EmitLValueForLambdaField(const FieldDecl *Field, llvm::Value *ThisValue)
bool isTrivialInitializer(const Expr *Init)
Determine whether the given initializer is trivial in the sense that it requires no code to be genera...
LValue EmitComplexAssignmentLValue(const BinaryOperator *E)
Emit an l-value for an assignment (simple or compound) of complex type.
void ErrorUnsupported(const Stmt *S, const char *Type)
ErrorUnsupported - Print out an error that codegen doesn't support the specified stmt yet.
CGDebugInfo * getDebugInfo()
Address LoadBlockStruct()
void EmitOMPTargetTeamsDistributeParallelForSimdDirective(const OMPTargetTeamsDistributeParallelForSimdDirective &S)
Address recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF, Address ParentVar, llvm::Value *ParentFP)
Recovers the address of a local in a parent function.
const FieldDecl * FindFlexibleArrayMemberFieldAndOffset(ASTContext &Ctx, const RecordDecl *RD, const FieldDecl *FAMDecl, uint64_t &Offset)
void registerGlobalDtorWithAtExit(const VarDecl &D, llvm::FunctionCallee fn, llvm::Constant *addr)
Call atexit() with a function that passes the given argument to the given function.
llvm::Value * EmitRISCVCpuIs(const CallExpr *E)
LValue EmitObjCSelectorLValue(const ObjCSelectorExpr *E)
Address emitBlockByrefAddress(Address baseAddr, const VarDecl *V, bool followForward=true)
BuildBlockByrefAddress - Computes the location of the data in a variable which is declared as __block...
Address EmitVAListRef(const Expr *E)
LValue EmitObjCEncodeExprLValue(const ObjCEncodeExpr *E)
Address emitAddrOfImagComponent(Address complex, QualType complexType)
Address emitBlockByrefAddress(Address baseAddr, const BlockByrefInfo &info, bool followForward, const llvm::Twine &name)
LValue EmitDeclRefLValue(const DeclRefExpr *E)
llvm::Value * EmitLoadOfScalar(LValue lvalue, SourceLocation Loc)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
void EmitOMPTeamsDistributeParallelForSimdDirective(const OMPTeamsDistributeParallelForSimdDirective &S)
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block,...
AggValueSlot::Overlap_t getOverlapForFieldInit(const FieldDecl *FD)
Determine whether a field initialization may overlap some other object.
void EmitOpenACCDataConstruct(const OpenACCDataConstruct &S)
LValue MakeRawAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment, AlignmentSource Source=AlignmentSource::Type)
Same as MakeAddrLValue above except that the pointer is known to be unsigned.
llvm::Function * GenerateCapturedStmtFunction(const CapturedStmt &S)
void EmitAggregateCopy(LValue Dest, LValue Src, QualType EltTy, AggValueSlot::Overlap_t MayOverlap, bool isVolatile=false)
EmitAggregateCopy - Emit an aggregate copy.
llvm::Value * EmitARCReclaimReturnedObject(const Expr *e, bool allowUnsafeClaim)
void EmitSEHTryStmt(const SEHTryStmt &S)
void maybeCreateMCDCCondBitmap()
Allocate a temp value on the stack that MCDC can use to track condition results.
void EmitOMPInteropDirective(const OMPInteropDirective &S)
llvm::Value * EmitNeonShiftVector(llvm::Value *V, llvm::Type *Ty, bool negateForRightShift)
void ExitSEHTryStmt(const SEHTryStmt &S)
llvm::Constant * GenerateCopyHelperFunction(const CGBlockInfo &blockInfo)
void EmitCXXDeleteExpr(const CXXDeleteExpr *E)
void EmitOMPReductionClauseFinal(const OMPExecutableDirective &D, const OpenMPDirectiveKind ReductionKind)
Emit final update of reduction values to original variables at the end of the directive.
llvm::Value * unregisterGlobalDtorWithUnAtExit(llvm::Constant *dtorStub)
Call unatexit() with function dtorStub.
llvm::BasicBlock * OMPScanDispatch
llvm::BasicBlock * getTerminateLandingPad()
getTerminateLandingPad - Return a landing pad that just calls terminate.
llvm::BasicBlock * getTerminateHandler()
getTerminateHandler - Return a handler (not a landing pad, just a catch handler) that just calls term...
void EmitObjCAutoreleasePoolPop(llvm::Value *Ptr)
llvm::Value * EmitSVEMovl(const SVETypeFlags &TypeFlags, llvm::ArrayRef< llvm::Value * > Ops, unsigned BuiltinID)
llvm::function_ref< std::pair< LValue, LValue >(CodeGenFunction &, const OMPExecutableDirective &S)> CodeGenLoopBoundsTy
llvm::Value * EmitARCRetainAutoreleaseScalarExpr(const Expr *expr)
void emitAlignmentAssumption(llvm::Value *PtrValue, QualType Ty, SourceLocation Loc, SourceLocation AssumptionLoc, llvm::Value *Alignment, llvm::Value *OffsetValue=nullptr)
const TargetCodeGenInfo & getTargetHooks() const
void setBeforeOutermostConditional(llvm::Value *value, Address addr, CodeGenFunction &CGF)
llvm::Value * emitBoolVecConversion(llvm::Value *SrcVec, unsigned NumElementsDst, const llvm::Twine &Name="")
LValue MakeNaturalAlignRawAddrLValue(llvm::Value *V, QualType T)
LValue EmitPredefinedLValue(const PredefinedExpr *E)
llvm::Value * EmitARMBuiltinExpr(unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue, llvm::Triple::ArchType Arch)
void EmitInlinedInheritingCXXConstructorCall(const CXXConstructorDecl *Ctor, CXXCtorType CtorType, bool ForVirtualBase, bool Delegating, CallArgList &Args)
Emit a call to an inheriting constructor (that is, one that invokes a constructor inherited from a ba...
RValue EmitReferenceBindingToExpr(const Expr *E)
Emits a reference binding to the passed in expression.
llvm::Type * getEltType(const SVETypeFlags &TypeFlags)
CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext=false)
void EmitAggExpr(const Expr *E, AggValueSlot AS)
EmitAggExpr - Emit the computation of the specified expression of aggregate type.
void EmitOMPTargetTaskBasedDirective(const OMPExecutableDirective &S, const RegionCodeGenTy &BodyGen, OMPTargetDataInfo &InputInfo)
void EmitDeclStmt(const DeclStmt &S)
void EmitOMPScopeDirective(const OMPScopeDirective &S)
bool ShouldXRayInstrumentFunction() const
ShouldXRayInstrument - Return true if the current function should be instrumented with XRay nop sleds...
Address GetAddressOfDerivedClass(Address Value, const CXXRecordDecl *Derived, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd, bool NullCheckValue)
bool InNoInlineAttributedStmt
True if the current statement has noinline attribute.
void EmitOMPTargetParallelDirective(const OMPTargetParallelDirective &S)
void EnterCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock=false)
static bool IsConstructorDelegationValid(const CXXConstructorDecl *Ctor)
llvm::Function * GenerateBlockFunction(GlobalDecl GD, const CGBlockInfo &Info, const DeclMapTy &ldm, bool IsLambdaConversionToBlock, bool BuildGlobalBlock)
void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst)
void EmitOMPParallelMaskedDirective(const OMPParallelMaskedDirective &S)
static void EmitOMPTargetParallelForDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetParallelForDirective &S)
Emit device code for the target parallel for directive.
llvm::Value * EmitSVEPMull(const SVETypeFlags &TypeFlags, llvm::SmallVectorImpl< llvm::Value * > &Ops, unsigned BuiltinID)
void EmitStartEHSpec(const Decl *D)
EmitStartEHSpec - Emit the start of the exception spec.
void EmitCoroutineBody(const CoroutineBodyStmt &S)
RValue EmitSimpleCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue, llvm::CallBase **CallOrInvoke=nullptr)
Address EmitCompoundStmt(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
llvm::Value * EmitToMemory(llvm::Value *Value, QualType Ty)
EmitToMemory - Change a scalar value from its value representation to its in-memory representation.
llvm::Value * EmitCheckValue(llvm::Value *V)
Convert a value into a format suitable for passing to a runtime sanitizer handler.
void EmitCXXConstructorCall(const CXXConstructorDecl *D, CXXCtorType Type, bool ForVirtualBase, bool Delegating, Address This, CallArgList &Args, AggValueSlot::Overlap_t Overlap, SourceLocation Loc, bool NewPointerIsChecked, llvm::CallBase **CallOrInvoke=nullptr)
VlaSizePair getVLAElements1D(const VariableArrayType *vla)
Return the number of elements for a single dimension for the given array type.
void EmitCXXTemporary(const CXXTemporary *Temporary, QualType TempType, Address Ptr)
llvm::Value * EmitCMSEClearRecord(llvm::Value *V, llvm::ArrayType *ATy, QualType RTy)
void EmitStoreOfScalar(llvm::Value *value, LValue lvalue, bool isInit=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
RValue EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E, ReturnValueSlot ReturnValue, llvm::CallBase **CallOrInvoke)
bool IsInPreservedAIRegion
True if CodeGen currently emits code inside presereved access index region.
llvm::Value * EmitARCRetain(QualType type, llvm::Value *value)
llvm::Value * authPointerToPointerCast(llvm::Value *ResultPtr, QualType SourceType, QualType DestType)
bool AlwaysEmitXRayTypedEvents() const
AlwaysEmitXRayTypedEvents - Return true if clang must unconditionally emit XRay typed event handling ...
void pushCleanupAfterFullExprWithActiveFlag(CleanupKind Kind, RawAddress ActiveFlag, As... A)
void SetSqrtFPAccuracy(llvm::Value *Val)
Set the minimum required accuracy of the given sqrt operation based on CodeGenOpts.
void registerGlobalDtorWithAtExit(llvm::Constant *dtorStub)
Call atexit() with function dtorStub.
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::CallBase **CallOrInvoke, bool IsMustTail, SourceLocation Loc, bool IsVirtualFunctionPointerThunk=false)
EmitCall - Generate a call of the given function, expecting the given result type,...
RValue EmitVAArg(VAArgExpr *VE, Address &VAListAddr, AggValueSlot Slot=AggValueSlot::ignored())
Generate code to get an argument from the passed in pointer and update it accordingly.
void EmitOMPSimdInit(const OMPLoopDirective &D)
Helpers for the OpenMP loop directives.
RValue EmitPseudoObjectRValue(const PseudoObjectExpr *e, AggValueSlot slot=AggValueSlot::ignored())
void EmitCfiSlowPathCheck(SanitizerKind::SanitizerOrdinal Ordinal, llvm::Value *Cond, llvm::ConstantInt *TypeId, llvm::Value *Ptr, ArrayRef< llvm::Constant * > StaticArgs)
Emit a slow path cross-DSO CFI check which calls __cfi_slowpath if Cond if false.
llvm::Value * EmitSVEScatterStore(const SVETypeFlags &TypeFlags, llvm::SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
llvm::Value * EmitObjCSelectorExpr(const ObjCSelectorExpr *E)
void EmitConstructorBody(FunctionArgList &Args)
void SetFastMathFlags(FPOptions FPFeatures)
Set the codegen fast-math flags.
int ExpectedOMPLoopDepth
Number of nested loop to be consumed by the last surrounding loop-associated directive.
void EmitVarDecl(const VarDecl &D)
EmitVarDecl - Emit a local variable declaration.
llvm::Value * EmitARCUnsafeClaimAutoreleasedReturnValue(llvm::Value *value)
void EmitOMPParallelForSimdDirective(const OMPParallelForSimdDirective &S)
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
ASTContext & getContext() const
llvm::Value * EmitBuiltinAvailable(const VersionTuple &Version)
llvm::Value * EmitARCStoreStrong(LValue lvalue, llvm::Value *value, bool resultIgnored)
CGCallee BuildAppleKextVirtualCall(const CXXMethodDecl *MD, NestedNameSpecifier *Qual, llvm::Type *Ty)
LValue EmitObjCMessageExprLValue(const ObjCMessageExpr *E)
void EmitVTableAssumptionLoads(const CXXRecordDecl *ClassDecl, Address This)
Emit assumption load for all bases.
llvm::Function * generateBuiltinOSLogHelperFunction(const analyze_os_log::OSLogBufferLayout &Layout, CharUnits BufferAlignment)
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, AlignmentSource Source=AlignmentSource::Type, bool isNontemporal=false)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
CGCallee EmitCallee(const Expr *E)
llvm::Value * EmitBlockLiteral(const BlockExpr *)
Emit block literal.
void EmitNullabilityCheck(LValue LHS, llvm::Value *RHS, SourceLocation Loc)
Given an assignment *LHS = RHS, emit a test that checks if RHS is nonnull, if LHS is marked _Nonnull.
void EmitAggFinalDestCopy(QualType Type, AggValueSlot Dest, const LValue &Src, ExprValueKind SrcKind)
EmitAggFinalDestCopy - Emit copy of the specified aggregate into destination address.
void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty)
const Decl * CurFuncDecl
CurFuncDecl - Holds the Decl for the current outermost non-closure context.
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, ArrayRef< llvm::Value * > args, const Twine &name="")
llvm::Constant * GenerateObjCAtomicSetterCopyHelperFunction(const ObjCPropertyImplDecl *PID)
ComplexPairTy EmitUnPromotedValue(ComplexPairTy result, QualType PromotionType)
LValue EmitLoadOfPointerLValue(Address Ptr, const PointerType *PtrTy)
llvm::Value * EmitScalarOrConstFoldImmArg(unsigned ICEArguments, unsigned Idx, const CallExpr *E)
void maybeUpdateMCDCCondBitmap(const Expr *E, llvm::Value *Val)
Update the MCDC temp value with the condition's evaluated result.
static void EmitOMPTargetTeamsDistributeSimdDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetTeamsDistributeSimdDirective &S)
Emit device code for the target teams distribute simd directive.
void checkTargetFeatures(const CallExpr *E, const FunctionDecl *TargetDecl)
void EmitLambdaInAllocaCallOpBody(const CXXMethodDecl *MD)
std::pair< LValue, LValue > EmitHLSLOutArgLValues(const HLSLOutArgExpr *E, QualType Ty)
SmallVector< llvm::CanonicalLoopInfo *, 4 > OMPLoopNestStack
List of recently emitted OMPCanonicalLoops.
bool EmitOMPWorksharingLoop(const OMPLoopDirective &S, Expr *EUB, const CodeGenLoopBoundsTy &CodeGenLoopBounds, const CodeGenDispatchBoundsTy &CGDispatchBounds)
Emit code for the worksharing loop-based directive.
llvm::SmallVector< char, 256 > LifetimeExtendedCleanupStack
llvm::Value * LoadCXXVTT()
LoadCXXVTT - Load the VTT parameter to base constructors/destructors have virtual bases.
void EmitDeclRefExprDbgValue(const DeclRefExpr *E, const APValue &Init)
void EmitOpenACCLoopConstruct(const OpenACCLoopConstruct &S)
void EmitCXXThrowExpr(const CXXThrowExpr *E, bool KeepInsertionPoint=true)
void EmitOMPLinearClause(const OMPLoopDirective &D, CodeGenFunction::OMPPrivateScope &PrivateScope)
Emit initial code for linear clauses.
llvm::Instruction * getPostAllocaInsertPoint()
Return PostAllocaInsertPt.
void StartThunk(llvm::Function *Fn, GlobalDecl GD, const CGFunctionInfo &FnInfo, bool IsUnprototyped)
Address GetAddressOfBaseClass(Address Value, const CXXRecordDecl *Derived, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd, bool NullCheckValue, SourceLocation Loc)
GetAddressOfBaseClass - This function will add the necessary delta to the load of 'this' and returns ...
void EmitBranchThroughCleanup(JumpDest Dest)
EmitBranchThroughCleanup - Emit a branch from the current insert block through the normal cleanup han...
void emitARCMoveAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
LValue EmitMemberExpr(const MemberExpr *E)
AutoVarEmission EmitAutoVarAlloca(const VarDecl &var)
void pushDestroy(QualType::DestructionKind dtorKind, Address addr, QualType type)
LValue EmitArraySubscriptExpr(const ArraySubscriptExpr *E, bool Accessed=false)
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...
bool ConstantFoldsToSimpleInteger(const Expr *Cond, bool &Result, bool AllowLabels=false)
ConstantFoldsToSimpleInteger - If the specified expression does not fold to a constant,...
Address ReturnValuePointer
ReturnValuePointer - The temporary alloca to hold a pointer to sret.
llvm::ConstantInt * getUBSanFunctionTypeHash(QualType T) const
Return a type hash constant for a function instrumented by -fsanitize=function.
ComplexPairTy EmitPromotedValue(ComplexPairTy result, QualType PromotionType)
llvm::Value * SEHInfo
Value returned by __exception_info intrinsic.
llvm::Value * BuildVector(ArrayRef< llvm::Value * > Ops)
void EmitStmt(const Stmt *S, ArrayRef< const Attr * > Attrs={})
EmitStmt - Emit the code for the statement.
ConstantEmission tryEmitAsConstant(const MemberExpr *ME)
llvm::Value * EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
void callCStructMoveAssignmentOperator(LValue Dst, LValue Src)
void EmitAutoVarCleanups(const AutoVarEmission &emission)
llvm::GlobalVariable * AddInitializerToStaticVarDecl(const VarDecl &D, llvm::GlobalVariable *GV)
AddInitializerToStaticVarDecl - Add the initializer for 'D' to the global variable that has already b...
llvm::Value * EmitARMCDEBuiltinExpr(unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue, llvm::Triple::ArchType Arch)
void EmitOMPTileDirective(const OMPTileDirective &S)
llvm::Value * GetCountedByFieldExprGEP(const Expr *Base, const FieldDecl *FAMDecl, const FieldDecl *CountDecl)
void PopCleanupBlock(bool FallThroughIsBranchThrough=false, bool ForDeactivation=false)
PopCleanupBlock - Will pop the cleanup entry on the stack and process all branch fixups.
static Destroyer destroyARCWeak
JumpDest getJumpDestForLabel(const LabelDecl *S)
getBasicBlockForLabel - Return the LLVM basicblock that the specified label maps to.
bool EmitOMPLinearClauseInit(const OMPLoopDirective &D)
Emit initial code for linear variables.
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind.
llvm::Value * EmitPromotedScalarExpr(const Expr *E, QualType PromotionType)
llvm::BasicBlock * EmitLandingPad()
Emits a landing pad for the current EH stack.
void EmitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt &S)
llvm::DenseMap< const ValueDecl *, FieldDecl * > LambdaCaptureFields
llvm::Function * EmitCapturedStmt(const CapturedStmt &S, CapturedRegionKind K)
void EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, llvm::Value *VTable, SourceLocation Loc)
If whole-program virtual table optimization is enabled, emit an assumption that VTable is a member of...
bool AutoreleaseResult
In ARC, whether we should autorelease the return value.
CleanupKind getCleanupKind(QualType::DestructionKind kind)
void EmitOMPParallelMaskedTaskLoopSimdDirective(const OMPParallelMaskedTaskLoopSimdDirective &S)
llvm::CallInst * EmitRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
void EmitOMPLoopBody(const OMPLoopDirective &D, JumpDest LoopExit)
Helper for the OpenMP loop directives.
void EmitCXXConstructExpr(const CXXConstructExpr *E, AggValueSlot Dest)
VlaSizePair getVLASize(QualType vla)
llvm::Value * EmitSVEPredicateTupleCast(llvm::Value *PredTuple, llvm::StructType *Ty)
llvm::Value * EmitObjCMRRAutoreleasePoolPush()
RValue EmitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *E, const CXXMethodDecl *MD, ReturnValueSlot ReturnValue, llvm::CallBase **CallOrInvoke)
void EmitInvariantStart(llvm::Constant *Addr, CharUnits Size)
void maybeUpdateMCDCTestVectorBitmap(const Expr *E)
Increment the profiler's counter for the given expression by StepV.
void EmitOMPLinearClauseFinal(const OMPLoopDirective &D, const llvm::function_ref< llvm::Value *(CodeGenFunction &)> CondGen)
Emit final code for linear clauses.
llvm::Type * ConvertType(QualType T)
llvm::Value * EmitCXXTypeidExpr(const CXXTypeidExpr *E)
void EmitNoreturnRuntimeCallOrInvoke(llvm::FunctionCallee callee, ArrayRef< llvm::Value * > args)
void EmitOMPSectionsDirective(const OMPSectionsDirective &S)
void EmitOpenACCEnterDataConstruct(const OpenACCEnterDataConstruct &S)
Address GetAddrOfBlockDecl(const VarDecl *var)
CodeGenTypes & getTypes() const
void EmitWritebacks(const CallArgList &Args)
EmitWriteback - Emit callbacks for function.
void EmitARCInitWeak(Address addr, llvm::Value *value)
llvm::CallBase * EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee, ArrayRef< llvm::Value * > args, const Twine &name="")
LValue EmitArraySectionExpr(const ArraySectionExpr *E, bool IsLowerBound=true)
llvm::BasicBlock * OMPScanExitBlock
llvm::Value * EmitSystemZBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
void emitAlignmentAssumption(llvm::Value *PtrValue, const Expr *E, SourceLocation AssumptionLoc, llvm::Value *Alignment, llvm::Value *OffsetValue=nullptr)
static void EmitOMPTargetTeamsDistributeParallelForSimdDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetTeamsDistributeParallelForSimdDirective &S)
Emit device code for the target teams distribute parallel for simd directive.
bool IsSanitizerScope
True if CodeGen currently emits code implementing sanitizer checks.
LValue EmitCXXTypeidLValue(const CXXTypeidExpr *E)
llvm::CallBase * EmitCallOrInvoke(llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args, const Twine &Name="")
HLSLControlFlowHintAttr::Spelling HLSLControlFlowAttr
HLSL Branch attribute.
void EmitDoStmt(const DoStmt &S, ArrayRef< const Attr * > Attrs={})
llvm::Value * EmitRISCVCpuIs(StringRef CPUStr)
void EmitStoreThroughGlobalRegLValue(RValue Src, LValue Dst)
Address EmitCXXUuidofExpr(const CXXUuidofExpr *E)
bool InAlwaysInlineAttributedStmt
True if the current statement has always_inline attribute.
RawAddress CreateTempAlloca(llvm::Type *Ty, CharUnits align, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr, RawAddress *Alloca=nullptr)
void EmitOMPUseDeviceAddrClause(const OMPUseDeviceAddrClause &C, OMPPrivateScope &PrivateScope, const llvm::DenseMap< const ValueDecl *, llvm::Value * > CaptureDeviceAddrMap)
void generateObjCSetterBody(const ObjCImplementationDecl *classImpl, const ObjCPropertyImplDecl *propImpl, llvm::Constant *AtomicHelperFn)
void EmitOMPTargetSimdDirective(const OMPTargetSimdDirective &S)
void EmitOMPTaskyieldDirective(const OMPTaskyieldDirective &S)
void EmitCallArg(CallArgList &args, const Expr *E, QualType ArgType)
EmitCallArg - Emit a single call argument.
llvm::Value * EmitSMEReadWrite(const SVETypeFlags &TypeFlags, llvm::SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
void EmitOpenACCComputeConstruct(const OpenACCComputeConstruct &S)
void EmitOMPSimdDirective(const OMPSimdDirective &S)
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, LValue LV, QualType Type, SanitizerSet SkippedChecks=SanitizerSet(), llvm::Value *ArraySize=nullptr)
llvm::Value * EmitSMELd1St1(const SVETypeFlags &TypeFlags, llvm::SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
void EmitOMPCriticalDirective(const OMPCriticalDirective &S)
llvm::SmallVector< const ParmVarDecl *, 4 > FnArgs
Save Parameter Decl for coroutine.
const TargetInfo & Target
void ActivateCleanupBlock(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *DominatingIP)
ActivateCleanupBlock - Activates an initially-inactive cleanup.
void PopCleanupBlocks(EHScopeStack::stable_iterator OldCleanupStackSize, size_t OldLifetimeExtendedStackSize, std::initializer_list< llvm::Value ** > ValuesToReload={})
Takes the old cleanup stack size and emits the cleanup blocks that have been added,...
QualType BuildFunctionArgList(GlobalDecl GD, FunctionArgList &Args)
void GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn, const VarDecl *D, llvm::GlobalVariable *Addr, bool PerformInit)
llvm::Value * EmitPPCBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
LValue EmitStringLiteralLValue(const StringLiteral *E)
void EmitCapturedLocals(CodeGenFunction &ParentCGF, const Stmt *OutlinedStmt, bool IsFilter)
Scan the outlined statement for captures from the parent function.
static Destroyer destroyARCStrongPrecise
void EmitARCIntrinsicUse(ArrayRef< llvm::Value * > values)
RValue EmitNVPTXDevicePrintfCallExpr(const CallExpr *E)
void EmitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt &S)
void EmitOMPForDirective(const OMPForDirective &S)
void EmitOMPMetaDirective(const OMPMetaDirective &S)
void EmitCtorPrologue(const CXXConstructorDecl *CD, CXXCtorType Type, FunctionArgList &Args)
RawAddress NormalCleanupDest
i32s containing the indexes of the cleanup destinations.
RValue EmitAtomicLoad(LValue lvalue, SourceLocation loc, llvm::AtomicOrdering AO, bool IsVolatile=false, AggValueSlot slot=AggValueSlot::ignored())
llvm::Value * EvaluateExprAsBool(const Expr *E)
EvaluateExprAsBool - Perform the usual unary conversions on the specified expression and compare the ...
llvm::Value * EmitSVEStructLoad(const SVETypeFlags &TypeFlags, SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
void EmitOMPTargetUpdateDirective(const OMPTargetUpdateDirective &S)
Address LoadCXXThisAddress()
LValue InitCapturedStruct(const CapturedStmt &S)
void EmitOMPParallelMasterDirective(const OMPParallelMasterDirective &S)
void EmitReturnStmt(const ReturnStmt &S)
unsigned NextCleanupDestIndex
AggValueSlot::Overlap_t getOverlapForReturnValue()
Determine whether a return value slot may overlap some other object.
RValue EmitCoawaitExpr(const CoawaitExpr &E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
void EmitLambdaDelegatingInvokeBody(const CXXMethodDecl *MD, CallArgList &CallArgs)
Address EmitMSVAListRef(const Expr *E)
Emit a "reference" to a __builtin_ms_va_list; this is always the value of the expression,...
llvm::Value * EmitWithOriginalRHSBitfieldAssignment(const BinaryOperator *E, llvm::Value **Previous, QualType *SrcType)
Retrieve the implicit cast expression of the rhs in a binary operator expression by passing pointers ...
LValue EmitOMPSharedLValue(const Expr *E)
Emits the lvalue for the expression with possibly captured variable.
void SpecialInitFn(CodeGenFunction &Init, const VarDecl &D, llvm::Value *Address)
llvm::Value * EmitCheckedInBoundsGEP(llvm::Type *ElemTy, llvm::Value *Ptr, ArrayRef< llvm::Value * > IdxList, bool SignedIndices, bool IsSubtraction, SourceLocation Loc, const Twine &Name="")
Same as IRBuilder::CreateInBoundsGEP, but additionally emits a check to detect undefined behavior whe...
VarBypassDetector Bypasses
void EmitOMPTargetTeamsDistributeSimdDirective(const OMPTargetTeamsDistributeSimdDirective &S)
llvm::Value * EmitARCRetainNonBlock(llvm::Value *value)
void processInReduction(const OMPExecutableDirective &S, OMPTaskDataTy &Data, CodeGenFunction &CGF, const CapturedStmt *CS, OMPPrivateScope &Scope)
void EmitOMPMasterDirective(const OMPMasterDirective &S)
void EmitOpenACCHostDataConstruct(const OpenACCHostDataConstruct &S)
void EmitOMPMasterTaskLoopDirective(const OMPMasterTaskLoopDirective &S)
llvm::Value * EmitObjCExtendObjectLifetime(QualType T, llvm::Value *Ptr)
EHScopeStack::stable_iterator PrologueCleanupDepth
PrologueCleanupDepth - The cleanup depth enclosing all the cleanups associated with the parameters.
void EmitOpenACCUpdateConstruct(const OpenACCUpdateConstruct &S)
void EmitOMPTargetParallelGenericLoopDirective(const OMPTargetParallelGenericLoopDirective &S)
void pushStackRestore(CleanupKind kind, Address SPMem)
llvm::Value * EmitDynamicCast(Address V, const CXXDynamicCastExpr *DCE)
llvm::Value * EmitNeonRShiftImm(llvm::Value *Vec, llvm::Value *Amt, llvm::Type *Ty, bool usgn, const char *name)
void GenerateObjCSetter(ObjCImplementationDecl *IMP, const ObjCPropertyImplDecl *PID)
GenerateObjCSetter - Synthesize an Objective-C property setter function for the given property.
void EmitOMPAssumeDirective(const OMPAssumeDirective &S)
bool EmitOMPCopyinClause(const OMPExecutableDirective &D)
Emit code for copyin clause in D directive.
llvm::Value * EmitBlockCopyAndAutorelease(llvm::Value *Block, QualType Ty)
static bool mightAddDeclToScope(const Stmt *S)
Determine if the given statement might introduce a declaration into the current scope,...
SmallVector< llvm::Type *, 2 > getSVEOverloadTypes(const SVETypeFlags &TypeFlags, llvm::Type *ReturnType, ArrayRef< llvm::Value * > Ops)
void EmitOMPMaskedDirective(const OMPMaskedDirective &S)
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
LValue EmitMatrixSubscriptExpr(const MatrixSubscriptExpr *E)
LValue EmitPseudoObjectLValue(const PseudoObjectExpr *e)
static bool hasAggregateEvaluationKind(QualType T)
void EmitOMPPrivateClause(const OMPExecutableDirective &D, OMPPrivateScope &PrivateScope)
void EmitOMPTaskwaitDirective(const OMPTaskwaitDirective &S)
llvm::Function * GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S, SourceLocation Loc)
llvm::Value * EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, bool isInc, bool isPre)
void EmitOMPTargetParallelForSimdDirective(const OMPTargetParallelForSimdDirective &S)
RawAddress CreateIRTemp(QualType T, const Twine &Name="tmp")
CreateIRTemp - Create a temporary IR object of the given type, with appropriate alignment.
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo, bool isNontemporal=false)
void emitImplicitAssignmentOperatorBody(FunctionArgList &Args)
void emitARCCopyAssignWeak(QualType Ty, Address DstAddr, Address SrcAddr)
void SetFPAccuracy(llvm::Value *Val, float Accuracy)
SetFPAccuracy - Set the minimum required accuracy of the given floating point operation,...
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
void EmitBreakStmt(const BreakStmt &S)
Address GenerateCapturedStmtArgument(const CapturedStmt &S)
void EmitLambdaVLACapture(const VariableArrayType *VAT, LValue LV)
static void EmitOMPTargetParallelGenericLoopDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetParallelGenericLoopDirective &S)
Emit device code for the target parallel loop directive.
llvm::Value * LoadCXXThis()
LoadCXXThis - Load the value of 'this'.
llvm::function_ref< void(CodeGenFunction &, SourceLocation, const unsigned, const bool)> CodeGenOrderedTy
llvm::Value * EmitARMMVEBuiltinExpr(unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue, llvm::Triple::ArchType Arch)
void GenerateObjCGetter(ObjCImplementationDecl *IMP, const ObjCPropertyImplDecl *PID)
GenerateObjCGetter - Synthesize an Objective-C property getter function.
LValue EmitLoadOfReferenceLValue(LValue RefLVal)
const CallExpr * MustTailCall
const CGFunctionInfo * CurFnInfo
LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
bool isObviouslyBranchWithoutCleanups(JumpDest Dest) const
isObviouslyBranchWithoutCleanups - Return true if a branch to the specified destination obviously has...
llvm::Value * EmitSVEStructStore(const SVETypeFlags &TypeFlags, SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
llvm::BasicBlock * getFuncletEHDispatchBlock(EHScopeStack::stable_iterator scope)
void EmitObjCAutoreleasePoolCleanup(llvm::Value *Ptr)
llvm::Value * getArrayInitIndex()
Get the index of the current ArrayInitLoopExpr, if any.
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock::iterator InsertPt) const
CGBuilder insert helper.
void pushKmpcAllocFree(CleanupKind Kind, std::pair< llvm::Value *, llvm::Value * > AddrSizePair)
LValue EmitObjCIsaExpr(const ObjCIsaExpr *E)
void EmitParmDecl(const VarDecl &D, ParamValue Arg, unsigned ArgNo)
EmitParmDecl - Emit a ParmVarDecl or an ImplicitParamDecl.
llvm::Value * EmitSEHAbnormalTermination()
void EmitCoreturnStmt(const CoreturnStmt &S)
void EnterDtorCleanups(const CXXDestructorDecl *Dtor, CXXDtorType Type)
EnterDtorCleanups - Enter the cleanups necessary to complete the given phase of destruction for a des...
void EmitAtomicStore(RValue rvalue, LValue lvalue, bool isInit)
void EmitInitializationToLValue(const Expr *E, LValue LV, AggValueSlot::IsZeroed_t IsZeroed=AggValueSlot::IsNotZeroed)
EmitInitializationToLValue - Emit an initializer to an LValue.
Address EmitFieldAnnotations(const FieldDecl *D, Address V)
Emit field annotations for the given field & value.
llvm::Value * EmitScalarConversion(llvm::Value *Src, QualType SrcTy, QualType DstTy, SourceLocation Loc)
Emit a conversion from the specified type to the specified destination type, both of which are LLVM s...
llvm::Value * EmitX86BuiltinExpr(unsigned BuiltinID, const CallExpr *E)
void EmitOpenACCSetConstruct(const OpenACCSetConstruct &S)
llvm::BasicBlock * OMPAfterScanBlock
LValue EmitCXXUuidofLValue(const CXXUuidofExpr *E)
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
Address ReturnValue
ReturnValue - The temporary alloca to hold the return value.
void EmitOMPTargetExitDataDirective(const OMPTargetExitDataDirective &S)
static bool isNullPointerAllowed(TypeCheckKind TCK)
Determine whether the pointer type check TCK permits null pointers.
void EmitOMPErrorDirective(const OMPErrorDirective &S)
static Destroyer destroyARCStrongImprecise
void EmitOMPSectionDirective(const OMPSectionDirective &S)
RValue getOrCreateOpaqueRValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its RValue mapping if it exists, otherwise create one.
static void EmitOMPTargetParallelDeviceFunction(CodeGenModule &CGM, StringRef ParentName, const OMPTargetParallelDirective &S)
llvm::AtomicRMWInst * emitAtomicRMWInst(llvm::AtomicRMWInst::BinOp Op, Address Addr, llvm::Value *Val, llvm::AtomicOrdering Order=llvm::AtomicOrdering::SequentiallyConsistent, llvm::SyncScope::ID SSID=llvm::SyncScope::System, const AtomicExpr *AE=nullptr)
Emit an atomicrmw instruction, and applying relevant metadata when applicable.
llvm::Value * EmitSVEAllTruePred(const SVETypeFlags &TypeFlags)
void EmitOMPBarrierDirective(const OMPBarrierDirective &S)
void EmitStopPoint(const Stmt *S)
EmitStopPoint - Emit a debug stoppoint if we are emitting debug info.
void EmitIgnoredConditionalOperator(const AbstractConditionalOperator *E)
RValue GetUndefRValue(QualType Ty)
GetUndefRValue - Get an appropriate 'undef' rvalue for the given type.
LValue EmitLValueForIvar(QualType ObjectTy, llvm::Value *Base, const ObjCIvarDecl *Ivar, unsigned CVRQualifiers)
void ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock=false)
void EmitOMPCancellationPointDirective(const OMPCancellationPointDirective &S)
llvm::Value * EmitObjCAlloc(llvm::Value *value, llvm::Type *returnType)
llvm::Value * emitScalarConstant(const ConstantEmission &Constant, Expr *E)
LValue EmitStmtExprLValue(const StmtExpr *E)
llvm::Instruction * CurrentFuncletPad
RValue EmitCallExpr(const CallExpr *E, ReturnValueSlot ReturnValue=ReturnValueSlot(), llvm::CallBase **CallOrInvoke=nullptr)
llvm::Type * SVEBuiltinMemEltTy(const SVETypeFlags &TypeFlags)
SVEBuiltinMemEltTy - Returns the memory element type for this memory access builtin.
void EnsureInsertPoint()
EnsureInsertPoint - Ensure that an insertion point is defined so that emitted IR has a place to go.
void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S)
LValue MakeNaturalAlignPointeeAddrLValue(llvm::Value *V, QualType T)
Given a value of type T* that may not be to a complete object, construct an l-value with the natural ...
llvm::LLVMContext & getLLVMContext()
void EmitOMPTaskLoopSimdDirective(const OMPTaskLoopSimdDirective &S)
bool SawAsmBlock
Whether we processed a Microsoft-style asm block during CodeGen.
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type,...
void ResolveBranchFixups(llvm::BasicBlock *Target)
void AddAMDGPUFenceAddressSpaceMMRA(llvm::Instruction *Inst, const CallExpr *E)
bool checkIfFunctionMustProgress()
Returns true if a function must make progress, which means the mustprogress attribute can be added.
void EmitOMPTargetTeamsDistributeParallelForDirective(const OMPTargetTeamsDistributeParallelForDirective &S)
bool LValueIsSuitableForInlineAtomic(LValue Src)
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
void EmitAndRegisterVariableArrayDimensions(CGDebugInfo *DI, const VarDecl &D, bool EmitDebugInfo)
Emits the alloca and debug information for the size expressions for each dimension of an array.
RValue EmitLoadOfAnyValue(LValue V, AggValueSlot Slot=AggValueSlot::ignored(), SourceLocation Loc={})
Like EmitLoadOfLValue but also handles complex and aggregate types.
llvm::SmallVector< VPtr, 4 > VPtrsVector
llvm::Value * EmitSMEZero(const SVETypeFlags &TypeFlags, llvm::SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
llvm::Value * getSelectorFromSlot()
llvm::Value * EmitARCRetainScalarExpr(const Expr *expr)
bool EmitOMPLastprivateClauseInit(const OMPExecutableDirective &D, OMPPrivateScope &PrivateScope)
Emit initial code for lastprivate variables.
static std::string getNonTrivialCopyConstructorStr(QualType QT, CharUnits Alignment, bool IsVolatile, ASTContext &Ctx)
void InitializeVTablePointers(const CXXRecordDecl *ClassDecl)
llvm::Value * EmitRISCVBuiltinExpr(unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue)
void EmitOMPParallelSectionsDirective(const OMPParallelSectionsDirective &S)
static Destroyer emitARCIntrinsicUse
llvm::Value * EmitCommonNeonBuiltinExpr(unsigned BuiltinID, unsigned LLVMIntrinsic, unsigned AltLLVMIntrinsic, const char *NameHint, unsigned Modifier, const CallExpr *E, SmallVectorImpl< llvm::Value * > &Ops, Address PtrOp0, Address PtrOp1, llvm::Triple::ArchType Arch)
void getVTablePointers(BaseSubobject Base, const CXXRecordDecl *NearestVBase, CharUnits OffsetFromNearestVBase, bool BaseIsNonVirtualPrimaryBase, const CXXRecordDecl *VTableClass, VisitedVirtualBasesSetTy &VBases, VPtrsVector &vptrs)
llvm::function_ref< void(CodeGenFunction &, const OMPLoopDirective &, JumpDest)> CodeGenLoopTy
void BuildBlockRelease(llvm::Value *DeclPtr, BlockFieldFlags flags, bool CanThrow)
llvm::Value * EmitNeonCall(llvm::Function *F, SmallVectorImpl< llvm::Value * > &O, const char *name, unsigned shift=0, bool rightshift=false)
void EmitOMPCanonicalLoop(const OMPCanonicalLoop *S)
Emit an OMPCanonicalLoop using the OpenMPIRBuilder.
void InitializeVTablePointer(const VPtr &vptr)
Initialize the vtable pointer of the given subobject.
llvm::Value * EmitAnnotationCall(llvm::Function *AnnotationFn, llvm::Value *AnnotatedVal, StringRef AnnotationStr, SourceLocation Location, const AnnotateAttr *Attr)
Emit an annotation call (intrinsic).
llvm::Value * EmitCXXNewExpr(const CXXNewExpr *E)
RValue EmitCall(QualType FnType, const CGCallee &Callee, const CallExpr *E, ReturnValueSlot ReturnValue, llvm::Value *Chain=nullptr, llvm::CallBase **CallOrInvoke=nullptr, CGFunctionInfo const **ResolvedFnInfo=nullptr)
void EmitOMPTeamsDistributeSimdDirective(const OMPTeamsDistributeSimdDirective &S)
llvm::BasicBlock * GetIndirectGotoBlock()
void EmitAsmStmt(const AsmStmt &S)
Address emitAddrOfRealComponent(Address complex, QualType complexType)
void EmitARCDestroyStrong(Address addr, ARCPreciseLifetime_t precise)
void EmitObjCAtTryStmt(const ObjCAtTryStmt &S)
static bool isVptrCheckRequired(TypeCheckKind TCK, QualType Ty)
Determine whether the pointer type check TCK requires a vptr check.
llvm::ScalableVectorType * getSVEPredType(const SVETypeFlags &TypeFlags)
LValue EmitComplexCompoundAssignmentLValue(const CompoundAssignOperator *E)
llvm::Type * convertTypeForLoadStore(QualType ASTTy, llvm::Type *LLVMTy=nullptr)
void pushRegularPartialArrayCleanup(llvm::Value *arrayBegin, llvm::Value *arrayEnd, QualType elementType, CharUnits elementAlignment, Destroyer *destroyer)
llvm::Value * getExceptionFromSlot()
Returns the contents of the function's exception object and selector slots.
llvm::DebugLoc EmitReturnBlock()
Emit the unified return block, trying to avoid its emission when possible.
LValue EmitConditionalOperatorLValue(const AbstractConditionalOperator *E)
void GenerateCode(GlobalDecl GD, llvm::Function *Fn, const CGFunctionInfo &FnInfo)
llvm::Value * EmitSVEGatherPrefetch(const SVETypeFlags &TypeFlags, SmallVectorImpl< llvm::Value * > &Ops, unsigned IntID)
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, ArrayRef< Address > args, const Twine &name="")
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...
bool hasLabelBeenSeenInCurrentScope() const
Return true if a label was seen in the current scope.
RValue EmitAtomicExpr(AtomicExpr *E)
RValue EmitCXXDestructorCall(GlobalDecl Dtor, const CGCallee &Callee, llvm::Value *This, QualType ThisTy, llvm::Value *ImplicitParam, QualType ImplicitParamTy, const CallExpr *E, llvm::CallBase **CallOrInvoke=nullptr)
CGPointerAuthInfo EmitPointerAuthInfo(const PointerAuthSchema &Schema, llvm::Value *StorageAddress, GlobalDecl SchemaDecl, QualType SchemaType)
LValue EmitExtVectorElementExpr(const ExtVectorElementExpr *E)
void EmitCXXGuardedInitBranch(llvm::Value *NeedsInit, llvm::BasicBlock *InitBlock, llvm::BasicBlock *NoInitBlock, GuardKind Kind, const VarDecl *D)
Emit a branch to select whether or not to perform guarded initialization.
void EmitOMPTargetParallelForDirective(const OMPTargetParallelForDirective &S)
RValue EmitLoadOfBitfieldLValue(LValue LV, SourceLocation Loc)
llvm::Value * EmitSPIRVBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
Address getEHSelectorSlot()
LValue EmitLoadOfReferenceLValue(Address RefAddr, QualType RefTy, AlignmentSource Source=AlignmentSource::Type)
std::pair< bool, RValue > EmitOMPAtomicSimpleUpdateExpr(LValue X, RValue E, BinaryOperatorKind BO, bool IsXLHSInRHSPart, llvm::AtomicOrdering AO, SourceLocation Loc, const llvm::function_ref< RValue(RValue)> CommonGen)
Emit atomic update code for constructs: X = X BO E or X = E BO E.
LValue EmitCXXBindTemporaryLValue(const CXXBindTemporaryExpr *E)
llvm::Value * EmitBPFBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
LValue EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E)
LValue EmitLValueForLambdaField(const FieldDecl *Field)
void EmitMustTailThunk(GlobalDecl GD, llvm::Value *AdjustedThisPtr, llvm::FunctionCallee Callee)
Emit a musttail call for a thunk with a potentially adjusted this pointer.
static bool IsWrappedCXXThis(const Expr *E)
Check if E is a C++ "this" pointer wrapped in value-preserving casts.
static bool containsBreak(const Stmt *S)
containsBreak - Return true if the statement contains a break out of it.
void pushDestroy(CleanupKind kind, Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray)
llvm::Value * EmitSVETupleSetOrGet(const SVETypeFlags &TypeFlags, ArrayRef< llvm::Value * > Ops)
llvm::Type * ConvertType(const TypeDecl *T)
This class organizes the cross-function state that is used while generating LLVM code.
const LangOptions & getLangOpts() const
CharUnits getNaturalTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, bool forPointeeType=false)
CodeGenTypes & getTypes()
CGPointerAuthInfo getPointerAuthInfoForPointeeType(QualType type)
const llvm::DataLayout & getDataLayout() const
TBAAAccessInfo getTBAAAccessInfo(QualType AccessType)
getTBAAAccessInfo - Get TBAA information that describes an access to an object of the given type.
ASTContext & getContext() const
const TargetCodeGenInfo & getTargetCodeGenInfo()
const CodeGenOptions & getCodeGenOpts() const
llvm::LLVMContext & getLLVMContext()
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
A specialization of Address that requires the address to be an LLVM Constant.
static ConstantAddress invalid()
static bool needsSaving(RValue value)
DominatingLLVMValue::saved_type first
DominatingValue< Address >::saved_type AggregateAddr
static saved_type save(CodeGenFunction &CGF, RValue value)
RValue restore(CodeGenFunction &CGF)
Information for lazily generating a cleanup.
ConditionalCleanup stores the saved form of its parameters, then restores them and performs the clean...
A saved depth on the scope stack.
A stack of scopes which respond to exceptions, including cleanups and catch blocks.
stable_iterator getInnermostNormalCleanup() const
Returns the innermost normal cleanup on the stack, or stable_end() if there are no normal cleanups.
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
bool requiresLandingPad() const
static stable_iterator stable_end()
Create a stable reference to the bottom of the EH stack.
void pushCleanupTuple(CleanupKind Kind, std::tuple< As... > A)
Push a lazily-created cleanup on the stack. Tuple version.
FunctionArgList - Type for representing both the decl and type of parameters to a function.
LValue - This represents an lvalue references.
CharUnits getAlignment() const
static LValue MakeAddr(Address Addr, QualType type, ASTContext &Context, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
A stack of loop information corresponding to loop nesting levels.
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(llvm::Value *V)
An abstract representation of an aligned address.
static RawAddress invalid()
Class provides a way to call simple version of codegen for OpenMP region, or an advanced with possibl...
ReturnValueSlot - Contains the address where the return value of a function can be stored,...
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
The class detects jumps which bypass local variables declaration: goto L; int a; L:
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
ContinueStmt - This represents a continue.
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents an expression that might suspend coroutine execution; either a co_await or co_yield expres...
Represents a 'co_yield' expression.
Represents the current source location and context used to determine the value of the source location...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Decl - This represents one declaration (or definition), e.g.
DoStmt - This represents a 'do/while' stmt.
This represents one expression.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
GlobalDecl - represents a global declaration.
const Decl * getDecl() const
GotoStmt - This represents a direct goto.
This class represents temporary values used to represent inout and out arguments in HLSL.
IfStmt - This represents an if/then/else.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
FPExceptionModeKind
Possible floating point exception behavior.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Represents a point when we exit a loop.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Represents a C++ nested name specifier, such as "\::std::vector::".
This represents '#pragma omp atomic' directive.
This represents '#pragma omp barrier' directive.
This represents '#pragma omp cancel' directive.
This represents '#pragma omp cancellation point' directive.
Representation of an OpenMP canonical loop.
This represents '#pragma omp critical' directive.
This represents '#pragma omp depobj' directive.
This represents '#pragma omp distribute' directive.
This represents '#pragma omp distribute parallel for' composite directive.
This represents '#pragma omp distribute parallel for simd' composite directive.
This represents '#pragma omp distribute simd' composite directive.
This represents '#pragma omp error' directive.
This is a basic class for representing single OpenMP executable directive.
This represents '#pragma omp flush' directive.
This represents '#pragma omp for' directive.
This represents '#pragma omp for simd' directive.
This represents '#pragma omp loop' directive.
Represents the '#pragma omp interchange' loop transformation directive.
This represents '#pragma omp interop' directive.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
This represents '#pragma omp masked' directive.
This represents '#pragma omp masked taskloop' directive.
This represents '#pragma omp masked taskloop simd' directive.
This represents '#pragma omp master' directive.
This represents '#pragma omp master taskloop' directive.
This represents '#pragma omp master taskloop simd' directive.
This represents '#pragma omp ordered' directive.
This represents '#pragma omp parallel' directive.
This represents '#pragma omp parallel for' directive.
This represents '#pragma omp parallel for simd' directive.
This represents '#pragma omp parallel masked' directive.
This represents '#pragma omp parallel masked taskloop' directive.
This represents '#pragma omp parallel masked taskloop simd' directive.
This represents '#pragma omp parallel master' directive.
This represents '#pragma omp parallel master taskloop' directive.
This represents '#pragma omp parallel master taskloop simd' directive.
This represents '#pragma omp parallel sections' directive.
Represents the '#pragma omp reverse' loop transformation directive.
This represents '#pragma omp scan' directive.
This represents '#pragma omp scope' directive.
This represents '#pragma omp section' directive.
This represents '#pragma omp sections' directive.
This represents '#pragma omp simd' directive.
This represents '#pragma omp single' directive.
This represents '#pragma omp target data' directive.
This represents '#pragma omp target' directive.
This represents '#pragma omp target enter data' directive.
This represents '#pragma omp target exit data' directive.
This represents '#pragma omp target parallel' directive.
This represents '#pragma omp target parallel for' directive.
This represents '#pragma omp target parallel for simd' directive.
This represents '#pragma omp target parallel loop' directive.
This represents '#pragma omp target simd' directive.
This represents '#pragma omp target teams' directive.
This represents '#pragma omp target teams distribute' combined directive.
This represents '#pragma omp target teams distribute parallel for' combined directive.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
This represents '#pragma omp target teams distribute simd' combined directive.
This represents '#pragma omp target teams loop' directive.
This represents '#pragma omp target update' directive.
This represents '#pragma omp task' directive.
This represents '#pragma omp taskloop' directive.
This represents '#pragma omp taskloop simd' directive.
This represents '#pragma omp taskgroup' directive.
This represents '#pragma omp taskwait' directive.
This represents '#pragma omp taskyield' directive.
This represents '#pragma omp teams' directive.
This represents '#pragma omp teams distribute' directive.
This represents '#pragma omp teams distribute parallel for' composite directive.
This represents '#pragma omp teams distribute parallel for simd' composite directive.
This represents '#pragma omp teams distribute simd' combined directive.
This represents '#pragma omp teams loop' directive.
This represents the '#pragma omp tile' loop transformation directive.
This represents the '#pragma omp unroll' loop transformation directive.
This represents clause 'use_device_addr' in the '#pragma omp ...' directives.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
Represents Objective-C's @synchronized statement.
Represents Objective-C's @throw statement.
Represents Objective-C's @try ... @catch ... @finally statement.
Represents Objective-C's @autoreleasepool Statement.
ObjCBoxedExpr - used for generalized expression boxing.
ObjCContainerDecl - Represents a container for method declarations.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
Represents Objective-C's collection statement.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl - Represents an instance or class method declaration.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
This class represents a 'loop' construct.
Represents a parameter to a function.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
@ DK_objc_strong_lifetime
The collection of all-type qualifiers we support.
Represents a struct/union/class.
bool hasVolatileMember() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Represents a __leave statement.
Flags to identify the types for overloaded SVE builtins.
Scope - A scope is a transient data structure that is used while parsing the program.
Encodes a location in the source.
A trivial tuple used to represent a source range.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
Likelihood
The likelihood of a branch being taken.
@ LH_None
No attribute set or branches of the IfStmt have the same attribute.
StringLiteral - This represents a string literal expression, e.g.
SwitchStmt - This represents a 'switch' stmt.
Exposes information about the current target.
Represents a declaration of a type.
The base class of the type hierarchy.
bool isReferenceType() const
const T * getAs() const
Member-template getAs'.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isLocalVarDeclOrParm() const
Similar to isLocalVarDecl but also includes parameters.
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
WhileStmt - This represents a 'while' stmt.
Defines the clang::TargetInfo interface.
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
TypeEvaluationKind
The kind of evaluation to perform on values of a particular type.
@ NormalCleanup
Denotes a cleanup that should run when a scope is exited using normal control flow (falling off the e...
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const AstTypeMatcher< ComplexType > complexType
Matches C99 complex types.
The JSON file list parser is used to communicate input to InstallAPI.
CXXCtorType
C++ constructor types.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
CapturedRegionKind
The different kinds of captured statement.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ Result
The result type of a method or function.
CXXDtorType
C++ destructor types.
const FunctionProtoType * T
@ Success
Template argument deduction was successful.
llvm::fp::ExceptionBehavior ToConstrainedExceptMD(LangOptions::FPExceptionModeKind Kind)
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
Diagnostic wrappers for TextAPI types for error reporting.
Structure with information about how a bitfield should be accessed.
llvm::SmallVector< llvm::AllocaInst * > Take()
AllocaTrackerRAII(CodeGenFunction &CGF)
std::unique_ptr< CGCoroData > Data
CXXDefaultArgExprScope(CodeGenFunction &CGF, const CXXDefaultArgExpr *E)
size_t OldDeactivateCleanupStackSize
CleanupDeactivationScope(CodeGenFunction &CGF)
~CleanupDeactivationScope()
llvm::Instruction * DominatingIP
EHScopeStack::stable_iterator Cleanup
std::optional< StringRef > Architecture
FMVResolverOption(llvm::Function *F, ArrayRef< StringRef > Feats, std::optional< StringRef > Arch=std::nullopt)
llvm::SmallVector< StringRef, 8 > Features
llvm::Function * Function
A jump destination is an abstract label, branching to which may require a jump out through normal cle...
void setScopeDepth(EHScopeStack::stable_iterator depth)
llvm::BasicBlock * getBlock() const
EHScopeStack::stable_iterator getScopeDepth() const
unsigned getDestIndex() const
JumpDest(llvm::BasicBlock *Block, EHScopeStack::stable_iterator Depth, unsigned Index)
static Address getAddrOfThreadPrivate(CodeGenFunction &CGF, const VarDecl *VD, Address VDAddr, SourceLocation Loc)
Returns address of the threadprivate variable for the current thread.
OMPBuilderCBHelpers()=delete
llvm::OpenMPIRBuilder::InsertPointTy InsertPointTy
static void EmitOMPOutlinedRegionBody(CodeGenFunction &CGF, const Stmt *RegionBodyStmt, InsertPointTy AllocaIP, InsertPointTy CodeGenIP, Twine RegionName)
Emit the body of an OMP region that will be outlined in OpenMPIRBuilder::finalize().
static Address getAddressOfLocalVariable(CodeGenFunction &CGF, const VarDecl *VD)
Gets the OpenMP-specific address of the local variable /p VD.
static void EmitCaptureStmt(CodeGenFunction &CGF, InsertPointTy CodeGenIP, llvm::BasicBlock &FiniBB, llvm::Function *Fn, ArrayRef< llvm::Value * > Args)
static std::string getNameWithSeparators(ArrayRef< StringRef > Parts, StringRef FirstSeparator=".", StringRef Separator=".")
Get the platform-specific name separator.
static void FinalizeOMPRegion(CodeGenFunction &CGF, InsertPointTy IP)
Emit the Finalization for an OMP region.
static void EmitOMPInlinedRegionBody(CodeGenFunction &CGF, const Stmt *RegionBodyStmt, InsertPointTy AllocaIP, InsertPointTy CodeGenIP, Twine RegionName)
Emit the body of an OMP region.
OMPBuilderCBHelpers & operator=(const OMPBuilderCBHelpers &)=delete
OMPBuilderCBHelpers(const OMPBuilderCBHelpers &)=delete
unsigned NumberOfTargetItems
OMPTargetDataInfo(Address BasePointersArray, Address PointersArray, Address SizesArray, Address MappersArray, unsigned NumberOfTargetItems)
OMPTargetDataInfo()=default
Address BasePointersArray
PrototypeWrapper(const FunctionProtoType *FT)
llvm::PointerUnion< const FunctionProtoType *, const ObjCMethodDecl * > P
PrototypeWrapper(const ObjCMethodDecl *MD)
Struct with all information about dynamic [sub]class needed to set vptr.
const CXXRecordDecl * NearestVBase
const CXXRecordDecl * VTableClass
CharUnits OffsetFromNearestVBase
VlaSizePair(llvm::Value *NE, QualType T)
This structure provides a set of types that are commonly used during IR emission.
llvm::PointerType * Int8PtrTy
Helper class with most of the code for saving a value for a conditional expression cleanup.
static llvm::Value * restore(CodeGenFunction &CGF, saved_type value)
static saved_type save(CodeGenFunction &CGF, llvm::Value *value)
static bool needsSaving(llvm::Value *value)
Answer whether the given value needs extra work to be saved.
llvm::PointerIntPair< llvm::Value *, 1, bool > saved_type
static type restore(CodeGenFunction &CGF, saved_type value)
DominatingLLVMValue::saved_type Offset
llvm::PointerType * EffectiveType
DominatingLLVMValue::saved_type BasePtr
static type restore(CodeGenFunction &CGF, saved_type value)
static bool needsSaving(type value)
static saved_type save(CodeGenFunction &CGF, type value)
static bool needsSaving(type value)
static saved_type save(CodeGenFunction &CGF, type value)
static type restore(CodeGenFunction &CGF, saved_type value)
A metaprogramming class for ensuring that a value will dominate an arbitrary position in a function.
static saved_type save(CodeGenFunction &CGF, type value)
Scheduling data for loop-based OpenMP directives.
The this pointer adjustment as well as an optional return adjustment for a thunk.