31#include "llvm/ADT/ArrayRef.h"
32#include "llvm/ADT/DenseMap.h"
33#include "llvm/ADT/SmallSet.h"
34#include "llvm/ADT/StringExtras.h"
35#include "llvm/IR/Assumptions.h"
36#include "llvm/IR/DataLayout.h"
37#include "llvm/IR/InlineAsm.h"
38#include "llvm/IR/Intrinsics.h"
39#include "llvm/IR/MDBuilder.h"
40#include "llvm/Support/SaveAndRestore.h"
61 assert(S &&
"Null statement?");
62 PGO->setCurrentStmt(S);
79 PGO->markStmtMaybeUsed(S);
93 if (
const auto *D = dyn_cast<OMPExecutableDirective>(S)) {
101 case Stmt::CXXCatchStmtClass:
102 case Stmt::SEHExceptStmtClass:
103 case Stmt::SEHFinallyStmtClass:
104 case Stmt::MSDependentExistsStmtClass:
105 case Stmt::UnresolvedSYCLKernelCallStmtClass:
106 llvm_unreachable(
"invalid statement class to emit generically");
107 case Stmt::NullStmtClass:
108 case Stmt::CompoundStmtClass:
109 case Stmt::DeclStmtClass:
110 case Stmt::LabelStmtClass:
111 case Stmt::AttributedStmtClass:
112 case Stmt::GotoStmtClass:
113 case Stmt::BreakStmtClass:
114 case Stmt::ContinueStmtClass:
115 case Stmt::DefaultStmtClass:
116 case Stmt::CaseStmtClass:
117 case Stmt::DeferStmtClass:
118 case Stmt::SEHLeaveStmtClass:
119 case Stmt::SYCLKernelCallStmtClass:
120 llvm_unreachable(
"should have emitted these statements as simple");
122#define STMT(Type, Base)
123#define ABSTRACT_STMT(Op)
124#define EXPR(Type, Base) \
125 case Stmt::Type##Class:
126#include "clang/AST/StmtNodes.inc"
129 llvm::BasicBlock *incoming =
Builder.GetInsertBlock();
130 assert(incoming &&
"expression emission must have an insertion point");
134 llvm::BasicBlock *outgoing =
Builder.GetInsertBlock();
135 assert(outgoing &&
"expression emission cleared block!");
149 if (incoming != outgoing && outgoing->use_empty()) {
150 outgoing->eraseFromParent();
156 case Stmt::IndirectGotoStmtClass:
167 case Stmt::GCCAsmStmtClass:
169 case Stmt::CoroutineBodyStmtClass:
172 case Stmt::CoreturnStmtClass:
175 case Stmt::CapturedStmtClass: {
180 case Stmt::ObjCAtTryStmtClass:
183 case Stmt::ObjCAtCatchStmtClass:
185 "@catch statements should be handled by EmitObjCAtTryStmt");
186 case Stmt::ObjCAtFinallyStmtClass:
188 "@finally statements should be handled by EmitObjCAtTryStmt");
189 case Stmt::ObjCAtThrowStmtClass:
192 case Stmt::ObjCAtSynchronizedStmtClass:
195 case Stmt::ObjCForCollectionStmtClass:
198 case Stmt::ObjCAutoreleasePoolStmtClass:
202 case Stmt::CXXTryStmtClass:
205 case Stmt::CXXForRangeStmtClass:
208 case Stmt::CXXExpansionStmtPatternClass:
209 llvm_unreachable(
"unexpanded expansion statements should not be emitted");
210 case Stmt::CXXExpansionStmtInstantiationClass:
213 case Stmt::SEHTryStmtClass:
216 case Stmt::OMPMetaDirectiveClass:
219 case Stmt::OMPCanonicalLoopClass:
222 case Stmt::OMPParallelDirectiveClass:
225 case Stmt::OMPSimdDirectiveClass:
228 case Stmt::OMPTileDirectiveClass:
231 case Stmt::OMPStripeDirectiveClass:
234 case Stmt::OMPUnrollDirectiveClass:
237 case Stmt::OMPReverseDirectiveClass:
240 case Stmt::OMPSplitDirectiveClass:
243 case Stmt::OMPInterchangeDirectiveClass:
246 case Stmt::OMPFlattenDirectiveClass:
249 case Stmt::OMPFuseDirectiveClass:
252 case Stmt::OMPForDirectiveClass:
255 case Stmt::OMPForSimdDirectiveClass:
258 case Stmt::OMPSectionsDirectiveClass:
261 case Stmt::OMPSectionDirectiveClass:
264 case Stmt::OMPSingleDirectiveClass:
267 case Stmt::OMPMasterDirectiveClass:
270 case Stmt::OMPCriticalDirectiveClass:
273 case Stmt::OMPParallelForDirectiveClass:
276 case Stmt::OMPParallelForSimdDirectiveClass:
279 case Stmt::OMPParallelMasterDirectiveClass:
282 case Stmt::OMPParallelSectionsDirectiveClass:
285 case Stmt::OMPTaskDirectiveClass:
288 case Stmt::OMPTaskyieldDirectiveClass:
291 case Stmt::OMPErrorDirectiveClass:
294 case Stmt::OMPBarrierDirectiveClass:
297 case Stmt::OMPTaskwaitDirectiveClass:
300 case Stmt::OMPTaskgroupDirectiveClass:
303 case Stmt::OMPFlushDirectiveClass:
306 case Stmt::OMPDepobjDirectiveClass:
309 case Stmt::OMPScanDirectiveClass:
312 case Stmt::OMPOrderedStandaloneDirectiveClass:
315 case Stmt::OMPOrderedBlockAssocDirectiveClass:
318 case Stmt::OMPAtomicDirectiveClass:
321 case Stmt::OMPTargetDirectiveClass:
324 case Stmt::OMPTeamsDirectiveClass:
327 case Stmt::OMPCancellationPointDirectiveClass:
330 case Stmt::OMPCancelDirectiveClass:
333 case Stmt::OMPTargetDataDirectiveClass:
336 case Stmt::OMPTargetEnterDataDirectiveClass:
339 case Stmt::OMPTargetExitDataDirectiveClass:
342 case Stmt::OMPTargetParallelDirectiveClass:
345 case Stmt::OMPTargetParallelForDirectiveClass:
348 case Stmt::OMPTaskLoopDirectiveClass:
351 case Stmt::OMPTaskLoopSimdDirectiveClass:
354 case Stmt::OMPMasterTaskLoopDirectiveClass:
357 case Stmt::OMPMaskedTaskLoopDirectiveClass:
360 case Stmt::OMPMasterTaskLoopSimdDirectiveClass:
364 case Stmt::OMPMaskedTaskLoopSimdDirectiveClass:
368 case Stmt::OMPParallelMasterTaskLoopDirectiveClass:
372 case Stmt::OMPParallelMaskedTaskLoopDirectiveClass:
376 case Stmt::OMPParallelMasterTaskLoopSimdDirectiveClass:
380 case Stmt::OMPParallelMaskedTaskLoopSimdDirectiveClass:
384 case Stmt::OMPDistributeDirectiveClass:
387 case Stmt::OMPTargetUpdateDirectiveClass:
390 case Stmt::OMPDistributeParallelForDirectiveClass:
394 case Stmt::OMPDistributeParallelForSimdDirectiveClass:
398 case Stmt::OMPDistributeSimdDirectiveClass:
401 case Stmt::OMPTargetParallelForSimdDirectiveClass:
405 case Stmt::OMPTargetSimdDirectiveClass:
408 case Stmt::OMPTeamsDistributeDirectiveClass:
411 case Stmt::OMPTeamsDistributeSimdDirectiveClass:
415 case Stmt::OMPTeamsDistributeParallelForSimdDirectiveClass:
419 case Stmt::OMPTeamsDistributeParallelForDirectiveClass:
423 case Stmt::OMPTargetTeamsDirectiveClass:
426 case Stmt::OMPTargetTeamsDistributeDirectiveClass:
430 case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass:
434 case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
438 case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass:
442 case Stmt::OMPInteropDirectiveClass:
445 case Stmt::OMPDispatchDirectiveClass:
446 CGM.ErrorUnsupported(S,
"OpenMP dispatch directive");
448 case Stmt::OMPScopeDirectiveClass:
451 case Stmt::OMPMaskedDirectiveClass:
454 case Stmt::OMPGenericLoopDirectiveClass:
457 case Stmt::OMPTeamsGenericLoopDirectiveClass:
460 case Stmt::OMPTargetTeamsGenericLoopDirectiveClass:
464 case Stmt::OMPParallelGenericLoopDirectiveClass:
468 case Stmt::OMPTargetParallelGenericLoopDirectiveClass:
472 case Stmt::OMPTargetGenericLoopDirectiveClass:
475 case Stmt::OMPParallelMaskedDirectiveClass:
478 case Stmt::OMPAssumeDirectiveClass:
481 case Stmt::OpenACCComputeConstructClass:
484 case Stmt::OpenACCLoopConstructClass:
487 case Stmt::OpenACCCombinedConstructClass:
490 case Stmt::OpenACCDataConstructClass:
493 case Stmt::OpenACCEnterDataConstructClass:
496 case Stmt::OpenACCExitDataConstructClass:
499 case Stmt::OpenACCHostDataConstructClass:
502 case Stmt::OpenACCWaitConstructClass:
505 case Stmt::OpenACCInitConstructClass:
508 case Stmt::OpenACCShutdownConstructClass:
511 case Stmt::OpenACCSetConstructClass:
514 case Stmt::OpenACCUpdateConstructClass:
517 case Stmt::OpenACCAtomicConstructClass:
520 case Stmt::OpenACCCacheConstructClass:
531 case Stmt::NullStmtClass:
533 case Stmt::CompoundStmtClass:
536 case Stmt::DeclStmtClass:
539 case Stmt::LabelStmtClass:
542 case Stmt::AttributedStmtClass:
545 case Stmt::GotoStmtClass:
548 case Stmt::BreakStmtClass:
551 case Stmt::ContinueStmtClass:
554 case Stmt::DefaultStmtClass:
557 case Stmt::CaseStmtClass:
560 case Stmt::DeferStmtClass:
563 case Stmt::SEHLeaveStmtClass:
566 case Stmt::SYCLKernelCallStmtClass:
579 "LLVM IR generation of compound statement ('{}')");
606 if (
const auto *LS = dyn_cast<LabelStmt>(LastStmt)) {
608 LastStmt = LS->getSubStmt();
609 }
else if (
const auto *AS = dyn_cast<AttributedStmt>(LastStmt)) {
612 LastStmt = AS->getSubStmt();
614 llvm_unreachable(
"unknown value statement");
638 llvm::UncondBrInst *BI = dyn_cast<llvm::UncondBrInst>(BB->getTerminator());
651 if (BI->getIterator() != BB->begin())
654 BB->replaceAllUsesWith(BI->getSuccessor());
655 BI->eraseFromParent();
656 BB->eraseFromParent();
660 llvm::BasicBlock *CurBB =
Builder.GetInsertBlock();
665 if (IsFinished && BB->use_empty()) {
672 if (CurBB && CurBB->getParent())
673 CurFn->insert(std::next(CurBB->getIterator()), BB);
683 llvm::BasicBlock *CurBB =
Builder.GetInsertBlock();
685 if (!CurBB || CurBB->hasTerminator()) {
697 bool inserted =
false;
698 for (llvm::User *u : block->users()) {
699 if (llvm::Instruction *insn = dyn_cast<llvm::Instruction>(u)) {
700 CurFn->insert(std::next(insn->getParent()->getIterator()), block);
715 if (Dest.
isValid())
return Dest;
728 if (
EHStack.hasNormalCleanups() && CurLexicalScope)
729 CurLexicalScope->addLabel(D);
750 if (
CGM.getCodeGenOpts().hasReducedDebugInfo()) {
762 assert(!Labels.empty());
764 =
CGF.EHStack.getInnermostNormalCleanup();
768 assert(
CGF.LabelMap.count(Label));
777 ParentScope->Labels.append(Labels.begin(), Labels.end());
800 const AtomicAttr *AA =
nullptr;
802 for (
const auto *A : S.
getAttrs()) {
803 switch (A->getKind()) {
811 alwaysinline =
false;
813 case attr::AlwaysInline:
817 case attr::NoConvergent:
820 case attr::MustTail: {
825 case attr::CXXAssume: {
830 Builder.CreateAssumption(AssumptionVal);
836 case attr::AMDGPUAvailableVisible:
839 case attr::HLSLControlFlowHint: {
845 assert(!(alwaysinline && noinline) &&
846 "alwaysinline and noinline are mutually exclusive");
891 llvm::BasicBlock *CurBB =
Builder.GetInsertBlock();
901 if (CurBB && CurBB->hasTerminator())
942 const Stmt *Skipped = Else;
944 std::swap(Executed, Skipped);
956 PGO->markStmtMaybeUsed(Skipped);
967 llvm::BasicBlock *ElseBlock =
983 CGM.getCodeGenOpts().OptimizationLevel)
992 if (!
CGM.getCodeGenOpts().MCDCCoverage) {
999 Builder.CreateCondBr(BoolCondVal, ThenBlock, ElseBlock);
1030 }
else if (HasSkip) {
1041 bool HasEmptyBody) {
1045 [
this] {
CurFn->removeFnAttr(llvm::Attribute::MustProgress); });
1055 if (
CGM.shouldEmitConvergenceTokens())
1064 BreakContinueStack.push_back(BreakContinue(S,
LoopExit, LoopHeader));
1087 llvm::ConstantInt *
C = dyn_cast<llvm::ConstantInt>(BoolCondVal);
1088 bool EmitBoolCondBranch = !
C || !
C->isOne();
1091 LoopHeader.
getBlock(),
CGM.getContext(),
CGM.getCodeGenOpts(), WhileAttrs,
1097 if (EmitBoolCondBranch) {
1098 llvm::BasicBlock *ExitBlock =
LoopExit.getBlock();
1101 llvm::MDNode *Weights =
1103 if (!Weights &&
CGM.getCodeGenOpts().OptimizationLevel)
1104 BoolCondVal = emitCondLikelihoodViaExpectIntrinsic(
1106 auto *I =
Builder.CreateCondBr(BoolCondVal, LoopBody, ExitBlock, Weights);
1112 if (
auto *CondI = dyn_cast<llvm::Instruction>(BoolCondVal))
1116 if (ExitBlock !=
LoopExit.getBlock()) {
1122 CGM.getDiags().Report(A->getLocation(),
1123 diag::warn_attribute_has_no_effect_on_infinite_loop)
1124 << A << A->getRange();
1125 CGM.getDiags().Report(
1127 diag::note_attribute_has_no_effect_on_infinite_loop_here)
1140 BreakContinueStack.pop_back();
1156 if (!EmitBoolCondBranch) {
1158 PGO->markStmtAsUsed(
true, &S);
1161 if (
CGM.shouldEmitConvergenceTokens())
1173 BreakContinueStack.push_back(BreakContinue(S,
LoopExit, LoopCond));
1180 if (
CGM.shouldEmitConvergenceTokens())
1198 BreakContinueStack.pop_back();
1202 llvm::ConstantInt *
C = dyn_cast<llvm::ConstantInt>(BoolCondVal);
1203 bool EmitBoolCondBranch = !
C || !
C->isZero();
1207 LoopBody,
CGM.getContext(),
CGM.getCodeGenOpts(), DoAttrs,
1215 if (EmitBoolCondBranch) {
1217 auto *I =
Builder.CreateCondBr(
1218 BoolCondVal, LoopBody, LoopFalse,
1219 createProfileWeightsForLoop(S.
getCond(), BackedgeCount));
1226 if (
auto *CondI = dyn_cast<llvm::Instruction>(BoolCondVal))
1233 if (LoopFalse !=
LoopExit.getBlock()) {
1243 if (!EmitBoolCondBranch)
1246 if (
CGM.shouldEmitConvergenceTokens())
1252 std::optional<LexicalScope> ForScope;
1273 llvm::BasicBlock *CondBlock = CondDest.
getBlock();
1276 if (
CGM.shouldEmitConvergenceTokens())
1281 CondBlock,
CGM.getContext(),
CGM.getCodeGenOpts(), ForAttrs,
1297 Continue = CondDest;
1300 BreakContinueStack.push_back(BreakContinue(S,
LoopExit, Continue));
1311 BreakContinueStack.back().ContinueBlock = Continue;
1314 llvm::BasicBlock *ExitBlock =
LoopExit.getBlock();
1317 if (
hasSkipCounter(&S) || (ForScope && ForScope->requiresCleanups()))
1329 llvm::MDNode *Weights =
1331 if (!Weights &&
CGM.getCodeGenOpts().OptimizationLevel)
1332 BoolCondVal = emitCondLikelihoodViaExpectIntrinsic(
1335 auto *I =
Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights);
1340 if (
auto *CondI = dyn_cast<llvm::Instruction>(BoolCondVal))
1344 if (ExitBlock !=
LoopExit.getBlock()) {
1354 PGO->markStmtAsUsed(
true, &S);
1368 auto *FinalBodyBB =
Builder.GetInsertBlock();
1376 BreakContinueStack.pop_back();
1384 ForScope->ForceCleanup();
1391 if (
CGM.shouldEmitConvergenceTokens())
1421 if (
CGM.shouldEmitConvergenceTokens())
1425 LoopStack.push(CondBlock,
CGM.getContext(),
CGM.getCodeGenOpts(), ForAttrs,
1431 llvm::BasicBlock *ExitBlock =
LoopExit.getBlock();
1441 llvm::MDNode *Weights =
1443 if (!Weights &&
CGM.getCodeGenOpts().OptimizationLevel)
1444 BoolCondVal = emitCondLikelihoodViaExpectIntrinsic(
1446 auto *I =
Builder.CreateCondBr(BoolCondVal, ForBody, ExitBlock, Weights);
1451 if (
auto *CondI = dyn_cast<llvm::Instruction>(BoolCondVal))
1455 if (ExitBlock !=
LoopExit.getBlock()) {
1468 BreakContinueStack.push_back(BreakContinue(S,
LoopExit, Continue));
1478 auto *FinalBodyBB =
Builder.GetInsertBlock();
1485 BreakContinueStack.pop_back();
1496 if (
CGM.shouldEmitConvergenceTokens())
1520 ContinueDest = ExpandExit;
1524 LexicalScope ExpansionScope(*
this, Inst->getSourceRange());
1525 BreakContinueStack.push_back(BreakContinue(S, ExpandExit, ContinueDest));
1527 BreakContinueStack.pop_back();
1532void CodeGenFunction::EmitReturnOfRValue(
RValue RV,
QualType Ty) {
1548struct SaveRetExprRAII {
1549 SaveRetExprRAII(
const Expr *RetExpr, CodeGenFunction &CGF)
1550 : OldRetExpr(CGF.RetExpr), CGF(CGF) {
1553 ~SaveRetExprRAII() { CGF.RetExpr = OldRetExpr; }
1554 const Expr *OldRetExpr;
1555 CodeGenFunction &CGF;
1563 if (calleeQualType->isFunctionPointerType() ||
1564 calleeQualType->isFunctionReferenceType() ||
1565 calleeQualType->isBlockPointerType() ||
1566 calleeQualType->isMemberFunctionPointerType()) {
1568 }
else if (
auto *ty = dyn_cast<FunctionType>(calleeQualType)) {
1570 }
else if (
auto CMCE = dyn_cast<CXXMemberCallExpr>(CE)) {
1571 if (
auto methodDecl = CMCE->getMethodDecl()) {
1588 if (requiresReturnValueCheck()) {
1591 new llvm::GlobalVariable(
CGM.getModule(), SLoc->getType(),
false,
1592 llvm::GlobalVariable::PrivateLinkage, SLoc);
1593 SLocPtr->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
1594 CGM.getSanitizerMetadata()->disableSanitizerForGlobal(SLocPtr);
1595 assert(ReturnLocation.isValid() &&
"No valid return location");
1596 Builder.CreateStore(SLocPtr, ReturnLocation);
1602 Builder.ClearInsertionPoint();
1616 SaveRetExprRAII SaveRetExpr(RV, *
this);
1619 if (
const auto *EWC = dyn_cast_or_null<ExprWithCleanups>(RV))
1620 RV = EWC->getSubExpr();
1624 std::optional<llvm::SaveAndRestore<const CallExpr *>> SaveMustTail;
1627 if (
auto CE = dyn_cast<CallExpr>(RV)) {
1640 !
CGM.getOpenMPRuntime()
1659 }
else if (
FnRetTy->isReferenceType()) {
1695 ++NumSimpleReturnExprs;
1707 for (
const auto *I : S.
decls())
1712 ->
const BreakContinue * {
1714 return &BreakContinueStack.back();
1716 const Stmt *LoopOrSwitch = S.getNamedLoopOrSwitch();
1717 assert(LoopOrSwitch &&
"break/continue target label not available?");
1718 for (
const BreakContinue &BC : llvm::reverse(BreakContinueStack))
1719 if (BC.LoopOrSwitch == LoopOrSwitch)
1722 llvm_unreachable(
"break/continue target not found");
1726 assert(!BreakContinueStack.empty() &&
"break stmt not in a loop or switch!");
1739 assert(!BreakContinueStack.empty() &&
"continue stmt not in a loop!");
1758 if (
const auto *POE = dyn_cast<PseudoObjectExpr>(S))
1759 if (
const auto *DRE = dyn_cast<DeclRefExpr>(POE->getSyntacticForm());
1762 if (
const auto *
Call = dyn_cast<CallExpr>(S);
1763 Call &&
Call->getBuiltinCallee() == BPF::BI__builtin_preserve_enum_value)
1777 while (
const auto *ICE = dyn_cast<ImplicitCastExpr>(E))
1778 E = ICE->getSubExpr();
1779 const auto *CE = dyn_cast<ConstantExpr>(E);
1782 return CE->getSubExpr();
1807 llvm::BasicBlock *CheckBB = SwitchInsn->getParent();
1809 CurFn->insert(std::next(CheckBB->getIterator()), SwitchBB);
1810 SwitchInsn->removeFromParent();
1811 SwitchInsn->insertInto(SwitchBB, SwitchBB->end());
1815 llvm::IRBuilderBase::InsertPointGuard IPG(
Builder);
1816 Builder.SetInsertPoint(CheckBB);
1818 llvm::Value *CondV = SwitchInsn->getCondition();
1819 auto EmitCaseValue = [&](
const Expr *E) -> llvm::Value * {
1823 Reloc->getType()->isSignedIntegerOrEnumerationType());
1829 Cond =
Builder.CreateICmpEQ(CondV, EmitCaseValue(S.
getLHS()));
1833 llvm::Value *Lo =
Builder.CreateICmp(IsSigned ? llvm::CmpInst::ICMP_SGE
1834 : llvm::CmpInst::ICMP_UGE,
1835 CondV, EmitCaseValue(S.
getLHS()));
1836 llvm::Value *Hi =
Builder.CreateICmp(IsSigned ? llvm::CmpInst::ICMP_SLE
1837 : llvm::CmpInst::ICMP_ULE,
1838 CondV, EmitCaseValue(S.
getRHS()));
1839 Cond =
Builder.CreateAnd(Lo, Hi);
1841 if (SwitchLikelihood)
1842 Cond = emitCondLikelihoodViaExpectIntrinsic(Cond,
1844 Builder.CreateCondBr(Cond, CaseDest, SwitchBB);
1855 assert(S.
getRHS() &&
"Expected RHS value in CaseStmt");
1868 if (LHS.isSigned() ? RHS.slt(LHS) : RHS.ult(LHS))
1872 llvm::APInt Range = RHS - LHS;
1874 if (Range.getBitWidth() < 7 ||
1875 Range.ult(llvm::APInt(Range.getBitWidth(), 64))) {
1878 unsigned NCases = Range.getZExtValue() + 1;
1883 uint64_t Weight = Total / NCases, Rem = Total % NCases;
1884 for (
unsigned I = 0; I != NCases; ++I) {
1886 SwitchWeights->push_back(Weight + (Rem ? 1 : 0));
1887 else if (SwitchLikelihood)
1888 SwitchLikelihood->push_back(LH);
1892 SwitchInsn->addCase(
Builder.getInt(LHS), CaseDest);
1900 llvm::BasicBlock *RestoreBB =
Builder.GetInsertBlock();
1905 llvm::BasicBlock *FalseDest = CaseRangeBlock;
1909 Builder.SetInsertPoint(CaseRangeBlock);
1913 Builder.CreateSub(SwitchInsn->getCondition(),
Builder.getInt(LHS));
1917 llvm::MDNode *Weights =
nullptr;
1918 if (SwitchWeights) {
1920 uint64_t DefaultCount = (*SwitchWeights)[0];
1921 Weights = createProfileWeights(ThisCount, DefaultCount);
1926 (*SwitchWeights)[0] += ThisCount;
1927 }
else if (SwitchLikelihood)
1928 Cond = emitCondLikelihoodViaExpectIntrinsic(Cond, LH);
1930 Builder.CreateCondBr(Cond, CaseDest, FalseDest, Weights);
1934 Builder.SetInsertPoint(RestoreBB);
1936 Builder.ClearInsertionPoint();
1962 llvm::ConstantInt *CaseVal =
1969 if (
const auto *DRE = dyn_cast<DeclRefExpr>(SubExpr))
1971 if (
CGM.getCodeGenOpts().hasReducedDebugInfo())
1972 Dbg->EmitGlobalVariable(DRE->getDecl(),
1973 APValue(llvm::APSInt(CaseVal->getValue())));
1975 if (SwitchLikelihood)
1981 if (!
CGM.getCodeGenOpts().hasProfileClangInstr() &&
1982 CGM.getCodeGenOpts().OptimizationLevel > 0 &&
1990 SwitchInsn->addCase(CaseVal,
Block.getBlock());
1994 if (
Builder.GetInsertBlock()) {
1996 Builder.ClearInsertionPoint();
2006 SwitchInsn->addCase(CaseVal, CaseDest);
2025 while (NextCase && NextCase->
getRHS() ==
nullptr &&
2028 llvm::ConstantInt *CaseVal =
2033 if (
CGM.getCodeGenOpts().hasProfileClangInstr()) {
2039 if (SwitchLikelihood)
2042 SwitchInsn->addCase(CaseVal, CaseDest);
2043 NextCase = dyn_cast<CaseStmt>(CurCase->
getSubStmt());
2066 llvm::BasicBlock *DefaultBlock = SwitchInsn->getDefaultDest();
2067 assert(DefaultBlock->empty() &&
2068 "EmitDefaultStmt: Default block already defined?");
2070 if (SwitchLikelihood)
2079struct EmitDeferredStatement final : EHScopeStack::Cleanup {
2139 llvm::Value *SavedCleanupDest =
nullptr;
2193 if (
const SwitchCase *SC = dyn_cast<SwitchCase>(S)) {
2212 if (
const CompoundStmt *CS = dyn_cast<CompoundStmt>(S)) {
2216 bool StartedInLiveCode = FoundCase;
2217 unsigned StartSize = ResultStmts.size();
2224 bool HadSkippedDecl =
false;
2228 for (; Case && I != E; ++I) {
2244 for (++I; I != E; ++I)
2254 assert(FoundCase &&
"Didn't find case but returned fallthrough?");
2269 assert(!HadSkippedDecl &&
"fallthrough after skipping decl");
2274 bool AnyDecls =
false;
2275 for (; I != E; ++I) {
2288 for (++I; I != E; ++I)
2305 ResultStmts.resize(StartSize);
2306 ResultStmts.push_back(S);
2330 ResultStmts.push_back(S);
2339 const llvm::APSInt &ConstantCondValue,
2351 if (
const DefaultStmt *DS = dyn_cast<DefaultStmt>(Case)) {
2359 if (CS->
getRHS())
return false;
2384 bool FoundCase =
false;
2391static std::optional<SmallVector<uint64_t, 16>>
2394 if (Likelihoods.size() <= 1)
2395 return std::nullopt;
2400 for (
const auto LH : Likelihoods) {
2415 if (NumUnlikely == 0 && NumLikely == 0)
2416 return std::nullopt;
2424 const uint64_t Likely = INT32_MAX / (NumLikely + 2);
2429 Result.reserve(Likelihoods.size());
2430 for (
const auto LH : Likelihoods) {
2433 Result.push_back(Unlikely);
2439 Result.push_back(Likely);
2450 if (
const auto *CS = dyn_cast<CaseStmt>(SC);
2458 llvm::SwitchInst *SavedSwitchInsn = SwitchInsn;
2461 llvm::BasicBlock *SavedCRBlock = CaseRangeBlock;
2466 llvm::APSInt ConstantCondValue;
2488 SwitchInsn =
nullptr;
2495 PGO->markStmtMaybeUsed(S.
getBody());
2499 SwitchInsn = SavedSwitchInsn;
2538 SwitchInsn =
Builder.CreateSwitch(CondV, DefaultBlock);
2542 llvm::MDBuilder MDHelper(
CGM.getLLVMContext());
2543 llvm::ConstantInt *BranchHintConstant =
2545 HLSLControlFlowHintAttr::Spelling::Microsoft_branch
2546 ? llvm::ConstantInt::get(
CGM.Int32Ty, 1)
2547 : llvm::ConstantInt::get(
CGM.Int32Ty, 2);
2548 llvm::Metadata *Vals[] = {MDHelper.createString(
"hlsl.controlflow.hint"),
2549 MDHelper.createConstant(BranchHintConstant)};
2550 SwitchInsn->setMetadata(
"hlsl.controlflow.hint",
2551 llvm::MDNode::get(
CGM.getLLVMContext(), Vals));
2554 if (PGO->haveRegionCounts()) {
2556 uint64_t DefaultCount = 0;
2557 unsigned NumCases = 0;
2566 SwitchWeights->reserve(NumCases);
2569 SwitchWeights->push_back(DefaultCount);
2570 }
else if (
CGM.getCodeGenOpts().OptimizationLevel) {
2576 CaseRangeBlock = DefaultBlock;
2579 Builder.ClearInsertionPoint();
2584 if (!BreakContinueStack.empty())
2585 OuterContinue = BreakContinueStack.back().ContinueBlock;
2587 BreakContinueStack.push_back(BreakContinue(S, SwitchExit, OuterContinue));
2592 BreakContinueStack.pop_back();
2596 SwitchInsn->setDefaultDest(CaseRangeBlock);
2599 if (!DefaultBlock->getParent()) {
2607 DefaultBlock->replaceAllUsesWith(SwitchExit.
getBlock());
2608 delete DefaultBlock;
2622 Builder.CreateBr(SwitchInsn->getDefaultDest());
2623 SwitchInsn->setDefaultDest(ImplicitDefaultBlock);
2634 if (
Call &&
CGM.getCodeGenOpts().OptimizationLevel != 0) {
2635 auto *FD = dyn_cast_or_null<FunctionDecl>(
Call->getCalleeDecl());
2636 if (FD && FD->getBuiltinID() == Builtin::BI__builtin_unpredictable) {
2638 SwitchInsn->setMetadata(llvm::LLVMContext::MD_unpredictable,
2639 MDHelper.createUnpredictable());
2643 if (SwitchWeights) {
2644 assert(SwitchWeights->size() == 1 + SwitchInsn->getNumCases() &&
2645 "switch weights do not match switch cases");
2647 if (SwitchWeights->size() > 1)
2648 SwitchInsn->setMetadata(llvm::LLVMContext::MD_prof,
2649 createProfileWeights(*SwitchWeights));
2650 delete SwitchWeights;
2651 }
else if (SwitchLikelihood) {
2652 assert(SwitchLikelihood->size() == 1 + SwitchInsn->getNumCases() &&
2653 "switch likelihoods do not match switch cases");
2654 std::optional<SmallVector<uint64_t, 16>> LHW =
2657 llvm::MDBuilder MDHelper(
CGM.getLLVMContext());
2658 SwitchInsn->setMetadata(llvm::LLVMContext::MD_prof,
2659 createProfileWeights(*LHW));
2661 delete SwitchLikelihood;
2663 SwitchInsn = SavedSwitchInsn;
2664 SwitchWeights = SavedSwitchWeights;
2665 SwitchLikelihood = SavedSwitchLikelihood;
2666 CaseRangeBlock = SavedCRBlock;
2669std::pair<llvm::Value*, llvm::Type *> CodeGenFunction::EmitAsmInputLValue(
2678 if ((Size <= 64 && llvm::isPowerOf2_64(Size)) ||
2688 ConstraintStr +=
'*';
2691std::pair<llvm::Value *, llvm::Type *>
2692CodeGenFunction::EmitAsmInput(
const TargetInfo::ConstraintInfo &Info,
2693 const Expr *InputExpr,
2694 std::string &ConstraintStr) {
2699 Expr::EvalResult EVResult;
2702 llvm::APSInt IntResult;
2705 return {llvm::ConstantInt::get(
getLLVMContext(), IntResult),
nullptr};
2717 if (InputExpr->
getStmtClass() == Expr::CXXThisExprClass)
2721 return EmitAsmInputLValue(Info, Dest, InputExpr->
getType(), ConstraintStr,
2733 Locs.push_back(llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
2736 if (!StrVal.empty()) {
2739 unsigned StartToken = 0;
2740 unsigned ByteOffset = 0;
2744 for (
unsigned i = 0, e = StrVal.size() - 1; i != e; ++i) {
2745 if (StrVal[i] !=
'\n')
continue;
2747 i + 1, SM, LangOpts, CGF.
getTarget(), &StartToken, &ByteOffset);
2748 Locs.push_back(llvm::ConstantAsMetadata::get(
2768 std::string AsmString;
2775 std::string Constraints;
2776 std::string InOutConstraints;
2779 std::vector<std::string> OutputConstraints;
2782 std::vector<llvm::Value *> Args;
2783 std::vector<llvm::Type *> ArgTypes;
2784 std::vector<llvm::Type *> ArgElemTypes;
2787 std::vector<LValue> ResultRegDests;
2788 std::vector<QualType> ResultRegQualTys;
2789 std::vector<llvm::Type *> ResultRegTypes;
2790 std::vector<llvm::Type *> ResultTruncRegTypes;
2792 llvm::BitVector ResultTypeRequiresCast;
2795 std::vector<llvm::Value *> InOutArgs;
2796 std::vector<llvm::Type *> InOutArgTypes;
2797 std::vector<llvm::Type *> InOutArgElemTypes;
2800 llvm::BasicBlock *DefaultDest =
nullptr;
2803 std::vector<std::optional<std::pair<unsigned, unsigned>>> ResultBounds;
2814 bool ReadOnly =
true;
2815 bool ReadNone =
true;
2817 bool GetOutputAndInputConstraints();
2818 void HandleOutputConstraints();
2819 void HandleMSStyleAsmBlob();
2820 void HandleInputConstraints();
2821 bool HandleLabels();
2822 bool HandleClobbers();
2823 void UpdateAsmCallInst(llvm::CallBase &
Result,
bool HasSideEffect,
2824 bool HasUnwindClobber,
bool NoMerge,
bool NoConvergent,
2825 std::vector<llvm::Value *> &RegResults);
2828 void EmitHipStdParUnsupportedAsm() {
2829 constexpr auto Name =
"__ASM__hipstdpar_unsupported";
2832 if (
auto GCCAsm = dyn_cast<GCCAsmStmt>(&S))
2833 Asm = GCCAsm->getAsmString();
2835 auto &Ctx = getLLVMContext();
2836 auto StrTy = llvm::ConstantDataArray::getString(Ctx,
Asm);
2837 auto FnTy = llvm::FunctionType::get(llvm::Type::getVoidTy(Ctx),
2838 {StrTy->getType()},
false);
2839 auto UBF = CGM.getModule().getOrInsertFunction(Name, FnTy);
2841 Builder.CreateCall(UBF, {StrTy});
2844 ASTContext &getContext() {
return CGF.getContext(); }
2845 llvm::LLVMContext &getLLVMContext() {
return CGF.getLLVMContext(); }
2846 const TargetInfo &getTarget()
const {
return CGF.getTarget(); }
2847 const LangOptions &getLangOpts()
const {
return CGF.getLangOpts(); }
2849 return CGM.getTargetCodeGenInfo();
2854 : CGF(CGF), CGM(CGF.CGM), S(S), Builder(CGF.Builder),
2855 AsmString(S.generateAsmString(CGF.getContext())) {}
2872 if (!GetOutputAndInputConstraints())
2873 return EmitHipStdParUnsupportedAsm();
2876 HandleOutputConstraints();
2880 HandleMSStyleAsmBlob();
2883 HandleInputConstraints();
2886 bool IsGCCAsmGoto = HandleLabels();
2889 bool HasUnwindClobber = HandleClobbers();
2890 assert(!(HasUnwindClobber && IsGCCAsmGoto) &&
2891 "unwind clobber can't be used with asm goto");
2894 std::string_view MachineClobbers = getTarget().getClobbers();
2895 if (!MachineClobbers.empty()) {
2896 if (!Constraints.empty())
2898 Constraints += MachineClobbers;
2901 llvm::Type *ResultType;
2902 if (ResultRegTypes.empty())
2903 ResultType = CGF.VoidTy;
2904 else if (ResultRegTypes.size() == 1)
2905 ResultType = ResultRegTypes[0];
2907 ResultType = llvm::StructType::get(getLLVMContext(), ResultRegTypes);
2909 llvm::FunctionType *FTy =
2910 llvm::FunctionType::get(ResultType, ArgTypes,
false);
2912 bool HasSideEffect = S.isVolatile() || S.getNumOutputs() == 0;
2914 llvm::InlineAsm::AsmDialect GnuAsmDialect =
2916 ? llvm::InlineAsm::AD_ATT
2917 : llvm::InlineAsm::AD_Intel;
2918 llvm::InlineAsm::AsmDialect AsmDialect =
2921 llvm::InlineAsm *IA = llvm::InlineAsm::get(
2922 FTy, AsmString, Constraints, HasSideEffect,
2923 false, AsmDialect, HasUnwindClobber);
2924 std::vector<llvm::Value *> RegResults;
2925 llvm::CallBrInst *CBR;
2926 llvm::DenseMap<llvm::BasicBlock *, SmallVector<llvm::Value *, 4>>
2930 if (CGF.HaveInsertPoint() && !CGF.Bypasses.isAlwaysBypassed()) {
2931 CGF.emitBypassedVarInitsForSource(&S);
2932 CGF.BypassingForwardJumps.push_back({Builder.GetInsertBlock(), &S});
2934 CBR = Builder.CreateCallBr(IA, DefaultDest, IndirectDests, Args);
2935 CGF.EmitBlock(DefaultDest);
2936 UpdateAsmCallInst(*CBR, HasSideEffect,
2937 false, CGF.InNoMergeAttributedStmt,
2938 CGF.InNoConvergentAttributedStmt, RegResults);
2943 if (!RegResults.empty()) {
2945 for (llvm::BasicBlock *Dest : CBR->getIndirectDests()) {
2946 llvm::Twine SynthName = Dest->getName() +
".split";
2947 llvm::BasicBlock *SynthBB = CGF.createBasicBlock(SynthName);
2948 llvm::IRBuilderBase::InsertPointGuard IPG(Builder);
2949 Builder.SetInsertPoint(SynthBB);
2951 if (ResultRegTypes.size() == 1) {
2952 CBRRegResults[SynthBB].push_back(CBR);
2954 for (
unsigned J = 0, E = ResultRegTypes.size(); J != E; ++J) {
2955 llvm::Value *Tmp = Builder.CreateExtractValue(CBR, J,
"asmresult");
2956 CBRRegResults[SynthBB].push_back(Tmp);
2960 CGF.EmitBranch(Dest);
2961 CGF.EmitBlock(SynthBB);
2962 CBR->setIndirectDest(I++, SynthBB);
2965 }
else if (HasUnwindClobber) {
2966 llvm::CallBase *
Result = CGF.EmitCallOrInvoke(IA, Args,
"");
2967 UpdateAsmCallInst(*
Result, HasSideEffect,
2968 true, CGF.InNoMergeAttributedStmt,
2969 CGF.InNoConvergentAttributedStmt, RegResults);
2972 Builder.CreateCall(IA, Args, CGF.getBundlesForFunclet(IA));
2973 UpdateAsmCallInst(*
Result, HasSideEffect,
2974 false, CGF.InNoMergeAttributedStmt,
2975 CGF.InNoConvergentAttributedStmt, RegResults);
2978 EmitAsmStores(RegResults);
2983 if (IsGCCAsmGoto && !CBRRegResults.empty()) {
2984 for (llvm::BasicBlock *Succ : CBR->getIndirectDests()) {
2985 llvm::IRBuilderBase::InsertPointGuard IPG(Builder);
2986 Builder.SetInsertPoint(--(Succ->end()));
2987 EmitAsmStores(CBRRegResults[Succ]);
2995bool AsmConstraintsInfo::GetOutputAndInputConstraints() {
2996 bool IsValidTargetAsm =
true;
2997 bool IsHipStdPar = getLangOpts().HIPStdPar && getLangOpts().CUDAIsDevice;
2998 for (
unsigned I = 0, E = S.getNumOutputs(); I != E && IsValidTargetAsm; I++) {
3000 if (
const GCCAsmStmt *GAS = dyn_cast<GCCAsmStmt>(&S))
3001 Name = GAS->getOutputName(I);
3005 bool IsValid = getTarget().validateOutputConstraint(Info);
3006 if (IsHipStdPar && !IsValid)
3007 IsValidTargetAsm =
false;
3009 assert(IsValid &&
"Failed to parse output constraint");
3011 OutputConstraintInfos.push_back(Info);
3014 for (
unsigned I = 0, E = S.getNumInputs(); I != E && IsValidTargetAsm; I++) {
3016 if (
const GCCAsmStmt *GAS = dyn_cast<GCCAsmStmt>(&S))
3017 Name = GAS->getInputName(I);
3022 getTarget().validateInputConstraint(OutputConstraintInfos, Info);
3023 if (IsHipStdPar && !IsValid)
3024 IsValidTargetAsm =
false;
3026 assert(IsValid &&
"Failed to parse input constraint");
3028 InputConstraintInfos.push_back(Info);
3031 return IsValidTargetAsm;
3038void AsmConstraintsInfo::HandleOutputConstraints() {
3040 llvm::SmallSet<std::string, 8> PhysRegOutputs;
3042 for (
unsigned I = 0, E = S.getNumOutputs(); I != E; I++) {
3043 TargetInfo::ConstraintInfo &Info = OutputConstraintInfos[I];
3046 std::string OutputConstraint(S.getOutputConstraint(I));
3047 OutputConstraint = getTarget().simplifyConstraint(
3048 StringRef(OutputConstraint).substr(1), &OutputConstraintInfos);
3050 const Expr *OutExpr = S.getOutputExpr(I);
3054 OutputConstraint = S.addVariableConstraints(
3055 OutputConstraint, *OutExpr, getTarget(), Info.
earlyClobber(),
3056 [&](
const Stmt *UnspStmt, StringRef Msg) {
3057 CGM.ErrorUnsupported(UnspStmt, Msg);
3062 if (!GCCReg.empty() && !PhysRegOutputs.insert(GCCReg).second)
3063 CGM.Error(S.getAsmLoc(),
"multiple outputs to hard register: " + GCCReg);
3065 OutputConstraints.push_back(OutputConstraint);
3067 if (!Constraints.empty())
3072 QualType QTy = OutExpr->
getType();
3073 const bool IsScalarOrAggregate =
3078 Constraints +=
"=" + OutputConstraint;
3079 ResultRegQualTys.push_back(QTy);
3080 ResultRegDests.push_back(Dest);
3085 const bool RequiresCast =
3087 (getTargetHooks().isScalarizableAsmOperand(CGF, Ty) ||
3088 Ty->isAggregateType());
3090 ResultTruncRegTypes.push_back(Ty);
3091 ResultTypeRequiresCast.push_back(RequiresCast);
3094 if (
unsigned Size = getContext().getTypeSize(QTy))
3095 Ty = llvm::IntegerType::get(getLLVMContext(), Size);
3097 CGM.Error(OutExpr->
getExprLoc(),
"output size should not be zero");
3100 ResultRegTypes.push_back(Ty);
3107 for (InputNo = 0; InputNo != S.getNumInputs(); ++InputNo) {
3108 TargetInfo::ConstraintInfo &Input = InputConstraintInfos[InputNo];
3109 if (Input.hasTiedOperand() && Input.getTiedOperand() == I)
3112 assert(InputNo != S.getNumInputs() &&
"Didn't find matching input!");
3114 QualType
InputTy = S.getInputExpr(InputNo)->getType();
3115 QualType OutputType = OutExpr->
getType();
3117 uint64_t InputSize = getContext().getTypeSize(InputTy);
3118 if (getContext().getTypeSize(OutputType) < InputSize)
3123 if (llvm::Type *AdjTy = getTargetHooks().adjustInlineAsmType(
3124 CGF, OutputConstraint, ResultRegTypes.back()))
3125 ResultRegTypes.back() = AdjTy;
3127 CGM.getDiags().Report(S.getAsmLoc(),
3128 diag::err_asm_invalid_type_in_input)
3129 << OutExpr->
getType() << OutputConstraint;
3132 if (
auto *VT = dyn_cast<llvm::VectorType>(ResultRegTypes.back()))
3133 CGF.LargestVectorWidth =
3134 std::max((
uint64_t)CGF.LargestVectorWidth,
3135 VT->getPrimitiveSizeInBits().getKnownMinValue());
3137 Address DestAddr = Dest.getAddress();
3148 ArgTypes.push_back(DestAddr.
getType());
3152 Constraints +=
"=*" + OutputConstraint;
3160 InOutConstraints +=
',';
3162 const Expr *InputExpr = S.getOutputExpr(I);
3164 llvm::Type *ArgElemType;
3165 std::tie(Arg, ArgElemType) =
3166 CGF.EmitAsmInputLValue(Info, Dest, InputExpr->
getType(),
3169 if (llvm::Type *AdjTy = getTargetHooks().adjustInlineAsmType(
3170 CGF, OutputConstraint, Arg->getType()))
3171 Arg = Builder.CreateBitCast(Arg, AdjTy);
3174 if (
auto *VT = dyn_cast<llvm::VectorType>(Arg->getType()))
3175 CGF.LargestVectorWidth =
3176 std::max((
uint64_t)CGF.LargestVectorWidth,
3177 VT->getPrimitiveSizeInBits().getKnownMinValue());
3181 InOutConstraints += llvm::utostr(I);
3183 InOutConstraints += OutputConstraint;
3185 InOutArgTypes.push_back(Arg->getType());
3186 InOutArgElemTypes.push_back(ArgElemType);
3187 InOutArgs.push_back(Arg);
3194void AsmConstraintsInfo::HandleMSStyleAsmBlob() {
3205 CGM.getTargetCodeGenInfo().addReturnRegisterOutputs(
3206 CGF, ReturnSlot, Constraints, ResultRegTypes, ResultTruncRegTypes,
3207 ResultRegDests, AsmString, S.getNumOutputs());
3214void AsmConstraintsInfo::HandleInputConstraints() {
3215 ASTContext &Ctx = getContext();
3217 for (
unsigned I = 0, E = S.getNumInputs(); I != E; I++) {
3218 TargetInfo::ConstraintInfo &Info = InputConstraintInfos[I];
3219 const Expr *InputExpr = S.getInputExpr(I);
3224 if (!Constraints.empty())
3228 std::string InputConstraint(S.getInputConstraint(I));
3230 getTarget().simplifyConstraint(InputConstraint, &OutputConstraintInfos);
3232 InputConstraint = S.addVariableConstraints(
3235 [&](
const Stmt *UnspStmt, std::string_view Msg) {
3236 CGM.ErrorUnsupported(UnspStmt, Msg);
3239 std::string ReplaceConstraint(InputConstraint);
3241 llvm::Type *ArgElemType;
3242 std::tie(Arg, ArgElemType) = CGF.EmitAsmInput(Info, InputExpr, Constraints);
3251 QualType OutputType = S.getOutputExpr(Output)->getType();
3257 Arg = Builder.CreatePtrToInt(Arg, CGF.
IntPtrTy);
3259 llvm::Type *OutputTy = CGF.
ConvertType(OutputType);
3261 Arg = Builder.CreateZExt(Arg, OutputTy);
3263 Arg = Builder.CreateZExt(Arg, CGF.
IntPtrTy);
3264 else if (OutputTy->isFloatingPointTy())
3265 Arg = Builder.CreateFPExt(Arg, OutputTy);
3269 ReplaceConstraint = OutputConstraints[Output];
3272 if (llvm::Type *AdjTy = getTargetHooks().adjustInlineAsmType(
3273 CGF, ReplaceConstraint, Arg->getType()))
3274 Arg = Builder.CreateBitCast(Arg, AdjTy);
3276 CGM.getDiags().Report(S.getAsmLoc(), diag::err_asm_invalid_type_in_input)
3277 << InputExpr->
getType() << InputConstraint;
3280 if (
auto *VT = dyn_cast<llvm::VectorType>(Arg->getType()))
3281 CGF.LargestVectorWidth =
3282 std::max((
uint64_t)CGF.LargestVectorWidth,
3283 VT->getPrimitiveSizeInBits().getKnownMinValue());
3285 ArgTypes.push_back(Arg->getType());
3286 ArgElemTypes.push_back(ArgElemType);
3287 Args.push_back(Arg);
3289 Constraints += InputConstraint;
3293 for (
unsigned I = 0, E = InOutArgs.size(); I != E; I++) {
3294 ArgTypes.push_back(InOutArgTypes[I]);
3295 ArgElemTypes.push_back(InOutArgElemTypes[I]);
3296 Args.push_back(InOutArgs[I]);
3299 Constraints += InOutConstraints;
3305bool AsmConstraintsInfo::HandleLabels() {
3306 if (
const auto *GS = dyn_cast<GCCAsmStmt>(&S); GS && GS->isAsmGoto()) {
3307 for (
const auto *E : GS->labels()) {
3309 IndirectDests.push_back(Dest.
getBlock());
3311 if (!Constraints.empty())
3314 Constraints +=
"!i";
3328bool AsmConstraintsInfo::HandleClobbers() {
3329 bool HasUnwindClobber =
false;
3330 for (
unsigned I = 0, E = S.getNumClobbers(); I != E; I++) {
3331 std::string Clobber = S.getClobber(I);
3333 if (Clobber ==
"unwind") {
3334 HasUnwindClobber =
true;
3338 if (Clobber ==
"memory") {
3341 }
else if (Clobber !=
"cc") {
3342 Clobber = getTarget().getNormalizedGCCRegisterName(Clobber);
3343 if (CGM.getCodeGenOpts().StackClashProtector &&
3344 getTarget().isSPRegName(Clobber)) {
3345 CGM.getDiags().Report(S.getAsmLoc(),
3346 diag::warn_stack_clash_protection_inline_asm);
3351 if (Clobber ==
"eax" || Clobber ==
"edx") {
3352 if (Constraints.find(
"=&A") != std::string::npos)
3355 std::string::size_type position1 =
3356 Constraints.find(
"={" + Clobber +
"}");
3357 if (position1 != std::string::npos) {
3358 Constraints.insert(position1 + 1,
"&");
3362 std::string::size_type position2 = Constraints.find(
"=A");
3363 if (position2 != std::string::npos) {
3364 Constraints.insert(position2 + 1,
"&");
3370 if (!Constraints.empty())
3373 Constraints +=
"~{" + Clobber +
'}';
3376 return HasUnwindClobber;
3379void AsmConstraintsInfo::UpdateAsmCallInst(
3380 llvm::CallBase &
Result,
bool HasSideEffect,
bool HasUnwindClobber,
3381 bool NoMerge,
bool NoConvergent, std::vector<llvm::Value *> &RegResults) {
3382 if (!HasUnwindClobber)
3383 Result.addFnAttr(llvm::Attribute::NoUnwind);
3386 Result.addFnAttr(llvm::Attribute::NoMerge);
3389 if (!HasSideEffect) {
3391 Result.setDoesNotAccessMemory();
3393 Result.setOnlyReadsMemory();
3397 for (
auto Pair : llvm::enumerate(ArgElemTypes)) {
3399 auto Attr = llvm::Attribute::get(
3400 getLLVMContext(), llvm::Attribute::ElementType, Pair.value());
3401 Result.addParamAttr(Pair.index(), Attr);
3407 const StringLiteral *SL;
3408 if (
const auto *gccAsmStmt = dyn_cast<GCCAsmStmt>(&S);
3410 (SL = dyn_cast<StringLiteral>(gccAsmStmt->getAsmStringExpr()))) {
3415 llvm::Constant *Loc =
3416 llvm::ConstantInt::get(CGF.
Int64Ty, S.getAsmLoc().getRawEncoding());
3417 Result.setMetadata(
"srcloc",
3418 llvm::MDNode::get(getLLVMContext(),
3419 llvm::ConstantAsMetadata::get(Loc)));
3425 if (!NoConvergent && getLangOpts().assumeFunctionsAreConvergent())
3430 Result.addFnAttr(llvm::Attribute::Convergent);
3433 if (ResultRegTypes.size() == 1) {
3434 RegResults.push_back(&
Result);
3436 for (
unsigned i = 0, e = ResultRegTypes.size(); i != e; ++i) {
3437 llvm::Value *Tmp = Builder.CreateExtractValue(&
Result, i,
"asmresult");
3438 RegResults.push_back(Tmp);
3443void AsmConstraintsInfo::EmitAsmStores(
3444 const llvm::ArrayRef<llvm::Value *> RegResults) {
3445 llvm::LLVMContext &CTX = getLLVMContext();
3447 assert(RegResults.size() == ResultRegTypes.size());
3448 assert(RegResults.size() == ResultTruncRegTypes.size());
3449 assert(RegResults.size() == ResultRegDests.size());
3453 assert(ResultTypeRequiresCast.size() <= ResultRegDests.size());
3454 assert(ResultBounds.size() <= ResultRegDests.size());
3456 for (
unsigned i = 0, e = RegResults.size(); i != e; ++i) {
3457 llvm::Value *Tmp = RegResults[i];
3458 llvm::Type *TruncTy = ResultTruncRegTypes[i];
3460 if (i < ResultBounds.size() && ResultBounds[i].has_value()) {
3461 const auto [LowerBound, UpperBound] = ResultBounds[i].value();
3464 assert(LowerBound == 0 &&
"Output operand lower bound is not zero.");
3466 llvm::Constant *UpperBoundConst =
3467 llvm::ConstantInt::get(Tmp->getType(), UpperBound);
3468 llvm::Value *IsBooleanValue =
3469 Builder.CreateCmp(llvm::CmpInst::ICMP_ULT, Tmp, UpperBoundConst);
3470 llvm::Function *FnAssume = CGM.getIntrinsic(llvm::Intrinsic::assume);
3472 Builder.CreateCall(FnAssume, IsBooleanValue);
3477 const bool RequiresCast =
3478 i < ResultTypeRequiresCast.size() && ResultTypeRequiresCast[i];
3483 if (ResultRegTypes[i] != TruncTy && !RequiresCast) {
3486 if (TruncTy->isFloatingPointTy())
3487 Tmp = Builder.CreateFPTrunc(Tmp, TruncTy);
3488 else if (TruncTy->isPointerTy() && Tmp->getType()->isIntegerTy()) {
3489 uint64_t ResSize = CGM.getDataLayout().getTypeSizeInBits(TruncTy);
3490 Tmp = Builder.CreateTrunc(
3491 Tmp, llvm::IntegerType::get(CTX, (
unsigned)ResSize));
3492 Tmp = Builder.CreateIntToPtr(Tmp, TruncTy);
3493 }
else if (Tmp->getType()->isPointerTy() && TruncTy->isIntegerTy()) {
3495 CGM.getDataLayout().getTypeSizeInBits(Tmp->getType());
3496 Tmp = Builder.CreatePtrToInt(
3497 Tmp, llvm::IntegerType::get(CTX, (
unsigned)TmpSize));
3498 Tmp = Builder.CreateTrunc(Tmp, TruncTy);
3499 }
else if (Tmp->getType()->isIntegerTy() && TruncTy->isIntegerTy()) {
3500 Tmp = Builder.CreateZExtOrTrunc(Tmp, TruncTy);
3501 }
else if (Tmp->getType()->isVectorTy() || TruncTy->isVectorTy()) {
3502 Tmp = Builder.CreateBitCast(Tmp, TruncTy);
3507 LValue Dest = ResultRegDests[i];
3510 unsigned Size = getContext().getTypeSize(ResultRegQualTys[i]);
3511 Address A = Dest.getAddress().withElementType(ResultRegTypes[i]);
3513 if (getTargetHooks().isScalarizableAsmOperand(CGF, TruncTy)) {
3514 llvm::StoreInst *S =
3515 Builder.CreateStore(Tmp, A, Dest.isVolatileQualified());
3520 QualType Ty = getContext().getIntTypeForBitwidth(Size,
false);
3522 const Expr *OutExpr = S.getOutputExpr(i);
3524 diag::err_store_value_to_reg);
3532 llvm::Type *IntTy = llvm::IntegerType::get(CTX, Size);
3533 uint64_t TmpSize = CGM.getDataLayout().getTypeSizeInBits(Tmp->getType());
3534 Tmp = Builder.CreateBitOrPointerCast(
3535 Tmp, llvm::IntegerType::get(CTX, (
unsigned)TmpSize));
3536 Tmp = Builder.CreateTrunc(Tmp, IntTy);
3543 Dest.getAddress().withElementType(IntTy),
3544 getContext().getQualifiedType(Ty, Dest.getQuals()),
3563 I != E; ++I, ++CurField) {
3565 if (CurField->hasCapturedVLAType()) {
3582 CodeGenFunction CGF(
CGM,
true);
3602 "CapturedStmtInfo should be set when generating the captured function");
3606 assert(CD->
hasBody() &&
"missing CapturedDecl body");
3615 CGM.getTypes().arrangeBuiltinFunctionDeclaration(Ctx.
VoidTy, Args);
3616 llvm::FunctionType *FuncLLVMTy =
CGM.getTypes().GetFunctionType(FuncInfo);
3619 llvm::Function::Create(FuncLLVMTy, llvm::GlobalValue::InternalLinkage,
3621 CGM.SetInternalFunctionAttributes(CD, F, FuncInfo);
3622 if (!
CGM.getCodeGenOpts().SampleProfileFile.empty())
3623 F->addFnAttr(
"sample-profile-suffix-elision-policy",
"selected");
3625 F->addFnAttr(llvm::Attribute::NoUnwind);
3637 for (
auto *FD : RD->
fields()) {
3638 if (FD->hasCapturedVLAType()) {
3642 auto VAT = FD->getCapturedVLAType();
3643 VLASizeMap[VAT->getSizeExpr()] = ExprArg;
3654 PGO->assignRegionCounters(
GlobalDecl(CD), F);
3664 for (
auto &I : *BB) {
3665 if (
auto *CI = dyn_cast<llvm::ConvergenceControlInst>(&I))
3671void CodeGenFunction::addConvergenceControlBundle(
3672 SmallVectorImpl<llvm::OperandBundleDef> &Bundles) {
3673 if (!CGM.shouldEmitConvergenceTokens())
3676 llvm::ConvergenceControlInst *ParentToken = ConvergenceTokenStack.back();
3677 assert(ParentToken);
3678 Bundles.emplace_back(
"convergencectrl", ParentToken);
3681void CodeGenFunction::setConvergentCallSite(llvm::CallBase *
Call,
3682 bool IsConvergent) {
3683 if (IsConvergent && !
Call->isConvergent())
3684 Call->setConvergent();
3686 assert((IsConvergent || !
Call->isConvergent() ||
3687 !CGM.shouldEmitConvergenceTokens()) &&
3688 "convergent call is missing a convergence control token");
3691llvm::ConvergenceControlInst *
3694 assert(ParentToken);
3695 return llvm::ConvergenceControlInst::CreateLoop(*BB, ParentToken);
3698llvm::ConvergenceControlInst *
3699CodeGenFunction::getOrEmitConvergenceEntryToken(llvm::Function *F) {
3700 llvm::BasicBlock *BB = &F->getEntryBlock();
3708 return llvm::ConvergenceControlInst::CreateEntry(*BB);
Defines enum values for all the target-independent builtin functions.
static bool FindCaseStatementsForValue(const SwitchStmt &S, const llvm::APSInt &ConstantCondValue, SmallVectorImpl< const Stmt * > &ResultStmts, ASTContext &C, const SwitchCase *&ResultCase)
FindCaseStatementsForValue - Find the case statement being jumped to and then invoke CollectStatement...
static llvm::ConvergenceControlInst * getConvergenceToken(llvm::BasicBlock *BB)
static bool isBPFRelocatedCase(CodeGenFunction &CGF, const CaseStmt &S)
static std::optional< SmallVector< uint64_t, 16 > > getLikelihoodWeights(ArrayRef< Stmt::Likelihood > Likelihoods)
static llvm::MDNode * getAsmSrcLocInfo(const StringLiteral *Str, CodeGenFunction &CGF)
getAsmSrcLocInfo - Return the !srcloc metadata node to attach to an inline asm call instruction.
static bool hasBPFEnumeratorRef(const Stmt *S)
Return whether S has an enumerator of a BPF preserve_access_index enum, which Sema keeps as a pseudo-...
static bool isSwiftAsyncCallee(const CallExpr *CE)
Determine if the given call uses the swiftasync calling convention.
static CSFC_Result CollectStatementsForCase(const Stmt *S, const SwitchCase *Case, bool &FoundCase, SmallVectorImpl< const Stmt * > &ResultStmts)
static const Expr * getBPFRelocatedCaseValue(CodeGenFunction &CGF, const Expr *E)
If the case value E has a relocated enumerator or an explicit __builtin_preserve_enum_value() call,...
static bool hasBPFRelocatedCase(CodeGenFunction &CGF, const SwitchStmt &S)
CSFC_Result
CollectStatementsForCase - Given the body of a 'switch' statement and a constant value that is being ...
Result
Implement __builtin_bit_cast and related operations.
Defines the PrettyStackTraceEntry class, which is used to make crashes give more contextual informati...
Defines the SourceManager interface.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
Enumerates target-specific builtins in their own namespaces within namespace clang.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
bool toIntegralConstant(APSInt &Result, QualType SrcTy, const ASTContext &Ctx) const
Try to convert this value to an integral constant.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType getCanonicalTagType(const TagDecl *TD) const
AsmConstraintsInfo(CodeGenFunction &CGF, const AsmStmt &S)
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Attr - This represents one attribute.
Represents an attribute applied to a statement.
ArrayRef< const Attr * > getAttrs() const
BreakStmt - This represents a break.
Represents the code generated for an expanded expansion statement.
ArrayRef< Stmt * > getInstantiations() const
ArrayRef< Stmt * > getPreambleStmts() const
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
DeclStmt * getBeginStmt()
DeclStmt * getLoopVarStmt()
DeclStmt * getRangeStmt()
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Represents the body of a CapturedStmt, and serves as its DeclContext.
ImplicitParamDecl * getContextParam() const
Retrieve the parameter containing captured variables.
param_iterator param_end() const
Retrieve an iterator one past the last parameter decl.
param_iterator param_begin() const
Retrieve an iterator pointing to the first parameter decl.
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
This captures a statement into a function.
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
SourceLocation getBeginLoc() const LLVM_READONLY
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
CaseStmt - Represent a case statement.
@ Indirect
Indirect - Pass the argument indirectly via a hidden pointer with the specified alignment (0 indicate...
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
llvm::PointerType * getType() const
Return the type of the pointer value.
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 source atom group for CGDebugInfo::addInstToCurrentSourceAtom.
A scoped helper to set the current debug location to the specified location or preferred location of ...
static ApplyDebugLocation CreateEmpty(CodeGenFunction &CGF)
Set the IRBuilder to not attach debug locations.
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
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.
ABIArgInfo & getReturnInfo()
API for captured statement code generation.
RAII for correct setting/restoring of CapturedStmtInfo.
void rescopeLabels()
Change the cleanup scope of the labels in this lexical scope to match the scope of the enclosing cont...
void ForceCleanup()
Force the emission of cleanups now, instead of waiting until this object is destroyed.
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited.
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.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
void EmitOMPParallelMaskedTaskLoopDirective(const OMPParallelMaskedTaskLoopDirective &S)
StringRef AMDGPUAvailableVisibleMode
The mode string from the amdgpu_av attribute on the current statement, or empty if the attribute is n...
void EmitOMPParallelMaskedDirective(const OMPParallelMaskedDirective &S)
void EmitOMPTaskyieldDirective(const OMPTaskyieldDirective &S)
void EmitCXXTryStmt(const CXXTryStmt &S)
void EmitBranchOnBoolExpr(const Expr *Cond, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock, uint64_t TrueCount, Stmt::Likelihood LH=Stmt::LH_None, const Expr *ConditionalOp=nullptr, const VarDecl *ConditionalDecl=nullptr)
EmitBranchOnBoolExpr - Emit a branch on a boolean condition (e.g.
void EmitSehCppScopeBegin()
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...
@ UseSkipPath
Skip (false)
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...
bool IsOutlinedSEHHelper
True if the current function is an outlined SEH helper.
void EmitOMPCanonicalLoop(const OMPCanonicalLoop *S)
Emit an OMPCanonicalLoop using the OpenMPIRBuilder.
static bool ContainsLabel(const Stmt *S, bool IgnoreCaseStmts=false)
ContainsLabel - Return true if the statement contains a label in it.
void EmitCXXForRangeStmt(const CXXForRangeStmt &S, ArrayRef< const Attr * > Attrs={})
void EmitOMPGenericLoopDirective(const OMPGenericLoopDirective &S)
void EmitOMPScanDirective(const OMPScanDirective &S)
void EmitComplexExprIntoLValue(const Expr *E, LValue dest, bool isInit)
EmitComplexExprIntoLValue - Emit the given expression of complex type and place its result into the s...
static bool hasScalarEvaluationKind(QualType T)
llvm::Type * ConvertType(QualType T)
void EmitOpenACCExitDataConstruct(const OpenACCExitDataConstruct &S)
friend class clang::AsmConstraintsInfo
LValue InitCapturedStruct(const CapturedStmt &S)
void EmitOMPFlattenDirective(const OMPFlattenDirective &S)
void addInstToNewSourceAtom(llvm::Instruction *KeyInstruction, llvm::Value *Backup)
Add KeyInstruction and an optional Backup instruction to a new atom group (See ApplyAtomGroup for mor...
CGCapturedStmtInfo * CapturedStmtInfo
void EmitOMPDistributeDirective(const OMPDistributeDirective &S)
void EmitOMPParallelForDirective(const OMPParallelForDirective &S)
llvm::CallBase * EmitCallOrInvoke(llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args, const Twine &Name="")
Emits a call or invoke instruction to the given function, depending on the current state of the EH st...
void EmitOMPMasterDirective(const OMPMasterDirective &S)
void EmitOMPParallelMasterTaskLoopSimdDirective(const OMPParallelMasterTaskLoopSimdDirective &S)
void EmitOpenACCInitConstruct(const OpenACCInitConstruct &S)
void EmitOMPFlushDirective(const OMPFlushDirective &S)
void EmitOMPTaskgroupDirective(const OMPTaskgroupDirective &S)
JumpDest getJumpDestForLabel(const LabelDecl *S)
getBasicBlockForLabel - Return the LLVM basicblock that the specified label maps to.
void EmitCoreturnStmt(const CoreturnStmt &S)
void EmitOMPTargetTeamsDistributeParallelForSimdDirective(const OMPTargetTeamsDistributeParallelForSimdDirective &S)
SmallVector< llvm::ConvergenceControlInst *, 4 > ConvergenceTokenStack
Stack to track the controlled convergence tokens.
void EmitObjCAtThrowStmt(const ObjCAtThrowStmt &S)
void EmitOMPDistributeSimdDirective(const OMPDistributeSimdDirective &S)
llvm::Constant * EmitCheckSourceLocation(SourceLocation Loc)
Emit a description of a source location in a format suitable for passing to a runtime sanitizer handl...
llvm::SmallVector< BypassingForwardJump, 4 > BypassingForwardJumps
bool EmitSimpleStmt(const Stmt *S, ArrayRef< const Attr * > Attrs)
EmitSimpleStmt - Try to emit a "simple" statement which does not necessarily require an insertion poi...
void EmitOMPTaskwaitDirective(const OMPTaskwaitDirective &S)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
void EmitOMPTargetParallelForDirective(const OMPTargetParallelForDirective &S)
void addInstToCurrentSourceAtom(llvm::Instruction *KeyInstruction, llvm::Value *Backup)
See CGDebugInfo::addInstToCurrentSourceAtom.
const LangOptions & getLangOpts() const
RValue EmitReferenceBindingToExpr(const Expr *E)
Emits a reference binding to the passed in expression.
void EmitOpenACCShutdownConstruct(const OpenACCShutdownConstruct &S)
bool InNoConvergentAttributedStmt
True if the current statement has noconvergent attribute.
void EmitOpenACCWaitConstruct(const OpenACCWaitConstruct &S)
void EmitBlockAfterUses(llvm::BasicBlock *BB)
EmitBlockAfterUses - Emit the given block somewhere hopefully near its uses, and leave the insertion ...
void SimplifyForwardingBlocks(llvm::BasicBlock *BB)
SimplifyForwardingBlocks - If the given basic block is only a branch to another basic block,...
void EmitOMPSplitDirective(const OMPSplitDirective &S)
void EmitBranchThroughCleanup(JumpDest Dest)
EmitBranchThroughCleanup - Emit a branch from the current insert block through the normal cleanup han...
bool InNoMergeAttributedStmt
True if the current statement has nomerge attribute.
void EmitOMPScopeDirective(const OMPScopeDirective &S)
LValue MakeAddrLValueWithoutTBAA(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
bool hasSkipCounter(const Stmt *S) const
JumpDest ReturnBlock
ReturnBlock - Unified return block.
void EmitOMPTargetTeamsDistributeSimdDirective(const OMPTargetTeamsDistributeSimdDirective &S)
llvm::DebugLoc SourceLocToDebugLoc(SourceLocation Location)
Converts Location to a DebugLoc, if debug information is enabled.
void EmitOMPInterchangeDirective(const OMPInterchangeDirective &S)
llvm::ConvergenceControlInst * emitConvergenceLoopToken(llvm::BasicBlock *BB)
void EmitBPFRelocatedCaseStmt(const CaseStmt &S, ArrayRef< const Attr * > Attrs)
Emit a case statement whose value is relocated: move the switch to a new block, and in its old block,...
void EmitAggregateCopy(LValue Dest, LValue Src, QualType EltTy, AggValueSlot::Overlap_t MayOverlap, bool isVolatile=false)
EmitAggregateCopy - Emit an aggregate copy.
LValue EmitLValueForField(LValue Base, const FieldDecl *Field, bool IsInBounds=true)
const TargetInfo & getTarget() const
Address EmitCompoundStmtWithoutScope(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
void EmitGotoStmt(const GotoStmt &S)
void EmitOMPDepobjDirective(const OMPDepobjDirective &S)
void EmitOMPMetaDirective(const OMPMetaDirective &S)
void EmitOMPCriticalDirective(const OMPCriticalDirective &S)
void EmitIgnoredExpr(const Expr *E)
EmitIgnoredExpr - Emit an expression in a context which ignores the result.
void EmitOMPTaskLoopDirective(const OMPTaskLoopDirective &S)
RValue EmitLoadOfLValue(LValue V, SourceLocation Loc)
EmitLoadOfLValue - Given an expression that represents a value lvalue, this method emits the address ...
void EmitOMPCancelDirective(const OMPCancelDirective &S)
const Expr * RetExpr
If a return statement is being visited, this holds the return statment's result expression.
void EmitOMPBarrierDirective(const OMPBarrierDirective &S)
void EmitForStmt(const ForStmt &S, ArrayRef< const Attr * > Attrs={})
void EmitOMPSectionsDirective(const OMPSectionsDirective &S)
void EmitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt &S)
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 EmitCXXExpansionStmtInstantiation(const CXXExpansionStmtInstantiation &S)
void EmitOMPInteropDirective(const OMPInteropDirective &S)
void EmitOMPParallelSectionsDirective(const OMPParallelSectionsDirective &S)
void EmitOMPTargetParallelDirective(const OMPTargetParallelDirective &S)
llvm::Value * EvaluateExprAsBool(const Expr *E)
EvaluateExprAsBool - Perform the usual unary conversions on the specified expression and compare the ...
void EmitWhileStmt(const WhileStmt &S, ArrayRef< const Attr * > Attrs={})
void EmitOMPTargetParallelForSimdDirective(const OMPTargetParallelForSimdDirective &S)
void EmitOMPTargetParallelGenericLoopDirective(const OMPTargetParallelGenericLoopDirective &S)
Emit combined directive 'target parallel loop' as if its constituent constructs are 'target',...
void EmitOpenACCCombinedConstruct(const OpenACCCombinedConstruct &S)
void ResolveBranchFixups(llvm::BasicBlock *Target)
void EmitOMPTeamsDistributeParallelForSimdDirective(const OMPTeamsDistributeParallelForSimdDirective &S)
void EmitOMPMaskedDirective(const OMPMaskedDirective &S)
bool checkIfLoopMustProgress(const Expr *, bool HasEmptyBody)
Returns true if a loop must make progress, which means the mustprogress attribute can be added.
bool HaveInsertPoint() const
HaveInsertPoint - True if an insertion point is defined.
void EmitOMPTeamsDistributeSimdDirective(const OMPTeamsDistributeSimdDirective &S)
void EmitOMPOrderedBlockAssocDirective(const OMPOrderedBlockAssocDirective &S)
CGDebugInfo * getDebugInfo()
void EmitOMPMasterTaskLoopDirective(const OMPMasterTaskLoopDirective &S)
void EmitOMPReverseDirective(const OMPReverseDirective &S)
void EmitOMPCancellationPointDirective(const OMPCancellationPointDirective &S)
void EmitOpenACCDataConstruct(const OpenACCDataConstruct &S)
LValue EmitLValueForFieldInitialization(LValue Base, const FieldDecl *Field)
EmitLValueForFieldInitialization - Like EmitLValueForField, except that if the Field is a reference,...
void EmitOMPTargetTeamsDistributeParallelForDirective(const OMPTargetTeamsDistributeParallelForDirective &S)
void EmitOMPMaskedTaskLoopDirective(const OMPMaskedTaskLoopDirective &S)
void EmitObjCAtTryStmt(const ObjCAtTryStmt &S)
const TargetCodeGenInfo & getTargetHooks() const
void EmitOMPTargetExitDataDirective(const OMPTargetExitDataDirective &S)
void EmitSEHLeaveStmt(const SEHLeaveStmt &S)
RawAddress CreateMemTempWithoutCast(QualType T, const Twine &Name="tmp")
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen without...
void EmitOMPTargetEnterDataDirective(const OMPTargetEnterDataDirective &S)
bool InNoInlineAttributedStmt
True if the current statement has noinline attribute.
void EmitOMPMaskedTaskLoopSimdDirective(const OMPMaskedTaskLoopSimdDirective &S)
void EmitCoroutineBody(const CoroutineBodyStmt &S)
void EmitOMPParallelDirective(const OMPParallelDirective &S)
void EmitOMPTaskDirective(const OMPTaskDirective &S)
void EmitOMPMasterTaskLoopSimdDirective(const OMPMasterTaskLoopSimdDirective &S)
void EmitOMPDistributeParallelForDirective(const OMPDistributeParallelForDirective &S)
void EmitOMPAssumeDirective(const OMPAssumeDirective &S)
void EmitOMPTeamsDistributeDirective(const OMPTeamsDistributeDirective &S)
ASTContext & getContext() const
void EmitStopPoint(const Stmt *S)
EmitStopPoint - Emit a debug stoppoint if we are emitting debug info.
void EmitOMPTargetUpdateDirective(const OMPTargetUpdateDirective &S)
void EmitOMPTargetTeamsGenericLoopDirective(const OMPTargetTeamsGenericLoopDirective &S)
void EmitIfStmt(const IfStmt &S)
void EmitStoreOfComplex(ComplexPairTy V, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
void EmitDeferStmt(const DeferStmt &S)
void emitBypassedVarInitsForSource(const Stmt *Source)
Re-emit trivial-auto-var-init stores for variables bypassed by the jump Source.
void EmitStoreThroughLValue(RValue Src, LValue Dst, bool isInit=false)
EmitStoreThroughLValue - Store the specified rvalue into the specified lvalue, where both are guarant...
void EmitOpenACCAtomicConstruct(const OpenACCAtomicConstruct &S)
void EmitObjCAtSynchronizedStmt(const ObjCAtSynchronizedStmt &S)
Address EmitCompoundStmt(const CompoundStmt &S, bool GetLast=false, AggValueSlot AVS=AggValueSlot::ignored())
EmitCompoundStmt - Emit a compound statement {..} node.
void EmitOpenACCCacheConstruct(const OpenACCCacheConstruct &S)
void EmitOpenACCLoopConstruct(const OpenACCLoopConstruct &S)
void EmitOMPTeamsDistributeParallelForDirective(const OMPTeamsDistributeParallelForDirective &S)
void EmitOMPFuseDirective(const OMPFuseDirective &S)
void EmitInitializerForField(FieldDecl *Field, LValue LHS, Expr *Init)
void EmitAsmStmt(const AsmStmt &S)
void EmitDefaultStmt(const DefaultStmt &S, ArrayRef< const Attr * > Attrs)
void EmitOMPTargetTeamsDistributeDirective(const OMPTargetTeamsDistributeDirective &S)
void EmitSwitchStmt(const SwitchStmt &S)
static bool mightAddDeclToScope(const Stmt *S)
Determine if the given statement might introduce a declaration into the current scope,...
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...
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 EmitStmt(const Stmt *S, ArrayRef< const Attr * > Attrs={})
EmitStmt - Emit the code for the statement.
void EmitOMPParallelForSimdDirective(const OMPParallelForSimdDirective &S)
uint64_t getCurrentProfileCount()
Get the profiler's current count.
llvm::Type * ConvertTypeForMem(QualType T)
void EmitOMPTaskLoopSimdDirective(const OMPTaskLoopSimdDirective &S)
void EmitSYCLKernelCallStmt(const SYCLKernelCallStmt &S)
void EmitOMPTargetDirective(const OMPTargetDirective &S)
void EmitOpenACCEnterDataConstruct(const OpenACCEnterDataConstruct &S)
llvm::Function * EmitCapturedStmt(const CapturedStmt &S, CapturedRegionKind K)
Generate an outlined function for the body of a CapturedStmt, store any captured variables into the c...
static TypeEvaluationKind getEvaluationKind(QualType T)
getEvaluationKind - Return the TypeEvaluationKind of QualType T.
void EmitOMPTeamsDirective(const OMPTeamsDirective &S)
static bool containsBreak(const Stmt *S)
containsBreak - Return true if the statement contains a break out of it.
void EmitSimpleOMPExecutableDirective(const OMPExecutableDirective &D)
Emit simple code for OpenMP directives in Simd-only mode.
HLSLControlFlowHintAttr::Spelling HLSLControlFlowAttr
HLSL Branch attribute.
bool InAlwaysInlineAttributedStmt
True if the current statement has always_inline attribute.
void EmitCaseStmt(const CaseStmt &S, ArrayRef< const Attr * > Attrs)
void EmitOMPErrorDirective(const OMPErrorDirective &S)
void EmitBreakStmt(const BreakStmt &S)
void EmitOMPParallelMaskedTaskLoopSimdDirective(const OMPParallelMaskedTaskLoopSimdDirective &S)
void EmitOMPTargetTeamsDirective(const OMPTargetTeamsDirective &S)
void EmitOpenACCComputeConstruct(const OpenACCComputeConstruct &S)
void EmitDoStmt(const DoStmt &S, ArrayRef< const Attr * > Attrs={})
void EmitOMPTargetDataDirective(const OMPTargetDataDirective &S)
const TargetInfo & Target
Address GenerateCapturedStmtArgument(const CapturedStmt &S)
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block,...
void EmitOMPSimdDirective(const OMPSimdDirective &S)
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 EmitOMPParallelGenericLoopDirective(const OMPLoopDirective &S)
RawAddress NormalCleanupDest
i32s containing the indexes of the cleanup destinations.
void EmitOMPTeamsGenericLoopDirective(const OMPTeamsGenericLoopDirective &S)
void EmitOMPTargetSimdDirective(const OMPLoopDirective &S)
Also emits 'target loop'.
void EmitOMPOrderedStandaloneDirective(const OMPOrderedStandaloneDirective &S)
unsigned NextCleanupDestIndex
AggValueSlot::Overlap_t getOverlapForReturnValue()
Determine whether a return value slot may overlap some other object.
const BreakContinue * GetDestForLoopControlStmt(const LoopControlStmt &S)
void EmitAggExpr(const Expr *E, AggValueSlot AS)
EmitAggExpr - Emit the computation of the specified expression of aggregate type.
VarBypassDetector Bypasses
llvm::BasicBlock * GetIndirectGotoBlock()
void EmitOpenACCHostDataConstruct(const OpenACCHostDataConstruct &S)
void EmitOpenACCUpdateConstruct(const OpenACCUpdateConstruct &S)
void EmitOMPUnrollDirective(const OMPUnrollDirective &S)
void EmitOMPStripeDirective(const OMPStripeDirective &S)
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type,...
static bool hasAggregateEvaluationKind(QualType T)
void EmitCaseStmtRange(const CaseStmt &S, ArrayRef< const Attr * > Attrs)
EmitCaseStmtRange - If case statement range is not too big then add multiple cases to switch instruct...
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitOMPSingleDirective(const OMPSingleDirective &S)
void EmitReturnStmt(const ReturnStmt &S)
EmitReturnStmt - Note that due to GCC extensions, this can have an operand if the function returns vo...
void EmitLambdaVLACapture(const VariableArrayType *VAT, LValue LV)
void FinishFunction(SourceLocation EndLoc=SourceLocation())
FinishFunction - Complete IR generation of the current function.
llvm::Value * EmitCheckedArgForAssume(const Expr *E)
Emits an argument for a call to a __builtin_assume.
llvm::Function * GenerateCapturedStmtFunction(const CapturedStmt &S)
Creates the outlined function for a CapturedStmt.
const CallExpr * MustTailCall
const CGFunctionInfo * CurFnInfo
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
void EmitDeclStmt(const DeclStmt &S)
void EmitLabelStmt(const LabelStmt &S)
bool ConstantFoldsToSimpleInteger(const Expr *Cond, bool &Result, bool AllowLabels=false)
ConstantFoldsToSimpleInteger - If the specified expression does not fold to a constant,...
void EmitOMPTileDirective(const OMPTileDirective &S)
void EmitDecl(const Decl &D, bool EvaluateConditionDecl=false)
EmitDecl - Emit a declaration.
void EmitOMPAtomicDirective(const OMPAtomicDirective &S)
void EmitOpenACCSetConstruct(const OpenACCSetConstruct &S)
Address ReturnValue
ReturnValue - The temporary alloca to hold the return value.
LValue EmitLValue(const Expr *E, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
EmitLValue - Emit code to compute a designator that specifies the location of the expression.
void EmitAttributedStmt(const AttributedStmt &S)
void EmitOMPParallelMasterTaskLoopDirective(const OMPParallelMasterTaskLoopDirective &S)
void EmitOMPDistributeParallelForSimdDirective(const OMPDistributeParallelForSimdDirective &S)
void EmitOMPSectionDirective(const OMPSectionDirective &S)
void EnsureInsertPoint()
EnsureInsertPoint - Ensure that an insertion point is defined so that emitted IR has a place to go.
void EmitOMPForSimdDirective(const OMPForSimdDirective &S)
llvm::LLVMContext & getLLVMContext()
bool SawAsmBlock
Whether we processed a Microsoft-style asm block during CodeGen.
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
void EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S)
void EmitIndirectGotoStmt(const IndirectGotoStmt &S)
void MaybeEmitDeferredVarDeclInit(const VarDecl *var)
bool isObviouslyBranchWithoutCleanups(JumpDest Dest) const
isObviouslyBranchWithoutCleanups - Return true if a branch to the specified destination obviously has...
void EmitSEHTryStmt(const SEHTryStmt &S)
void EmitOMPParallelMasterDirective(const OMPParallelMasterDirective &S)
void EmitBlockWithFallThrough(llvm::BasicBlock *BB, const Stmt *S)
When instrumenting to collect profile data, the counts for some blocks such as switch cases need to n...
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
void EmitOMPForDirective(const OMPForDirective &S)
void EmitLabel(const LabelDecl *D)
EmitLabel - Emit the block for the given label.
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
LValue MakeNaturalAlignRawAddrLValue(llvm::Value *V, QualType T)
void EmitContinueStmt(const ContinueStmt &S)
This class organizes the cross-function state that is used while generating LLVM code.
const LangOptions & getLangOpts() const
const llvm::DataLayout & getDataLayout() const
ASTContext & getContext() const
A saved depth on the scope stack.
bool encloses(stable_iterator I) const
Returns true if this scope encloses I.
static stable_iterator invalid()
static stable_iterator stable_end()
Create a stable reference to the bottom of the EH stack.
FunctionArgList - Type for representing both the decl and type of parameters to a function.
LValue - This represents an lvalue references.
llvm::Value * getPointer(CodeGenFunction &CGF) const
Address getAddress() const
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(llvm::Value *V)
Address getAggregateAddress() const
getAggregateAddr() - Return the Value* of the address of the aggregate.
llvm::Value * getScalarVal() const
getScalarVal() - Return the Value* of this scalar value.
std::pair< llvm::Value *, llvm::Value * > getComplexVal() const
getComplexVal - Return the real/imag components of this complex value.
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
CompoundStmt - This represents a group of statements like { stmt stmt }.
Stmt *const * const_body_iterator
SourceLocation getLBracLoc() const
body_iterator body_begin()
ContinueStmt - This represents a continue.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
SourceLocation getBodyRBrace() const
getBodyRBrace - Gets the right brace of the body, if a body exists.
virtual bool hasBody() const
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
SourceLocation getLocation() const
DeferStmt - This represents a deferred statement.
DoStmt - This represents a 'do/while' stmt.
This represents one expression.
bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer,...
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parentheses and casts which do not change the value (including ptr->int casts of the sa...
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx) const
EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded integer.
bool isEvaluatable(const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects) const
isEvaluatable - Call EvaluateAsRValue to see if this expression can be constant folded without side-e...
bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsRValue - Return true if this is a constant which we can fold to an rvalue using any crazy t...
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Represents a member of a struct/union/class.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
FunctionType - C99 6.7.5.3 - Function Declarators.
CallingConv getCallConv() const
This represents a GCC inline-assembly statement extension.
GlobalDecl - represents a global declaration.
GotoStmt - This represents a direct goto.
LabelDecl * getLabel() const
IfStmt - This represents an if/then/else.
bool isNegatedConsteval() const
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
IndirectGotoStmt - This represents an indirect goto.
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
Represents the declaration of a label.
LabelStmt * getStmt() const
LabelStmt - Represents a label, which has a substatement.
LabelDecl * getDecl() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Base class for BreakStmt and ContinueStmt.
Represents a point when we exit a loop.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
If a crash happens while one of these objects are live, the message is printed out along with the spe...
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
QualType getCanonicalType() const
The collection of all-type qualifiers we support.
Represents a struct/union/class.
field_range fields() const
specific_decl_iterator< FieldDecl > field_iterator
field_iterator field_begin() const
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
SourceLocation getBeginLoc() const
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Scope - A scope is a transient data structure that is used while parsing the program.
Encodes a location in the source.
UIntTy getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Likelihood
The likelihood of a branch being taken.
@ LH_Unlikely
Branch has the [[unlikely]] attribute.
@ LH_None
No attribute set or branches of the IfStmt have the same attribute.
@ LH_Likely
Branch has the [[likely]] attribute.
static const Attr * getLikelihoodAttr(const Stmt *S)
SourceLocation getBeginLoc() const LLVM_READONLY
static Likelihood getLikelihood(ArrayRef< const Attr * > Attrs)
StringLiteral - This represents a string literal expression, e.g.
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getLocationOfByte(unsigned ByteNo, const SourceManager &SM, const LangOptions &Features, const TargetInfo &Target, unsigned *StartToken=nullptr, unsigned *StartTokenByteOffset=nullptr) const
Return a source location that points to the specified byte of this string literal.
StringRef getString() const
const SwitchCase * getNextSwitchCase() const
SwitchStmt - This represents a 'switch' stmt.
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
SwitchCase * getSwitchCaseList()
Exposes information about the current target.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Token - This structure provides full information about a lexed token.
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
const T * castAs() const
Member-template castAs<specific type>.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
WhileStmt - This represents a 'while' stmt.
SourceLocation getWhileLoc() const
SourceLocation getRParenLoc() const
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
Defines the clang::TargetInfo interface.
bool checkIfLoopMustProgress(const LangOptions &LangOpts, const CodeGenOptions &CGOpts, ASTContext &Ctx, const Expr *ControllingExpression, bool HasEmptyBody, llvm::function_ref< void()> RemoveMustProgress)
Returns true if a loop must make progress, which means the mustprogress attribute can be added to it.
bool hasEmptyLoopBody(const LoopStmt &S)
std::pair< types::ID, const llvm::opt::Arg * > InputTy
A list of inputs and their types for the given arguments.
@ Address
A pointer to a ValueDecl.
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
bool isa(CodeGen::Address addr)
CapturedRegionKind
The different kinds of captured statement.
@ Asm
Assembly: we accept this only so that we can preprocess it.
@ Result
The result type of a method or function.
U cast(CodeGen::Address addr)
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 uint64_t
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
llvm::IntegerType * Int64Ty
llvm::IntegerType * IntPtrTy
llvm::PointerType * Int8PtrTy
static TBAAAccessInfo getMayAliasInfo()
APValue Val
Val - This is the value the expression can be folded to.
bool hasMatchingInput() const
Return true if this output operand has a matching (tied) input operand.
unsigned getTiedOperand() const
bool allowsMemory() const
std::optional< std::pair< unsigned, unsigned > > getOutputOperandBounds() const
bool requiresImmediateConstant() const
bool hasTiedOperand() const
Return true if this input operand is a matching constraint that ties it to an output operand.
bool allowsRegister() const