Skip to content

TargetRegionVariable

Represents a variable captured by a target region. More...

#include <TargetRegionVariable.h>

Public Classes

Name
class shape_const_kind_iterator
Iterator which acts as a filter over std::vector::const_iterator (the base_iter) which only passes on TargetRegionVariableShape of the kind specified in Kind.

Public Types

Name
using std::vector< TargetRegionVariableShape >::const_iterator shape_const_iterator
Iterator of all shapes of this variable.
using llvm::iterator_range< shape_const_iterator > shape_const_range
Range over all shapes of this variable.
using llvm::iterator_range< shape_const_kind_iterator > shape_const_kind_range
Range over all shapes of a certain kind of this variable.

Public Functions

Name
llvm::StringRef name() const
The name of the variable.
llvm::StringRef baseTypeName() const
The name of the base type (stripped of all qualifiers).
clang::VarDecl * getDecl() const
The Decl node of the variable.
bool containsArray() const
Whether this variable's type contains an array or not.
bool containsPointer() const
Whether this variable's type contains a pointer or not.
bool passedByPointer() const
Returns true if this variable is passed by pointer.
llvm::Optional< clang::Expr * > arrayLowerBound() const
The lower bound of an array slice in the first dimension.
bool operator==(const TargetRegionVariable & Other) const
shape_const_range shapes() const
Gives a range over the shape of all dimensions.
shape_const_kind_range variableArrayShapes() const
Gives a range over those shape dimensions which are variable arrays.
TargetRegionVariable(const clang::CapturedStmt::Capture * Capture, const std::map< clang::VarDecl *, clang::Expr * > & MappingLowerBounds)
Construct a new Target Region Variable:: Target Region Variable object.

Private Functions

Name
void determineShapes(clang::QualType T)
Determine variable shape.

Private Attributes

Name
const clang::CapturedStmt::Capture * Capture
clang::VarDecl * Decl
std::string VarName
std::string BaseTypeName
This is the base type name, i.e.
std::vector< TargetRegionVariableShape > Shapes
unsigned int NumVariableArrayDims
const std::map< clang::VarDecl *, clang::Expr * > & OmpMappingLowerBound

Detailed Description

1
class TargetRegionVariable;

Represents a variable captured by a target region.

This class is an abstraction that provides information on how the variable is passed to the target region, whether it is a slice or array and how it's dimensionality is declared

Public Types Documentation

using shape_const_iterator

1
using TargetRegionVariable::shape_const_iterator =  std::vector<TargetRegionVariableShape>::const_iterator;

Iterator of all shapes of this variable.

using shape_const_range

1
using TargetRegionVariable::shape_const_range =  llvm::iterator_range<shape_const_iterator>;

Range over all shapes of this variable.

using shape_const_kind_range

1
using TargetRegionVariable::shape_const_kind_range =  llvm::iterator_range<shape_const_kind_iterator>;

Range over all shapes of a certain kind of this variable.

Public Functions Documentation

function name

1
inline llvm::StringRef name() const

The name of the variable.

function baseTypeName

1
inline llvm::StringRef baseTypeName() const

The name of the base type (stripped of all qualifiers).

function getDecl

1
inline clang::VarDecl * getDecl() const

The Decl node of the variable.

function containsArray

1
bool containsArray() const

Whether this variable's type contains an array or not.

Return: true if an array is contained, false otherwise

Check if the shape of a TargetRegionVariable contains an array.

function containsPointer

1
bool containsPointer() const

Whether this variable's type contains a pointer or not.

Return: true if a pointer is contained, false otherwise

Check if the shape of a TargetRegionVariable contains an pointer.

function passedByPointer

1
bool passedByPointer() const

Returns true if this variable is passed by pointer.

Return: true If a variable is passed by pointer

false If a variable is not passed by pointer

Determines whether a variable is passed by pointer.

This is the case for shared and first-private variables scalars and for arrays. Note that pointer types are generally passed by value and we do not generate an additional * for it.

function arrayLowerBound

1
llvm::Optional< clang::Expr * > arrayLowerBound() const

The lower bound of an array slice in the first dimension.

Return: llvm::Optional Lower bound

Finds the lower bound of an array.

All other dimension can be ignored because libomptarget only transfers continuous data. In case of a scalar (or an array which is mapped completly in the first dimension) this returns 0.

function operator==

1
2
3
inline bool operator==(
    const TargetRegionVariable & Other
) const

function shapes

1
inline shape_const_range shapes() const

Gives a range over the shape of all dimensions.

function variableArrayShapes

1
inline shape_const_kind_range variableArrayShapes() const

Gives a range over those shape dimensions which are variable arrays.

This is called while generating the functions argument for variable array sizes.

function TargetRegionVariable

1
2
3
4
TargetRegionVariable(
    const clang::CapturedStmt::Capture * Capture,
    const std::map< clang::VarDecl *, clang::Expr * > & MappingLowerBounds
)

Construct a new Target Region Variable:: Target Region Variable object.

Parameters:

  • Capture
  • MappingLowerBounds

Private Functions Documentation

function determineShapes

1
2
3
void determineShapes(
    clang::QualType T
)

Determine variable shape.

Parameters:

  • T Type

Determines the shape of a varable by resolving its type.

Private Attributes Documentation

variable Capture

1
const clang::CapturedStmt::Capture * Capture;

variable Decl

1
clang::VarDecl * Decl;

variable VarName

1
std::string VarName;

variable BaseTypeName

1
std::string BaseTypeName;

This is the base type name, i.e.

the name of the type without pointer or array qualifiers.

variable Shapes

1
std::vector< TargetRegionVariableShape > Shapes;

variable NumVariableArrayDims

1
unsigned int NumVariableArrayDims;

variable OmpMappingLowerBound

1
const std::map< clang::VarDecl *, clang::Expr * > & OmpMappingLowerBound;

Last update: 2021-11-24
Back to top