#include "CGDebugInfo.h"
#include "CGOpenMPRuntime.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "TargetInfo.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Basic/PrettyStackTrace.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/Assumptions.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/Support/SaveAndRestore.h"
#include <optional>
usingnamespaceclang;
usingnamespaceCodeGen;
namespace llvm {
extern cl::opt<bool> EnableSingleByteCoverage;
}
void CodeGenFunction::EmitStopPoint(const Stmt *S) { … }
void CodeGenFunction::EmitStmt(const Stmt *S, ArrayRef<const Attr *> Attrs) { … }
bool CodeGenFunction::EmitSimpleStmt(const Stmt *S,
ArrayRef<const Attr *> Attrs) { … }
Address CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
AggValueSlot AggSlot) { … }
Address
CodeGenFunction::EmitCompoundStmtWithoutScope(const CompoundStmt &S,
bool GetLast,
AggValueSlot AggSlot) { … }
void CodeGenFunction::SimplifyForwardingBlocks(llvm::BasicBlock *BB) { … }
void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) { … }
void CodeGenFunction::EmitBranch(llvm::BasicBlock *Target) { … }
void CodeGenFunction::EmitBlockAfterUses(llvm::BasicBlock *block) { … }
CodeGenFunction::JumpDest
CodeGenFunction::getJumpDestForLabel(const LabelDecl *D) { … }
void CodeGenFunction::EmitLabel(const LabelDecl *D) { … }
void CodeGenFunction::LexicalScope::rescopeLabels() { … }
void CodeGenFunction::EmitLabelStmt(const LabelStmt &S) { … }
void CodeGenFunction::EmitAttributedStmt(const AttributedStmt &S) { … }
void CodeGenFunction::EmitGotoStmt(const GotoStmt &S) { … }
void CodeGenFunction::EmitIndirectGotoStmt(const IndirectGotoStmt &S) { … }
void CodeGenFunction::EmitIfStmt(const IfStmt &S) { … }
bool CodeGenFunction::checkIfLoopMustProgress(const Expr *ControllingExpression,
bool HasEmptyBody) { … }
template <typename LoopStmt> static bool hasEmptyLoopBody(const LoopStmt &S) { … }
void CodeGenFunction::EmitWhileStmt(const WhileStmt &S,
ArrayRef<const Attr *> WhileAttrs) { … }
void CodeGenFunction::EmitDoStmt(const DoStmt &S,
ArrayRef<const Attr *> DoAttrs) { … }
void CodeGenFunction::EmitForStmt(const ForStmt &S,
ArrayRef<const Attr *> ForAttrs) { … }
void
CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S,
ArrayRef<const Attr *> ForAttrs) { … }
void CodeGenFunction::EmitReturnOfRValue(RValue RV, QualType Ty) { … }
namespace {
struct SaveRetExprRAII { … };
}
static bool isSwiftAsyncCallee(const CallExpr *CE) { … }
void CodeGenFunction::EmitReturnStmt(const ReturnStmt &S) { … }
void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) { … }
void CodeGenFunction::EmitBreakStmt(const BreakStmt &S) { … }
void CodeGenFunction::EmitContinueStmt(const ContinueStmt &S) { … }
void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S,
ArrayRef<const Attr *> Attrs) { … }
void CodeGenFunction::EmitCaseStmt(const CaseStmt &S,
ArrayRef<const Attr *> Attrs) { … }
void CodeGenFunction::EmitDefaultStmt(const DefaultStmt &S,
ArrayRef<const Attr *> Attrs) { … }
enum CSFC_Result { … };
static CSFC_Result CollectStatementsForCase(const Stmt *S,
const SwitchCase *Case,
bool &FoundCase,
SmallVectorImpl<const Stmt*> &ResultStmts) { … }
static bool FindCaseStatementsForValue(const SwitchStmt &S,
const llvm::APSInt &ConstantCondValue,
SmallVectorImpl<const Stmt*> &ResultStmts,
ASTContext &C,
const SwitchCase *&ResultCase) { … }
static std::optional<SmallVector<uint64_t, 16>>
getLikelihoodWeights(ArrayRef<Stmt::Likelihood> Likelihoods) { … }
void CodeGenFunction::EmitSwitchStmt(const SwitchStmt &S) { … }
static std::string
SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
SmallVectorImpl<TargetInfo::ConstraintInfo> *OutCons=nullptr) { … }
static std::string
AddVariableConstraints(const std::string &Constraint, const Expr &AsmExpr,
const TargetInfo &Target, CodeGenModule &CGM,
const AsmStmt &Stmt, const bool EarlyClobber,
std::string *GCCReg = nullptr) { … }
std::pair<llvm::Value*, llvm::Type *> CodeGenFunction::EmitAsmInputLValue(
const TargetInfo::ConstraintInfo &Info, LValue InputValue,
QualType InputType, std::string &ConstraintStr, SourceLocation Loc) { … }
std::pair<llvm::Value *, llvm::Type *>
CodeGenFunction::EmitAsmInput(const TargetInfo::ConstraintInfo &Info,
const Expr *InputExpr,
std::string &ConstraintStr) { … }
static llvm::MDNode *getAsmSrcLocInfo(const StringLiteral *Str,
CodeGenFunction &CGF) { … }
static void UpdateAsmCallInst(llvm::CallBase &Result, bool HasSideEffect,
bool HasUnwindClobber, bool ReadOnly,
bool ReadNone, bool NoMerge, bool NoConvergent,
const AsmStmt &S,
const std::vector<llvm::Type *> &ResultRegTypes,
const std::vector<llvm::Type *> &ArgElemTypes,
CodeGenFunction &CGF,
std::vector<llvm::Value *> &RegResults) { … }
static void
EmitAsmStores(CodeGenFunction &CGF, const AsmStmt &S,
const llvm::ArrayRef<llvm::Value *> RegResults,
const llvm::ArrayRef<llvm::Type *> ResultRegTypes,
const llvm::ArrayRef<llvm::Type *> ResultTruncRegTypes,
const llvm::ArrayRef<LValue> ResultRegDests,
const llvm::ArrayRef<QualType> ResultRegQualTys,
const llvm::BitVector &ResultTypeRequiresCast,
const llvm::BitVector &ResultRegIsFlagReg) { … }
static void EmitHipStdParUnsupportedAsm(CodeGenFunction *CGF,
const AsmStmt &S) { … }
void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { … }
LValue CodeGenFunction::InitCapturedStruct(const CapturedStmt &S) { … }
llvm::Function *
CodeGenFunction::EmitCapturedStmt(const CapturedStmt &S, CapturedRegionKind K) { … }
Address CodeGenFunction::GenerateCapturedStmtArgument(const CapturedStmt &S) { … }
llvm::Function *
CodeGenFunction::GenerateCapturedStmtFunction(const CapturedStmt &S) { … }
namespace {
llvm::IntrinsicInst *getConvergenceToken(llvm::BasicBlock *BB) { … }
}
llvm::CallBase *
CodeGenFunction::addConvergenceControlToken(llvm::CallBase *Input,
llvm::Value *ParentToken) { … }
llvm::IntrinsicInst *
CodeGenFunction::emitConvergenceLoopToken(llvm::BasicBlock *BB,
llvm::Value *ParentToken) { … }
llvm::IntrinsicInst *
CodeGenFunction::getOrEmitConvergenceEntryToken(llvm::Function *F) { … }