class ReductionCodeGen

Declaration

class ReductionCodeGen { /* full declaration omitted */ };

Description

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

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:127

Member Variables

private SmallVector<clang::CodeGen::ReductionCodeGen:: ReductionData, 4> ClausesData
List of reduction-based clauses.
private SmallVector<std::pair<LValue, LValue>, 4> SharedAddresses
List of addresses of shared variables/expressions.
private SmallVector<std::pair<LValue, LValue>, 4> OrigAddresses
List of addresses of original variables/expressions.
private SmallVector<std::pair<llvm::Value*, llvm::Value*>, 4> Sizes
Sizes of the reduction items in chars.
private SmallVector<const clang::VarDecl*, 4> BaseDecls
Base declarations for the reduction items.

Method Overview

  • public ReductionCodeGen(ArrayRef<const clang::Expr *> Shareds, ArrayRef<const clang::Expr *> Origs, ArrayRef<const clang::Expr *> Privates, ArrayRef<const clang::Expr *> ReductionOps)
  • public clang::CodeGen::Address adjustPrivateAddress(clang::CodeGen::CodeGenFunction & CGF, unsigned int N, clang::CodeGen::Address PrivateAddr)
  • private void emitAggregateInitialization(clang::CodeGen::CodeGenFunction & CGF, unsigned int N, clang::CodeGen::Address PrivateAddr, clang::CodeGen::Address SharedAddr, const clang::OMPDeclareReductionDecl * DRD)
  • public void emitAggregateType(clang::CodeGen::CodeGenFunction & CGF, unsigned int N)
  • public void emitAggregateType(clang::CodeGen::CodeGenFunction & CGF, unsigned int N, llvm::Value * Size)
  • public void emitCleanups(clang::CodeGen::CodeGenFunction & CGF, unsigned int N, clang::CodeGen::Address PrivateAddr)
  • public void emitInitialization(clang::CodeGen::CodeGenFunction & CGF, unsigned int N, clang::CodeGen::Address PrivateAddr, clang::CodeGen::Address SharedAddr, llvm::function_ref<bool (CodeGenFunction &)> DefaultInit)
  • private clang::CodeGen::LValue emitSharedLValue(clang::CodeGen::CodeGenFunction & CGF, const clang::Expr * E)
  • private clang::CodeGen::LValue emitSharedLValueUB(clang::CodeGen::CodeGenFunction & CGF, const clang::Expr * E)
  • public void emitSharedOrigLValue(clang::CodeGen::CodeGenFunction & CGF, unsigned int N)
  • public const clang::VarDecl * getBaseDecl(unsigned int N) const
  • public clang::CodeGen::LValue getOrigLValue(unsigned int N) const
  • public clang::QualType getPrivateType(unsigned int N) const
  • public const clang::Expr * getRefExpr(unsigned int N) const
  • public clang::CodeGen::LValue getSharedLValue(unsigned int N) const
  • public std::pair<llvm::Value *, llvm::Value *> getSizes(unsigned int N) const
  • public bool needCleanups(unsigned int N)
  • public bool usesReductionInitializer(unsigned int N) const

Methods

ReductionCodeGen(
    ArrayRef<const clang::Expr*> Shareds,
    ArrayRef<const clang::Expr*> Origs,
    ArrayRef<const clang::Expr*> Privates,
    ArrayRef<const clang::Expr*> ReductionOps)

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:170

Parameters

ArrayRef<const clang::Expr*> Shareds
ArrayRef<const clang::Expr*> Origs
ArrayRef<const clang::Expr*> Privates
ArrayRef<const clang::Expr*> ReductionOps

clang::CodeGen::Address adjustPrivateAddress(
    clang::CodeGen::CodeGenFunction& CGF,
    unsigned int N,
    clang::CodeGen::Address PrivateAddr)

Description

Adjusts \p PrivatedAddr for using instead of the original variable address in normal operations.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:203

Parameters

clang::CodeGen::CodeGenFunction& CGF
unsigned int N
Number of the reduction item.
clang::CodeGen::Address PrivateAddr
Address of the corresponding private item.

void emitAggregateInitialization(
    clang::CodeGen::CodeGenFunction& CGF,
    unsigned int N,
    clang::CodeGen::Address PrivateAddr,
    clang::CodeGen::Address SharedAddr,
    const clang::OMPDeclareReductionDecl* DRD)

Description

Performs aggregate initialization.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:165

Parameters

clang::CodeGen::CodeGenFunction& CGF
unsigned int N
Number of reduction item in the common list.
clang::CodeGen::Address PrivateAddr
Address of the corresponding private item.
clang::CodeGen::Address SharedAddr
Address of the original shared variable.
const clang::OMPDeclareReductionDecl* DRD
Declare reduction construct used for reduction item.

void emitAggregateType(
    clang::CodeGen::CodeGenFunction& CGF,
    unsigned int N)

Description

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

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:178

Parameters

clang::CodeGen::CodeGenFunction& CGF
unsigned int N
Number of the reduction item.

void emitAggregateType(
    clang::CodeGen::CodeGenFunction& CGF,
    unsigned int N,
    llvm::Value* Size)

Description

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

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:182

Parameters

clang::CodeGen::CodeGenFunction& CGF
unsigned int N
Number of the reduction item.
llvm::Value* Size
Size of the type in chars.

void emitCleanups(
    clang::CodeGen::CodeGenFunction& CGF,
    unsigned int N,
    clang::CodeGen::Address PrivateAddr)

Description

Emits cleanup code for the reduction item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:198

Parameters

clang::CodeGen::CodeGenFunction& CGF
unsigned int N
Number of the reduction item.
clang::CodeGen::Address PrivateAddr
Address of the corresponding private item.

void emitInitialization(
    clang::CodeGen::CodeGenFunction& CGF,
    unsigned int N,
    clang::CodeGen::Address PrivateAddr,
    clang::CodeGen::Address SharedAddr,
    llvm::function_ref<bool(CodeGenFunction&)>
        DefaultInit)

Description

Performs initialization of the private copy for the reduction item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:190

Parameters

clang::CodeGen::CodeGenFunction& CGF
unsigned int N
Number of the reduction item.
clang::CodeGen::Address PrivateAddr
Address of the corresponding private item.
clang::CodeGen::Address SharedAddr
Address of the original shared variable.
llvm::function_ref<bool(CodeGenFunction&)> DefaultInit
Default initialization sequence that should be performed if no reduction specific initialization is found.

clang::CodeGen::LValue emitSharedLValue(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::Expr* E)

Description

Emits lvalue for shared expression.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:157

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::Expr* E

clang::CodeGen::LValue emitSharedLValueUB(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::Expr* E)

Description

Emits upper bound for shared expression (if array section).

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:159

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::Expr* E

void emitSharedOrigLValue(
    clang::CodeGen::CodeGenFunction& CGF,
    unsigned int N)

Description

Emits lvalue for the shared and original reduction item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:175

Parameters

clang::CodeGen::CodeGenFunction& CGF
unsigned int N
Number of the reduction item.

const clang::VarDecl* getBaseDecl(
    unsigned int N) const

Description

Returns the base declaration of the reduction item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:215

Parameters

unsigned int N

clang::CodeGen::LValue getOrigLValue(
    unsigned int N) const

Description

Returns LValue for the original reduction item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:208

Parameters

unsigned int N

clang::QualType getPrivateType(
    unsigned int N) const

Description

Return the type of the private item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:222

Parameters

unsigned int N

const clang::Expr* getRefExpr(
    unsigned int N) const

Description

Returns the base declaration of the reduction item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:217

Parameters

unsigned int N

clang::CodeGen::LValue getSharedLValue(
    unsigned int N) const

Description

Returns LValue for the reduction item.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:206

Parameters

unsigned int N

std::pair<llvm::Value*, llvm::Value*> getSizes(
    unsigned int N) const

Description

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.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:211

Parameters

unsigned int N

bool needCleanups(unsigned int N)

Description

Returns true if the private copy requires cleanups.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:194

Parameters

unsigned int N

bool usesReductionInitializer(
    unsigned int N) const

Description

Returns true if the initialization of the reduction item uses initializer from declare reduction construct.

Declared at: clang/lib/CodeGen/CGOpenMPRuntime.h:220

Parameters

unsigned int N