Lines Matching +full:zero +full:- +full:crossing +full:- +full:detect
1 //===-- CodeGenFunction.h - Per-Function state for LLVM CodeGen -*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This is the internal per-function state used for llvm translation.
11 //===----------------------------------------------------------------------===//
163 llvm::BasicBlock *block = cast<llvm::Instruction>(value)->getParent(); in needsSaving()
164 return (block != &block->getParent()->getEntryBlock()); in needsSaving()
254 /// CodeGenFunction - This class organizes the per-function state that is used
286 CodeGenModule &CGM; // Per-module state.
303 /// CapturedStmt generated by OMPExecutableDirective and non-perfectly nested
321 /// loop-associated directive.
337 // Codegen lambda for loop bounds in dispatch-based loop implementation
348 /// CurFuncDecl - Holds the Decl for the current outermost
349 /// non-closure context.
351 /// CurCodeDecl - This is the inner-most code context, which includes blocks.
398 /// CurGD - The GlobalDecl for the current function being compiled.
401 /// PrologueCleanupDepth - The cleanup depth enclosing all the
405 /// ReturnBlock - Unified return block.
408 /// ReturnValue - The temporary alloca to hold the return
412 /// ReturnValuePointer - The temporary alloca to hold a pointer to sret.
423 return CurLexicalScope->hasLabels();
427 /// AllocaInsertPoint - This is an instruction in the entry block before which
432 /// PostAllocaInsertPt - This is a place in the prologue where code can be
449 assert(AllocaInsertPt->getParent()->isEntryBlock() &&
451 PostAllocaInsertPt = AllocaInsertPt->clone();
452 PostAllocaInsertPt->setName("postallocapt");
453 PostAllocaInsertPt->insertAfter(AllocaInsertPt);
469 S.getCapturedRecordDecl()->field_begin();
473 if (I->capturesThis())
475 else if (I->capturesVariable())
476 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
477 else if (I->capturesVariableByCopy())
478 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
492 return CaptureFields.lookup(VD->getCanonicalDecl());
561 return FD->getNumParams();
562 return cast<ObjCMethodDecl>(CalleeDecl)->param_size();
566 return FD->getParamDecl(I);
567 return *(cast<ObjCMethodDecl>(CalleeDecl)->param_begin() + I);
592 /// Whether we processed a Microsoft-style asm block during CodeGen. These can
628 // - terminate,
629 // - make a call to a library I/O function,
630 // - perform an access through a volatile glvalue, or
631 // - perform a synchronization operation or an atomic operation.
658 // full-expr.
661 // encountering branches out of expression (through stmt-expr or coroutine
683 for (size_t I = Stack.size(); I > OldDeactivateCleanupStackSize; I--) {
684 CGF.DeactivateCleanupBlock(Stack[I - 1].Cleanup,
685 Stack[I - 1].DominatingIP);
686 Stack[I - 1].DominatingIP->eraseFromParent();
739 /// EHResumeBlock - Unified block containing a call to llvm.eh.resume.
763 /// Parent loop-based directive for scan directive.
811 /// ObjCEHValueStack - Stack of Objective-C exception values, used for
846 /// pushFullExprCleanup - Push a cleanup to be run at the end of the
847 /// current full-expression. Safe against the possibility that
848 /// we're currently inside a conditionally-evaluated expression.
865 /// Queue a cleanup to be pushed after finishing the current full-expression,
918 /// full-expression cleanup.
926 /// PushDestructorCleanup - Push a cleanup to call the
927 /// complete-object destructor of an object of the given type at the
929 /// non-trivial destructor.
932 /// PushDestructorCleanup - Push a cleanup to call the
933 /// complete-object variant of the given destructor on the object at
938 /// PopCleanupBlock - Will pop the cleanup entry on the stack and
943 /// DeactivateCleanupBlock - Deactivates the given cleanup block.
947 /// \param DominatingIP - An instruction which is known to
954 /// ActivateCleanupBlock - Activates an initially-inactive cleanup.
957 /// \param DominatingIP - An instruction which is known to
1007 /// \param ValuesToReload - A list of values that need to be available at
1040 DI->EmitLexicalBlockStart(CGF.Builder, Range.getBegin());
1052 DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd());
1099 LocalVD = LocalVD->getCanonicalDecl();
1106 SavedLocals.try_emplace(LocalVD, it->second);
1111 QualType VarTy = LocalVD->getType();
1112 if (VarTy->isReferenceType()) {
1151 I->second = Pair.second;
1195 /// Exit scope - all the mapped variables are restored.
1203 VD = VD->getCanonicalDecl();
1204 return !VD->isLocalVarDeclOrParm() && CGF.LocalDeclMap.count(VD) > 0;
1233 /// that have been added, then adds all lifetime-extended cleanups from
1243 /// target of a potentially scope-crossing jump; get a stable handle
1252 /// target of a potentially scope-crossing jump; get a stable handle
1258 /// EmitBranchThroughCleanup - Emit a branch from the current insert
1263 /// isObviouslyBranchWithoutCleanups - Return true if a branch to the
1268 /// popCatchScope - Pops the catch scope at the top of the EHScope
1278 /// An object to manage conditionally-evaluated expressions.
1305 /// isInConditionalBranch - Return true if we're currently emitting
1312 llvm::BasicBlock *block = OutermostConditional->getStartingBlock();
1314 new llvm::StoreInst(value, addr.emitRawPointer(CGF), &block->back());
1315 store->setAlignment(addr.getAlignment().getAsAlign());
1351 /// A non-RAII class containing all the information about a bound
1369 // gl-values should be bound as l-values for obvious reasons.
1370 // Records should be bound as l-values because IR generation
1372 // act exactly like l-values but are formally required to be
1373 // r-values in C.
1374 return expr->isGLValue() ||
1375 expr->getType()->isFunctionType() ||
1376 hasAggregateEvaluationKind(expr->getType());
1448 Data = OpaqueValueMappingData::bind(CGF, e->getOpaqueValue(),
1449 e->getCommon());
1457 assert(OV->getSourceExpr() && "wrong form of OpaqueValueMapping used "
1459 Data = OpaqueValueMappingData::bind(CGF, OV, OV->getSourceExpr());
1491 /// DidCallStackSave - Whether llvm.stacksave has been called. Used to avoid
1495 /// IndirectBranch - The first time an indirect goto is seen we create a block
1501 /// LocalDeclMap - This keeps track of the LLVM allocas or globals for local C
1505 // Keep track of the cleanups for callee-destructed parameters pushed to the
1510 /// SizeArguments - If a ParmVarDecl had the pass_object_size attribute, this
1520 /// LabelMap - This keeps track of the LLVM basic block for each C label.
1523 // BreakContinueStack - This keeps track of where break and continue
1534 /// Handles cancellation exit points in OpenMP-related constructs.
1536 /// Tracks cancellation exit point and join point for cancel-related exit
1630 !CurFn->hasFnAttribute(llvm::Attribute::NoProfile) &&
1631 !CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) {
1641 !CurFn->hasFnAttribute(llvm::Attribute::NoProfile));
1655 const BinaryOperator *BOp = dyn_cast<BinaryOperator>(E->IgnoreParens());
1656 return (BOp && BOp->isLogicalOp());
1659 /// Zero-init the MCDC temp value.
1702 /// SwitchInsn - This is nearest current switch instruction. It is null if
1711 /// CaseRangeBlock - This block holds if condition check for last case
1715 /// OpaqueLValues - Keeps track of the current set of opaque value
1720 // VLASizeMap - This keeps track of the associated size for each VLA type.
1738 /// The last regular (non-return) debug location (breakpoint) in the function.
1893 RLFnCI->removeFromParent();
1913 /// Gets the OpenMP-specific address of the local variable /p VD.
1916 /// Get the platform-specific name separator.
1930 assert(IP.getBlock()->end() != IP.getPoint() &&
1934 llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
1938 IPBB->getTerminator()->eraseFromParent();
1961 if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
1962 CodeGenIPBBTI->eraseFromParent();
1966 if (Fn->doesNotThrow())
2030 CGF.AllocaInsertPt->getParent() == AllocaIP.getBlock()) &&
2050 /// CXXThisDecl - When generating code for a C++ member function,
2070 /// CXXStructorImplicitParamDecl - When generating code for a constructor or
2075 /// OutermostConditional - Points to the outermost active
2087 /// BlockByrefInfos - For each __block variable, contains
2091 /// Used by -fsanitize=nullability-return to determine whether the return
2095 /// Check if -fsanitize=nullability-return instrumentation is required for
2122 /// True if we need emit the life-time markers. This is initially set in
2183 //===--------------------------------------------------------------------===//
2185 //===--------------------------------------------------------------------===//
2254 //===--------------------------------------------------------------------===//
2255 // Objective-C
2256 //===--------------------------------------------------------------------===//
2262 /// GenerateObjCGetter - Synthesize an Objective-C property getter function.
2273 /// GenerateObjCSetter - Synthesize an Objective-C property setter function
2281 //===--------------------------------------------------------------------===//
2283 //===--------------------------------------------------------------------===//
2316 /// cleanup should be a no-op if the variable hasn't left the stack
2340 /// BuildBlockByrefAddress - Computes the location of the
2392 EmitStoreThroughLValue(RValue::get(VLASizeMap[VAT->getSizeExpr()]), LV);
2402 /// FinishFunction - Complete IR generation of the current function. It is
2456 // VTableTrapMode - whether we guarantee that loading the
2464 /// GetVTablePtr - Return the Value of the vtable pointer member pointed
2487 /// EmitVTablePtrCheckForCall - Virtual method MD is being called via VTable.
2492 /// EmitVTablePtrCheck - Emit a check that VTable is a valid virtual table for
2497 /// If whole-program virtual table optimization is enabled, emit an assumption
2505 /// true when both vcall CFI and whole-program-vtables are enabled.
2514 /// EnterDtorCleanups - Enter the cleanups necessary to complete the
2520 /// ShouldInstrumentFunction - Return true if the current function should be
2524 /// ShouldSkipSanitizerInstrumentation - Return true if the current function
2528 /// ShouldXRayInstrument - Return true if the current function should be
2532 /// AlwaysEmitXRayCustomEvents - Return true if we must unconditionally emit
2536 /// AlwaysEmitXRayTypedEvents - Return true if clang must unconditionally emit
2541 /// -fsanitize=function.
2544 /// EmitFunctionProlog - Emit the target specific LLVM code to load the
2551 /// EmitFunctionEpilog - Emit the target specific LLVM code to return the
2559 /// EmitStartEHSpec - Emit the start of the exception spec.
2562 /// EmitEndEHSpec - Emit the end of the exception spec.
2565 /// getTerminateLandingPad - Return a landing pad that just calls terminate.
2568 /// getTerminateLandingPad - Return a cleanup funclet that just calls
2572 /// getTerminateHandler - Return a handler (not a landing pad, just
2585 /// LoadObjCSelf - Load the value of self. This function is only valid while
2586 /// generating code for an Objective-C method.
2589 /// TypeOfSelfObject - Return type of object that this self represents.
2592 /// getEvaluationKind - Return the TypeEvaluationKind of QualType \c T.
2603 /// createBasicBlock - Create an LLVM basic block.
2610 /// getBasicBlockForLabel - Return the LLVM basicblock that the specified
2614 /// SimplifyForwardingBlocks - If the given basic block is only a branch to
2619 /// EmitBlock - Emit the given block \arg BB and set it as the insert point,
2620 /// adding a fall-through branch from the current insert block if
2624 /// IsFinished - If true, indicates that the caller has finished emitting
2629 /// EmitBlockAfterUses - Emit the given block somewhere hopefully
2633 /// EmitBranch - Emit a branch to the specified basic block from the current
2643 /// HaveInsertPoint - True if an insertion point is defined. If not, this
2649 /// EnsureInsertPoint - Ensure that an insertion point is defined so that
2652 /// detect when no insertion point is defined and simply skip IR generation.
2658 /// ErrorUnsupported - Print out an error that codegen doesn't support the
2662 //===--------------------------------------------------------------------===//
2664 //===--------------------------------------------------------------------===//
2673 PtrPhi->addIncoming(LHS.getBasePointer(), LHSBlock);
2674 PtrPhi->addIncoming(RHS.getBasePointer(), RHSBlock);
2685 llvm::Value *Ptr, QualType T, CharUnits Alignment = CharUnits::Zero(),
2731 /// an l-value with the natural pointee alignment of T.
2791 /// CreateTempAlloca - This creates an alloca and inserts it into the entry
2827 /// CreateDefaultAlignedTempAlloca - This creates an alloca with the
2832 /// given IR type. This should only ever be used for function-local,
2833 /// IR-driven manipulations like saving and restoring a value. Do
2836 /// properly ABI-aligned value.
2840 /// CreateIRTemp - Create a temporary IR object of the given type, with
2850 /// CreateMemTemp - Create a temporary memory object of the given type, with
2859 /// CreateMemTemp - Create a temporary memory object of the given type, with
2865 /// CreateAggTemp - Create a temporary memory object for the given
2875 /// EvaluateExprAsBool - Perform the usual unary conversions on the specified
2876 /// expression and compare the result against zero, returning an Int1Ty value.
2894 /// EmitIgnoredExpr - Emit an expression in a context which ignores the result.
2897 /// EmitAnyExpr - Emit code to compute the specified expression which can have
2907 // EmitVAListRef - Emit a "reference" to a va_list; this is either the address
2916 /// EmitAnyExprToTemp - Similarly to EmitAnyExpr(), however, the result will
2920 /// EmitAnyExprToMem - Emits the code necessary to evaluate an
2927 /// EmitExprAsInit - Emits the code necessary to initialize a
2932 /// hasVolatileMember - returns true if aggregate type has a volatile
2935 if (const RecordType *RT = T->getAs<RecordType>()) {
2936 const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
2937 return RD->hasVolatileMember();
2970 /// EmitAggregateCopy - Emit an aggregate copy.
2981 /// GetAddrOfLocalVar - Return the address of a local variable.
2986 return it->second;
3000 /// getAccessedFieldNo - Given an encoded value and a result number, return
3007 /// Check if \p E is a C++ "this" pointer wrapped in value-preserving casts.
3010 /// EmitNullInitialization - Generate code to set a value of the given type to
3012 /// to -1 in accordance with the Itanium C++ ABI.
3015 /// Emits a call to an LLVM variable-argument intrinsic, either
3034 /// emitArrayLength - Compute the length of an array, even if it's a
3040 /// EmitVLASize - Capture all the sizes for the VLA expressions in
3041 /// the given variably-modified type and store them in the VLASizeMap.
3059 /// in non-variably-sized elements, of a variable length array type,
3060 /// plus that largest non-variably-sized element type. Assumes that
3065 /// LoadCXXThis - Load the value of 'this'. This function is only valid while
3073 /// LoadCXXVTT - Load the VTT parameter to base constructors/destructors have
3082 /// GetAddressOfBaseOfCompleteClass - Convert the given pointer to a
3092 /// GetAddressOfBaseClass - This function will add the necessary delta to the
3106 /// GetVTTParameter - Return the VTT parameter that should be passed to a
3108 /// FIXME: VTTs are Itanium ABI-specific, so the definition should move
3153 /// most-derived class and not under construction of the object.
3215 /// compiler-rt.
3225 /// Checking the object expression in a non-static data member access. Must
3228 /// Checking the 'this' pointer for a call to a non-static member function.
3258 /// Whether any type-checking sanitizers are enabled. If \c false,
3272 QualType Type, CharUnits Alignment = CharUnits::Zero(),
3285 QualType Type, CharUnits Alignment = CharUnits::Zero(),
3299 // embedded inside multiple sub-structs, but must still be the last field.
3326 //===--------------------------------------------------------------------===//
3328 //===--------------------------------------------------------------------===//
3330 /// EmitDecl - Emit a declaration.
3335 /// EmitVarDecl - Emit a local variable declaration.
3350 /// EmitAutoVarDecl - Emit an auto variable declaration.
3376 /// Non-null if we should use lifetime annotations.
3432 /// dimension of an array. It registers the association of its (1-dimensional)
3482 /// EmitParmDecl - Emit a ParmVarDecl or an ImplicitParamDecl.
3485 /// protectFromPeepholes - Protect a value that we're intending to
3493 /// l-values, it's just that no existing peepholes work on pointers.
3515 //===--------------------------------------------------------------------===//
3517 //===--------------------------------------------------------------------===//
3519 /// EmitStopPoint - Emit a debug stoppoint if we are emitting debug info.
3522 /// EmitStmt - Emit the code for the statement \arg S. It is legal to call
3530 /// EmitSimpleStmt - Try to emit a "simple" statement which does not
3545 /// EmitLabel - Emit the block for the given label. It is legal to call this
3617 /// Emit simple code for OpenMP directives in Simd-only mode.
3975 /// \param PostIncGen Genrator for post-increment code (required for ordered
3984 /// Emit initial code for loop counters of loop-based directives.
3991 /// Emit code for the worksharing loop-based directive.
3992 /// \return true, if this construct has any lastprivate clause, false -
3998 /// Emit code for the distribute loop-based directive.
4015 /// struct with the values to be passed to the OpenMP loop-related functions
4070 //===--------------------------------------------------------------------===//
4072 //===--------------------------------------------------------------------===//
4074 // TODO OpenACC: Implement this. It is currently implemented as a 'no-op',
4081 // TODO OpenACC: Implement this. It is currently implemented as a 'no-op',
4087 //===--------------------------------------------------------------------===//
4089 //===--------------------------------------------------------------------===//
4091 /// Create a check that a scalar RValue is non-null.
4094 /// GetUndefRValue - Get an appropriate 'undef' rvalue for the given type.
4097 /// EmitUnsupportedRValue - Emit a dummy r-value using the type of E
4103 /// EmitUnsupportedLValue - Emit a dummy l-value using the type of E and issue
4108 /// EmitLValue - Emit code to compute a designator that specifies the location
4167 /// EmitToMemory - Change a scalar value from its value
4168 /// representation to its in-memory representation.
4171 /// EmitFromMemory - Change a scalar value from its memory
4182 /// EmitLoadOfScalar - Load a scalar value from an address, taking
4198 /// EmitLoadOfScalar - Load a scalar value from an address, taking
4200 /// the LLVM value representation. The l-value must be a simple
4201 /// l-value.
4204 /// EmitStoreOfScalar - Store a scalar value to an address, taking
4220 /// EmitStoreOfScalar - Store a scalar value to an address, taking
4222 /// the LLVM value representation. The l-value must be a simple
4223 /// l-value. The isInit flag indicates whether this is an initialization.
4224 /// If so, atomic qualifiers are ignored and the store is always non-atomic.
4227 /// EmitLoadOfLValue - Given an expression that represents a value lvalue,
4240 /// EmitStoreThroughLValue - Store the specified rvalue into the specified
4247 /// EmitStoreThroughBitfieldLValue - Store Src into Dst with same constraints
4250 /// \param Result [out] - If non-null, this will be set to a Value* for the
4251 /// bit-field contents after the store, appropriate for use as the result of
4252 /// an assignment to the bit-field.
4256 /// Emit an l-value for an assignment (simple or compound) of complex type.
4319 refExpr->getType());
4345 /// EmitLValueForFieldInitialization - Like EmitLValueForField, except that
4367 //===--------------------------------------------------------------------===//
4369 //===--------------------------------------------------------------------===//
4371 /// EmitCall - Generate a call of the given function, expecting the given
4484 // These functions emit calls to the special functions of non-trivial C
4553 /// EmitTargetBuiltinExpr - Emit the given builtin call. Returns 0 if the call
4601 /// SVEBuiltinMemEltTy - Returns the memory element type for this memory
4654 /// FormSVEBuiltinResult - Returns the struct of scalable vectors as a wider
4723 /// Except under -fobjc-arc-eh, ARC cleanups are normal-only.
4804 //===--------------------------------------------------------------------===//
4806 //===--------------------------------------------------------------------===//
4810 /// EmitScalarExpr - Emit the computation of the specified expression of LLVM
4825 /// EmitAggExpr - Emit the computation of the specified expression
4830 /// EmitAggExprToLValue - Emit the computation of the specified expression of
4836 /// EmitAggFinalDestCopy - Emit copy of the specified aggregate into
4846 /// EmitExtendGCLifetime - Given a pointer to an Objective-C object,
4850 /// EmitComplexExpr - Emit the computation of the specified expression of
4856 /// EmitComplexExprIntoLValue - Emit the given expression of complex
4857 /// type and place its result into the specified l-value.
4860 /// EmitStoreOfComplex - Store a complex number into the specified l-value.
4863 /// EmitLoadOfComplex - Load a complex number from the specified l-value.
4874 /// AddInitializerToStaticVarDecl - Add the initializer for 'D' to the
4885 /// EmitCXXGlobalVarDeclInit - Create the initializer for a C++
4930 /// GenerateCXXGlobalInitFunc - Generates code for initializing global
4937 /// GenerateCXXGlobalCleanUpFunc - Generates code for cleaning up global
4958 //===--------------------------------------------------------------------===//
4960 //===--------------------------------------------------------------------===//
4976 //===--------------------------------------------------------------------===//
4978 //===--------------------------------------------------------------------===//
4980 /// ContainsLabel - Return true if the statement contains a label in it. If
4985 /// containsBreak - Return true if the statement contains a break out of it.
4991 /// current scope, by being a (possibly-labelled) DeclStmt.
4994 /// ConstantFoldsToSimpleInteger - If the specified expression does not fold
5000 /// ConstantFoldsToSimpleInteger - If the specified expression does not fold
5006 /// Ignore parentheses and logical-NOT to track conditions consistently.
5009 /// isInstrumentedCondition - Determine whether the given condition is an
5013 /// EmitBranchToCounterBlock - Emit a conditional branch to a new block that
5024 /// EmitBranchOnBoolExpr - Emit a branch on a boolean condition (e.g. for an
5043 /// detect undefined behavior when the pointer overflow sanitizer is enabled.
5092 /// Emit a slow path cross-DSO CFI check which calls __cfi_slowpath
5098 /// Emit a reached-unreachable diagnostic if \p Loc is valid and runtime
5103 /// conditional branch to it, for the -ftrapv checks.
5107 /// "trap-func-name" if specified.
5110 /// Emit a stub for the cross-DSO CFI check function.
5113 /// Emit a cross-DSO CFI failure handling function.
5117 /// declared as non-null.
5125 /// EmitCallArg - Emit a single call argument.
5128 /// EmitDelegateCallArg - We are performing a delegate call; that
5130 /// a r-value suitable for passing the given parameter.
5134 /// SetFPAccuracy - Set the minimum required accuracy of the given floating
5146 /// Set the codegen fast-math flags.
5192 /// ExpandTypeFromArgs - Reconstruct a structure of type \arg Ty
5195 /// \param AI - The first function argument of the expansion.
5199 /// ExpandTypeToArgs - Expand an CallArg \arg Arg, with the LLVM type for \arg
5219 /// If EmittedExpr is non-null, this will use that instead of re-emitting E.
5243 ///! Language semantics require left-to-right evaluation.
5245 ///! Language semantics require right-to-left evaluation.
5264 /// EmitPointerWithAlignment - Given an expression with a pointer type,
5268 /// \param BaseInfo - If non-null, this will be initialized with
5269 /// information about the source of the alignment and the may-alias
5271 /// the type when it doesn't recognize the expression and may-alias will
5276 /// we're simply trying to ensure that sufficiently obvious uses of under-
5351 CGF.CGM.getDataLayout().getPrefTypeAlign(value->getType()));
5353 CGF.CreateTempAlloca(value->getType(), align, "cond-cleanup.save");
5366 return CGF.Builder.CreateAlignedLoad(alloca->getAllocatedType(), alloca,
5367 alloca->getAlign());