Lines Matching refs:CGF
160 static saved_type save(CodeGenFunction &CGF, llvm::Value *value);
161 static llvm::Value *restore(CodeGenFunction &CGF, saved_type value);
168 static type restore(CodeGenFunction &CGF, saved_type value) {
169 return static_cast<T*>(DominatingLLVMValue::restore(CGF, value));
186 static saved_type save(CodeGenFunction &CGF, type value) {
187 return { DominatingLLVMValue::save(CGF, value.getPointer()),
190 static type restore(CodeGenFunction &CGF, saved_type value) {
191 return Address(DominatingLLVMValue::restore(CGF, value.SavedValue),
212 static saved_type save(CodeGenFunction &CGF, RValue value);
213 RValue restore(CodeGenFunction &CGF);
221 static saved_type save(CodeGenFunction &CGF, type value) {
222 return saved_type::save(CGF, value);
224 static type restore(CodeGenFunction &CGF, saved_type value) {
225 return value.restore(CGF);
449 virtual void EmitBody(CodeGenFunction &CGF, const Stmt *S) {
450 CGF.incrementProfileCounter(S);
451 CGF.EmitStmt(S);
481 CodeGenFunction &CGF;
484 CGCapturedStmtRAII(CodeGenFunction &CGF,
486 : CGF(CGF), PrevCapturedStmtInfo(CGF.CapturedStmtInfo) {
487 CGF.CapturedStmtInfo = NewCapturedStmtInfo;
489 ~CGCapturedStmtRAII() { CGF.CapturedStmtInfo = PrevCapturedStmtInfo; }
525 CodeGenFunction *CGF;
527 SanitizerScope(CodeGenFunction *CGF);
635 void Emit(CodeGenFunction &CGF, Flags flags) override {
636 CGF.EmitLifetimeEnd(Size, Addr);
693 CodeGenFunction &CGF;
698 CodeGenFunction &CGF,
700 : CGF(CGF),
701 ParentLoopDirectiveForScan(CGF.OMPParentLoopDirectiveForScan) {
702 CGF.OMPParentLoopDirectiveForScan = &ParentLoopDirectiveForScan;
705 CGF.OMPParentLoopDirectiveForScan = ParentLoopDirectiveForScan;
716 CGFPOptionsRAII(CodeGenFunction &CGF, FPOptions FPFeatures);
717 CGFPOptionsRAII(CodeGenFunction &CGF, const Expr *E);
722 CodeGenFunction &CGF;
752 void enter(CodeGenFunction &CGF, const Stmt *Finally,
755 void exit(CodeGenFunction &CGF);
884 CodeGenFunction& CGF;
888 explicit RunCleanupsScope(CodeGenFunction &CGF)
889 : PerformCleanup(true), CGF(CGF)
891 CleanupStackDepth = CGF.EHStack.stable_begin();
893 CGF.LifetimeExtendedCleanupStack.size();
894 OldDidCallStackSave = CGF.DidCallStackSave;
895 CGF.DidCallStackSave = false;
896 OldCleanupScopeDepth = CGF.CurrentCleanupScopeDepth;
897 CGF.CurrentCleanupScopeDepth = CleanupStackDepth;
908 return CGF.EHStack.stable_begin() != CleanupStackDepth;
919 CGF.DidCallStackSave = OldDidCallStackSave;
920 CGF.PopCleanupBlocks(CleanupStackDepth, LifetimeExtendedCleanupStackSize,
923 CGF.CurrentCleanupScopeDepth = OldCleanupScopeDepth;
941 explicit LexicalScope(CodeGenFunction &CGF, SourceRange Range)
942 : RunCleanupsScope(CGF), Range(Range), ParentScope(CGF.CurLexicalScope) {
943 CGF.CurLexicalScope = this;
944 if (CGDebugInfo *DI = CGF.getDebugInfo())
945 DI->EmitLexicalBlockStart(CGF.Builder, Range.getBegin());
956 if (CGDebugInfo *DI = CGF.getDebugInfo())
957 DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd());
962 ApplyDebugLocation DL(CGF, Range.getEnd());
970 CGF.CurLexicalScope = ParentScope;
1002 bool setVarAddr(CodeGenFunction &CGF, const VarDecl *LocalVD,
1009 auto it = CGF.LocalDeclMap.find(LocalVD);
1010 if (it != CGF.LocalDeclMap.end())
1018 Address Temp = CGF.CreateMemTemp(VarTy);
1019 CGF.Builder.CreateStore(TempAddr.getPointer(), Temp);
1030 bool apply(CodeGenFunction &CGF) {
1031 copyInto(SavedTempAddresses, CGF.LocalDeclMap);
1037 void restore(CodeGenFunction &CGF) {
1039 copyInto(SavedLocals, CGF.LocalDeclMap);
1073 explicit OMPPrivateScope(CodeGenFunction &CGF) : RunCleanupsScope(CGF) {}
1082 return MappedVars.setVarAddr(CGF, LocalVD, Addr);
1093 bool Privatize() { return MappedVars.apply(CGF); }
1109 return !VD->isLocalVarDeclOrParm() && CGF.LocalDeclMap.count(VD) > 0;
1115 void restoreMap() { MappedVars.restore(CGF); }
1122 CodeGenFunction &CGF;
1126 OMPLocalDeclMapRAII(CodeGenFunction &CGF)
1127 : CGF(CGF), SavedMap(CGF.LocalDeclMap) {}
1128 ~OMPLocalDeclMapRAII() { SavedMap.swap(CGF.LocalDeclMap); }
1188 ConditionalEvaluation(CodeGenFunction &CGF)
1189 : StartBB(CGF.Builder.GetInsertBlock()) {}
1191 void begin(CodeGenFunction &CGF) {
1192 assert(CGF.OutermostConditional != this);
1193 if (!CGF.OutermostConditional)
1194 CGF.OutermostConditional = this;
1197 void end(CodeGenFunction &CGF) {
1198 assert(CGF.OutermostConditional != nullptr);
1199 if (CGF.OutermostConditional == this)
1200 CGF.OutermostConditional = nullptr;
1224 CodeGenFunction &CGF;
1232 StmtExprEvaluation(CodeGenFunction &CGF)
1233 : CGF(CGF), SavedOutermostConditional(CGF.OutermostConditional) {
1234 CGF.OutermostConditional = nullptr;
1238 CGF.OutermostConditional = SavedOutermostConditional;
1239 CGF.EnsureInsertPoint();
1282 static OpaqueValueMappingData bind(CodeGenFunction &CGF,
1286 return bind(CGF, ov, CGF.EmitLValue(e));
1287 return bind(CGF, ov, CGF.EmitAnyExpr(e));
1290 static OpaqueValueMappingData bind(CodeGenFunction &CGF,
1294 CGF.OpaqueLValues.insert(std::make_pair(ov, lv));
1298 static OpaqueValueMappingData bind(CodeGenFunction &CGF,
1302 CGF.OpaqueRValues.insert(std::make_pair(ov, rv));
1309 data.Protection = CGF.protectFromPeepholes(rv);
1317 void unbind(CodeGenFunction &CGF) {
1321 CGF.OpaqueLValues.erase(OpaqueValue);
1323 CGF.OpaqueRValues.erase(OpaqueValue);
1324 CGF.unprotectFromPeepholes(Protection);
1331 CodeGenFunction &CGF;
1344 OpaqueValueMapping(CodeGenFunction &CGF,
1345 const AbstractConditionalOperator *op) : CGF(CGF) {
1351 Data = OpaqueValueMappingData::bind(CGF, e->getOpaqueValue(),
1357 OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *OV)
1358 : CGF(CGF) {
1362 Data = OpaqueValueMappingData::bind(CGF, OV, OV->getSourceExpr());
1366 OpaqueValueMapping(CodeGenFunction &CGF,
1369 : CGF(CGF), Data(OpaqueValueMappingData::bind(CGF, opaqueValue, lvalue)) {
1372 OpaqueValueMapping(CodeGenFunction &CGF,
1375 : CGF(CGF), Data(OpaqueValueMappingData::bind(CGF, opaqueValue, rvalue)) {
1379 Data.unbind(CGF);
1384 if (Data.isValid()) Data.unbind(CGF);
1463 void emitExit(CodeGenFunction &CGF, OpenMPDirectiveKind Kind,
1466 assert(CGF.getOMPCancelDestination(Kind).isValid());
1467 assert(CGF.HaveInsertPoint());
1469 auto IP = CGF.Builder.saveAndClearIP();
1470 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1471 CodeGen(CGF);
1472 CGF.EmitBranch(Stack.back().ContBlock.getBlock());
1473 CGF.Builder.restoreIP(IP);
1476 CodeGen(CGF);
1482 void enter(CodeGenFunction &CGF, OpenMPDirectiveKind Kind, bool HasCancel) {
1484 HasCancel ? CGF.getJumpDestInCurrentScope("cancel.exit")
1486 HasCancel ? CGF.getJumpDestInCurrentScope("cancel.cont")
1491 void exit(CodeGenFunction &CGF) {
1493 assert(CGF.getOMPCancelDestination(Stack.back().Kind).isValid());
1494 bool HaveIP = CGF.HaveInsertPoint();
1497 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1498 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1499 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1501 CGF.EmitBlock(Stack.back().ContBlock.getBlock());
1503 CGF.Builder.CreateUnreachable();
1504 CGF.Builder.ClearInsertionPoint();
1604 FieldConstructionScope(CodeGenFunction &CGF, Address This)
1605 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1606 CGF.CXXDefaultInitExprThis = This;
1609 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1613 CodeGenFunction &CGF;
1621 CXXDefaultInitExprScope(CodeGenFunction &CGF, const CXXDefaultInitExpr *E)
1622 : CGF(CGF), OldCXXThisValue(CGF.CXXThisValue),
1623 OldCXXThisAlignment(CGF.CXXThisAlignment),
1624 SourceLocScope(E, CGF.CurSourceLocExprScope) {
1625 CGF.CXXThisValue = CGF.CXXDefaultInitExprThis.getPointer();
1626 CGF.CXXThisAlignment = CGF.CXXDefaultInitExprThis.getAlignment();
1629 CGF.CXXThisValue = OldCXXThisValue;
1630 CGF.CXXThisAlignment = OldCXXThisAlignment;
1634 CodeGenFunction &CGF;
1641 CXXDefaultArgExprScope(CodeGenFunction &CGF, const CXXDefaultArgExpr *E)
1642 : SourceLocExprScopeGuard(E, CGF.CurSourceLocExprScope) {}
1649 ArrayInitLoopExprScope(CodeGenFunction &CGF, llvm::Value *Index)
1650 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1651 CGF.ArrayInitIndex = Index;
1654 CGF.ArrayInitIndex = OldArrayInitIndex;
1658 CodeGenFunction &CGF;
1664 InlinedInheritingConstructorScope(CodeGenFunction &CGF, GlobalDecl GD)
1665 : CGF(CGF), OldCurGD(CGF.CurGD), OldCurFuncDecl(CGF.CurFuncDecl),
1666 OldCurCodeDecl(CGF.CurCodeDecl),
1667 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1668 OldCXXABIThisValue(CGF.CXXABIThisValue),
1669 OldCXXThisValue(CGF.CXXThisValue),
1670 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1671 OldCXXThisAlignment(CGF.CXXThisAlignment),
1672 OldReturnValue(CGF.ReturnValue), OldFnRetTy(CGF.FnRetTy),
1674 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1675 CGF.CurGD = GD;
1676 CGF.CurFuncDecl = CGF.CurCodeDecl =
1678 CGF.CXXABIThisDecl = nullptr;
1679 CGF.CXXABIThisValue = nullptr;
1680 CGF.CXXThisValue = nullptr;
1681 CGF.CXXABIThisAlignment = CharUnits();
1682 CGF.CXXThisAlignment = CharUnits();
1683 CGF.ReturnValue = Address::invalid();
1684 CGF.FnRetTy = QualType();
1685 CGF.CXXInheritedCtorInitExprArgs.clear();
1688 CGF.CurGD = OldCurGD;
1689 CGF.CurFuncDecl = OldCurFuncDecl;
1690 CGF.CurCodeDecl = OldCurCodeDecl;
1691 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1692 CGF.CXXABIThisValue = OldCXXABIThisValue;
1693 CGF.CXXThisValue = OldCXXThisValue;
1694 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1695 CGF.CXXThisAlignment = OldCXXThisAlignment;
1696 CGF.ReturnValue = OldReturnValue;
1697 CGF.FnRetTy = OldFnRetTy;
1698 CGF.CXXInheritedCtorInitExprArgs =
1703 CodeGenFunction &CGF;
1747 void Emit(CodeGenFunction &CGF, Flags /*flags*/) override {
1748 if (!CGF.HaveInsertPoint())
1750 CGF.Builder.Insert(RTLFnCI);
1760 static Address getAddrOfThreadPrivate(CodeGenFunction &CGF,
1765 static Address getAddressOfLocalVariable(CodeGenFunction &CGF,
1779 static void FinalizeOMPRegion(CodeGenFunction &CGF, InsertPointTy IP) {
1780 CGBuilderTy::InsertPointGuard IPG(CGF.Builder);
1790 CGF.Builder.SetInsertPoint(IPBB);
1791 CodeGenFunction::JumpDest Dest = CGF.getJumpDestInCurrentScope(DestBB);
1792 CGF.EmitBranchThroughCleanup(Dest);
1802 static void EmitOMPInlinedRegionBody(CodeGenFunction &CGF,
1808 static void EmitCaptureStmt(CodeGenFunction &CGF, InsertPointTy CodeGenIP,
1815 CGF.Builder.SetInsertPoint(CodeGenIPBB);
1818 CGF.EmitNounwindRuntimeCall(Fn, Args);
1820 CGF.EmitRuntimeCall(Fn, Args);
1822 if (CGF.Builder.saveIP().isSet())
1823 CGF.Builder.CreateBr(&FiniBB);
1834 static void EmitOMPOutlinedRegionBody(CodeGenFunction &CGF,
1845 CodeGenFunction &CGF;
1850 : CGF(cgf) {
1853 OldAllocaIP = CGF.AllocaInsertPt;
1854 CGF.AllocaInsertPt = &*AllocaIP.getPoint();
1856 OldReturnBlock = CGF.ReturnBlock;
1857 CGF.ReturnBlock = CGF.getJumpDestInCurrentScope(&RetBB);
1861 CGF.AllocaInsertPt = OldAllocaIP;
1862 CGF.ReturnBlock = OldReturnBlock;
1870 CodeGenFunction &CGF;
1875 : CGF(cgf) {
1881 CGF.AllocaInsertPt->getParent() == AllocaIP.getBlock()) &&
1884 OldAllocaIP = CGF.AllocaInsertPt;
1886 CGF.AllocaInsertPt = &*AllocaIP.getPoint();
1893 (void)CGF.getJumpDestInCurrentScope(&FiniBB);
1896 ~InlinedRegionBodyRAII() { CGF.AllocaInsertPt = OldAllocaIP; }
2035 typedef void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty);
3115 Address getObjectAddress(CodeGenFunction &CGF) const {
3118 return CGF.emitBlockByrefAddress(Addr, Variable, /*forward*/ false);
3327 CodeGenFunction &CGF;
3330 OMPCancelStackRAII(CodeGenFunction &CGF, OpenMPDirectiveKind Kind,
3332 : CGF(CGF) {
3333 CGF.OMPCancelStack.enter(CGF, Kind, HasCancel);
3335 ~OMPCancelStackRAII() { CGF.OMPCancelStack.exit(CGF); }
3500 CodeGenFunction &CGF,
3953 LValue getReferenceLValue(CodeGenFunction &CGF, Expr *refExpr) const {
3955 return CGF.MakeNaturalAlignAddrLValue(ValueAndIsReference.getPointer(),
4820 DominatingLLVMValue::save(CodeGenFunction &CGF, llvm::Value *value) {
4825 CGF.CGM.getDataLayout().getPrefTypeAlignment(value->getType()));
4827 CGF.CreateTempAlloca(value->getType(), align, "cond-cleanup.save");
4828 CGF.Builder.CreateStore(value, alloca);
4833 inline llvm::Value *DominatingLLVMValue::restore(CodeGenFunction &CGF,
4840 return CGF.Builder.CreateAlignedLoad(alloca->getAllocatedType(), alloca,