clang
19.0.0git
|
Class intended to support codegen of all kind of the reduction clauses. More...
#include "/home/runner/work/llvm/llvm/repo/clang/lib/CodeGen/CGOpenMPRuntime.h"
Public Member Functions | |
ReductionCodeGen (ArrayRef< const Expr * > Shareds, ArrayRef< const Expr * > Origs, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > ReductionOps) | |
void | emitSharedOrigLValue (CodeGenFunction &CGF, unsigned N) |
Emits lvalue for the shared and original reduction item. More... | |
void | emitAggregateType (CodeGenFunction &CGF, unsigned N) |
Emits the code for the variable-modified type, if required. More... | |
void | emitAggregateType (CodeGenFunction &CGF, unsigned N, llvm::Value *Size) |
Emits the code for the variable-modified type, if required. More... | |
void | emitInitialization (CodeGenFunction &CGF, unsigned N, Address PrivateAddr, Address SharedAddr, llvm::function_ref< bool(CodeGenFunction &)> DefaultInit) |
Performs initialization of the private copy for the reduction item. More... | |
bool | needCleanups (unsigned N) |
Returns true if the private copy requires cleanups. More... | |
void | emitCleanups (CodeGenFunction &CGF, unsigned N, Address PrivateAddr) |
Emits cleanup code for the reduction item. More... | |
Address | adjustPrivateAddress (CodeGenFunction &CGF, unsigned N, Address PrivateAddr) |
Adjusts PrivatedAddr for using instead of the original variable address in normal operations. More... | |
LValue | getSharedLValue (unsigned N) const |
Returns LValue for the reduction item. More... | |
LValue | getOrigLValue (unsigned N) const |
Returns LValue for the original reduction item. More... | |
std::pair< llvm::Value *, llvm::Value * > | getSizes (unsigned N) const |
Returns the size of the reduction item (in chars and total number of elements in the item), or nullptr, if the size is a constant. More... | |
const VarDecl * | getBaseDecl (unsigned N) const |
Returns the base declaration of the reduction item. More... | |
const Expr * | getRefExpr (unsigned N) const |
Returns the base declaration of the reduction item. More... | |
bool | usesReductionInitializer (unsigned N) const |
Returns true if the initialization of the reduction item uses initializer from declare reduction construct. More... | |
QualType | getPrivateType (unsigned N) const |
Return the type of the private item. More... | |
Class intended to support codegen of all kind of the reduction clauses.
Definition at line 128 of file CGOpenMPRuntime.h.
ReductionCodeGen::ReductionCodeGen | ( | ArrayRef< const Expr * > | Shareds, |
ArrayRef< const Expr * > | Origs, | ||
ArrayRef< const Expr * > | Privates, | ||
ArrayRef< const Expr * > | ReductionOps | ||
) |
Definition at line 767 of file CGOpenMPRuntime.cpp.
References advance().
Address ReductionCodeGen::adjustPrivateAddress | ( | CodeGenFunction & | CGF, |
unsigned | N, | ||
Address | PrivateAddr | ||
) |
Adjusts PrivatedAddr
for using instead of the original variable address in normal operations.
N | Number of the reduction item. |
PrivateAddr | Address of the corresponding private item. |
Definition at line 962 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, castToBase(), clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::LValue::getAddress(), getBaseDecl(), clang::CodeGen::Address::getElementType(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::Address::getType(), and loadToBegin().
Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit().
void ReductionCodeGen::emitAggregateType | ( | CodeGenFunction & | CGF, |
unsigned | N | ||
) |
Emits the code for the variable-modified type, if required.
N | Number of the reduction item. |
Definition at line 801 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(), clang::CodeGen::RValue::get(), clang::ASTContext::getAsVariableArrayType(), clang::CodeGen::CodeGenFunction::getContext(), clang::VariableArrayType::getSizeExpr(), clang::CodeGen::CodeGenFunction::getTypeSize(), and clang::Type::isVariablyModifiedType().
Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit(), and clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().
void ReductionCodeGen::emitAggregateType | ( | CodeGenFunction & | CGF, |
unsigned | N, | ||
llvm::Value * | Size | ||
) |
Emits the code for the variable-modified type, if required.
N | Number of the reduction item. |
Size | Size of the type in chars. |
Definition at line 835 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(), clang::CodeGen::RValue::get(), clang::ASTContext::getAsVariableArrayType(), clang::CodeGen::CodeGenFunction::getContext(), clang::VariableArrayType::getSizeExpr(), and clang::Type::isVariablyModifiedType().
void ReductionCodeGen::emitCleanups | ( | CodeGenFunction & | CGF, |
unsigned | N, | ||
Address | PrivateAddr | ||
) |
Emits cleanup code for the reduction item.
N | Number of the reduction item. |
PrivateAddr | Address of the corresponding private item. |
Definition at line 883 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::QualType::isDestructedType(), clang::CodeGen::CodeGenFunction::pushDestroy(), and clang::CodeGen::Address::withElementType().
void ReductionCodeGen::emitInitialization | ( | CodeGenFunction & | CGF, |
unsigned | N, | ||
Address | PrivateAddr, | ||
Address | SharedAddr, | ||
llvm::function_ref< bool(CodeGenFunction &)> | DefaultInit | ||
) |
Performs initialization of the private copy for the reduction item.
N | Number of the reduction item. |
PrivateAddr | Address of the corresponding private item. |
DefaultInit | Default initialization sequence that should be performed if no reduction specific initialization is found. |
SharedAddr | Address of the original shared variable. |
Definition at line 852 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(), emitInitWithReductionInitializer(), clang::ASTContext::getAsArrayType(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPDeclareReductionDecl::getInitializer(), getReductionInit(), clang::CodeGen::Address::getType(), clang::CodeGen::CodeGenFunction::isTrivialInitializer(), and clang::Private.
Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit().
void ReductionCodeGen::emitSharedOrigLValue | ( | CodeGenFunction & | CGF, |
unsigned | N | ||
) |
Emits lvalue for the shared and original reduction item.
N | Number of the reduction item. |
Definition at line 786 of file CGOpenMPRuntime.cpp.
References clang::First.
Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit(), and clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().
Returns the base declaration of the reduction item.
Definition at line 216 of file CGOpenMPRuntime.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit().
Returns LValue for the original reduction item.
Definition at line 209 of file CGOpenMPRuntime.h.
Referenced by clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().
Return the type of the private item.
Definition at line 223 of file CGOpenMPRuntime.h.
References clang::Private.
Returns the base declaration of the reduction item.
Definition at line 218 of file CGOpenMPRuntime.h.
Referenced by clang::CodeGen::CGOpenMPRuntime::emitTaskReductionFixups().
Returns LValue for the reduction item.
Definition at line 207 of file CGOpenMPRuntime.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit(), and clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().
|
inline |
Returns the size of the reduction item (in chars and total number of elements in the item), or nullptr, if the size is a constant.
Definition at line 212 of file CGOpenMPRuntime.h.
Referenced by clang::CodeGen::CGOpenMPRuntime::emitTaskReductionFixups(), and clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().
Returns true if the private copy requires cleanups.
Definition at line 877 of file CGOpenMPRuntime.cpp.
References clang::QualType::DK_none, and clang::QualType::isDestructedType().
Referenced by emitReduceFiniFunction().
Returns true if the initialization of the reduction item uses initializer from declare reduction construct.
Definition at line 989 of file CGOpenMPRuntime.cpp.
References clang::OMPDeclareReductionDecl::getInitializer(), and getReductionInit().