clang 19.0.0git
Classes | Public Member Functions | List of all members
clang::CodeGen::ReductionCodeGen Class Reference

Class intended to support codegen of all kind of the reduction clauses. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/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.
 
void emitAggregateType (CodeGenFunction &CGF, unsigned N)
 Emits the code for the variable-modified type, if required.
 
void emitAggregateType (CodeGenFunction &CGF, unsigned N, llvm::Value *Size)
 Emits the code for the variable-modified type, if required.
 
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.
 
bool needCleanups (unsigned N)
 Returns true if the private copy requires cleanups.
 
void emitCleanups (CodeGenFunction &CGF, unsigned N, Address PrivateAddr)
 Emits cleanup code for the reduction item.
 
Address adjustPrivateAddress (CodeGenFunction &CGF, unsigned N, Address PrivateAddr)
 Adjusts PrivatedAddr for using instead of the original variable address in normal operations.
 
LValue getSharedLValue (unsigned N) const
 Returns LValue for the reduction item.
 
LValue getOrigLValue (unsigned N) const
 Returns LValue for the original reduction item.
 
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.
 
const VarDeclgetBaseDecl (unsigned N) const
 Returns the base declaration of the reduction item.
 
const ExprgetRefExpr (unsigned N) const
 Returns the base declaration of the reduction item.
 
bool usesReductionInitializer (unsigned N) const
 Returns true if the initialization of the reduction item uses initializer from declare reduction construct.
 
QualType getPrivateType (unsigned N) const
 Return the type of the private item.
 

Detailed Description

Class intended to support codegen of all kind of the reduction clauses.

Definition at line 128 of file CGOpenMPRuntime.h.

Constructor & Destructor Documentation

◆ ReductionCodeGen()

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.

Member Function Documentation

◆ adjustPrivateAddress()

Address ReductionCodeGen::adjustPrivateAddress ( CodeGenFunction CGF,
unsigned  N,
Address  PrivateAddr 
)

◆ emitAggregateType() [1/2]

void ReductionCodeGen::emitAggregateType ( CodeGenFunction CGF,
unsigned  N 
)

◆ emitAggregateType() [2/2]

void ReductionCodeGen::emitAggregateType ( CodeGenFunction CGF,
unsigned  N,
llvm::Value *  Size 
)

◆ emitCleanups()

void ReductionCodeGen::emitCleanups ( CodeGenFunction CGF,
unsigned  N,
Address  PrivateAddr 
)

Emits cleanup code for the reduction item.

Parameters
NNumber of the reduction item.
PrivateAddrAddress of the corresponding private item.

Definition at line 883 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), getPrivateType(), clang::QualType::isDestructedType(), needCleanups(), clang::CodeGen::CodeGenFunction::pushDestroy(), and clang::CodeGen::Address::withElementType().

Referenced by emitReduceFiniFunction().

◆ emitInitialization()

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.

Parameters
NNumber of the reduction item.
PrivateAddrAddress of the corresponding private item.
DefaultInitDefault initialization sequence that should be performed if no reduction specific initialization is found.
SharedAddrAddress 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 emitReduceInitFunction().

◆ emitSharedOrigLValue()

void ReductionCodeGen::emitSharedOrigLValue ( CodeGenFunction CGF,
unsigned  N 
)

Emits lvalue for the shared and original reduction item.

Parameters
NNumber of the reduction item.

Definition at line 786 of file CGOpenMPRuntime.cpp.

References clang::First.

Referenced by emitScanBasedDirectiveDecls(), and clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().

◆ getBaseDecl()

const VarDecl * clang::CodeGen::ReductionCodeGen::getBaseDecl ( unsigned  N) const
inline

Returns the base declaration of the reduction item.

Definition at line 216 of file CGOpenMPRuntime.h.

Referenced by adjustPrivateAddress().

◆ getOrigLValue()

LValue clang::CodeGen::ReductionCodeGen::getOrigLValue ( unsigned  N) const
inline

Returns LValue for the original reduction item.

Definition at line 209 of file CGOpenMPRuntime.h.

Referenced by clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().

◆ getPrivateType()

QualType clang::CodeGen::ReductionCodeGen::getPrivateType ( unsigned  N) const
inline

Return the type of the private item.

Definition at line 223 of file CGOpenMPRuntime.h.

References clang::Private.

Referenced by emitAggregateType(), emitCleanups(), emitReduceInitFunction(), and needCleanups().

◆ getRefExpr()

const Expr * clang::CodeGen::ReductionCodeGen::getRefExpr ( unsigned  N) const
inline

Returns the base declaration of the reduction item.

Definition at line 218 of file CGOpenMPRuntime.h.

Referenced by emitReduceCombFunction(), emitReduceFiniFunction(), emitReduceInitFunction(), and clang::CodeGen::CGOpenMPRuntime::emitTaskReductionFixups().

◆ getSharedLValue()

LValue clang::CodeGen::ReductionCodeGen::getSharedLValue ( unsigned  N) const
inline

Returns LValue for the reduction item.

Definition at line 207 of file CGOpenMPRuntime.h.

Referenced by clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().

◆ getSizes()

std::pair< llvm::Value *, llvm::Value * > clang::CodeGen::ReductionCodeGen::getSizes ( unsigned  N) const
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 emitReduceCombFunction(), emitReduceFiniFunction(), emitReduceInitFunction(), clang::CodeGen::CGOpenMPRuntime::emitTaskReductionFixups(), and clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().

◆ needCleanups()

bool ReductionCodeGen::needCleanups ( unsigned  N)

Returns true if the private copy requires cleanups.

Definition at line 877 of file CGOpenMPRuntime.cpp.

References clang::QualType::DK_none, getPrivateType(), and clang::QualType::isDestructedType().

Referenced by emitCleanups(), and emitReduceFiniFunction().

◆ usesReductionInitializer()

bool ReductionCodeGen::usesReductionInitializer ( unsigned  N) const

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().

Referenced by emitReduceInitFunction().


The documentation for this class was generated from the following files: