clang  15.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. 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 VarDeclgetBaseDecl (unsigned N) const
 Returns the base declaration of the reduction item. More...
 
const ExprgetRefExpr (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...
 

Detailed Description

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

Definition at line 127 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 792 of file CGOpenMPRuntime.cpp.

References advance().

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 
)

Emits the code for the variable-modified type, if required.

Parameters
NNumber of the reduction item.
SizeSize of the type in chars.

Definition at line 860 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().

◆ 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 908 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateElementBitCast(), clang::QualType::isDestructedType(), and clang::CodeGen::CodeGenFunction::pushDestroy().

◆ 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 877 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(), and clang::CodeGen::CodeGenFunction::isTrivialInitializer().

Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit().

◆ 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 811 of file CGOpenMPRuntime.cpp.

References clang::First.

Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit(), 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 215 of file CGOpenMPRuntime.h.

Referenced by clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit().

◆ getOrigLValue()

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

Returns LValue for the original reduction item.

Definition at line 208 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 222 of file CGOpenMPRuntime.h.

◆ getRefExpr()

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

Returns the base declaration of the reduction item.

Definition at line 217 of file CGOpenMPRuntime.h.

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

◆ getSharedLValue()

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

◆ 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 211 of file CGOpenMPRuntime.h.

Referenced by 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 902 of file CGOpenMPRuntime.cpp.

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

Referenced by 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 1015 of file CGOpenMPRuntime.cpp.

References clang::OMPDeclareReductionDecl::getInitializer(), and getReductionInit().


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