Jlm
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
jlm::llvm::GetElementPtrOperation Class Referencefinal

#include <GetElementPtr.hpp>

Inheritance diagram for jlm::llvm::GetElementPtrOperation:
Inheritance graph
[legend]
Collaboration diagram for jlm::llvm::GetElementPtrOperation:
Collaboration graph
[legend]

Classes

struct  Constant
 

Public Member Functions

 ~GetElementPtrOperation () noexcept override
 
 GetElementPtrOperation (const GetElementPtrOperation &other)=default
 
 GetElementPtrOperation (GetElementPtrOperation &&other) noexcept=default
 
bool operator== (const Operation &other) const noexcept override
 
std::string debug_string () const override
 
std::unique_ptr< Operation > copy () const override
 
std::shared_ptr< const rvsdg::TypegetPointeeType () const noexcept
 
- Public Member Functions inherited from jlm::rvsdg::SimpleOperation
 ~SimpleOperation () noexcept override
 
 SimpleOperation (std::vector< std::shared_ptr< const jlm::rvsdg::Type > > operands, std::vector< std::shared_ptr< const jlm::rvsdg::Type > > results)
 
size_t narguments () const noexcept
 
const std::shared_ptr< const rvsdg::Type > & argument (size_t index) const noexcept
 
size_t nresults () const noexcept
 
const std::shared_ptr< const rvsdg::Type > & result (size_t index) const noexcept
 
- Public Member Functions inherited from jlm::rvsdg::Operation
virtual ~Operation () noexcept
 
virtual bool operator== (const Operation &other) const noexcept=0
 
bool operator!= (const Operation &other) const noexcept
 

Static Public Member Functions

static std::optional< ConstanttryGetAsConstant (const rvsdg::SimpleNode &gepNode)
 
static rvsdg::Node::InputConstIteratorRange indices (const rvsdg::Node &node) noexcept
 
static size_t numIndices (const rvsdg::Node &node) noexcept
 
static rvsdg::InputgetBaseAddressInput (rvsdg::Node &node)
 
static const rvsdg::InputgetBaseAddressInput (const rvsdg::Node &node)
 
static std::unique_ptr< ThreeAddressCodecreateTAC (const Variable *baseAddress, const std::vector< const Variable * > &offsets, std::shared_ptr< const rvsdg::Type > gepType)
 
static std::unique_ptr< GetElementPtrOperationcreateOperation (const std::shared_ptr< const rvsdg::Type > &baseAddressType, const std::vector< std::shared_ptr< const rvsdg::Type > > &indexTypes, const std::shared_ptr< const rvsdg::Type > &gepType)
 
static rvsdg::SimpleNodecreateNode (rvsdg::Output &baseAddress, const std::vector< rvsdg::Output * > &indices, const std::shared_ptr< const rvsdg::Type > &gepType)
 
static rvsdg::Outputcreate (rvsdg::Output *baseAddress, const std::vector< rvsdg::Output * > &indices, std::shared_ptr< const rvsdg::Type > gepType)
 
static std::optional< std::vector< rvsdg::Output * > > normalizeIdempotent (const GetElementPtrOperation &operation, const std::vector< rvsdg::Output * > &operands)
 

Private Member Functions

 GetElementPtrOperation (const std::shared_ptr< const rvsdg::Type > &baseAddressType, const std::vector< std::shared_ptr< const rvsdg::Type > > &indexTypes, std::shared_ptr< const rvsdg::Type > gepType, std::shared_ptr< const rvsdg::Type > resultType)
 

Static Private Member Functions

static std::shared_ptr< const rvsdg::TypegetIndexedType (const std::shared_ptr< const rvsdg::Type > &gepType, const std::vector< rvsdg::Output * > &indices)
 
static void checkIndexedType (const std::shared_ptr< const rvsdg::Type > &gepType, const std::vector< rvsdg::Output * > &indices)
 
static void checkBaseAddressType (const rvsdg::Type &type)
 
static void checkIndexTypes (const std::vector< std::shared_ptr< const rvsdg::Type > > &indexTypes)
 
static std::shared_ptr< const rvsdg::TypegetResultType (const std::shared_ptr< const rvsdg::Type > &baseAddressType, const std::vector< std::shared_ptr< const rvsdg::Type > > &indexTypes)
 
template<class T >
static std::vector< std::shared_ptr< const rvsdg::Type > > extractIndexTypes (const std::vector< T * > &indices)
 
static std::vector< std::shared_ptr< const rvsdg::Type > > createOperandTypes (std::shared_ptr< const rvsdg::Type > baseAddressType, const std::vector< std::shared_ptr< const rvsdg::Type > > &indexTypes)
 

Private Attributes

std::shared_ptr< const rvsdg::TypegepType_
 

Detailed Description

Represents LLVM's getelementptr instruction.

See LLVM Language Reference Manual for more details.

Definition at line 24 of file GetElementPtr.hpp.

Constructor & Destructor Documentation

◆ ~GetElementPtrOperation()

jlm::llvm::GetElementPtrOperation::~GetElementPtrOperation ( )
overridedefaultnoexcept

◆ GetElementPtrOperation() [1/3]

jlm::llvm::GetElementPtrOperation::GetElementPtrOperation ( const std::shared_ptr< const rvsdg::Type > &  baseAddressType,
const std::vector< std::shared_ptr< const rvsdg::Type > > &  indexTypes,
std::shared_ptr< const rvsdg::Type gepType,
std::shared_ptr< const rvsdg::Type resultType 
)
inlineprivate

Definition at line 30 of file GetElementPtr.hpp.

◆ GetElementPtrOperation() [2/3]

jlm::llvm::GetElementPtrOperation::GetElementPtrOperation ( const GetElementPtrOperation other)
default

◆ GetElementPtrOperation() [3/3]

jlm::llvm::GetElementPtrOperation::GetElementPtrOperation ( GetElementPtrOperation &&  other)
defaultnoexcept

Member Function Documentation

◆ checkBaseAddressType()

static void jlm::llvm::GetElementPtrOperation::checkBaseAddressType ( const rvsdg::Type type)
inlinestaticprivate

Definition at line 273 of file GetElementPtr.hpp.

◆ checkIndexedType()

static void jlm::llvm::GetElementPtrOperation::checkIndexedType ( const std::shared_ptr< const rvsdg::Type > &  gepType,
const std::vector< rvsdg::Output * > &  indices 
)
inlinestaticprivate

Definition at line 261 of file GetElementPtr.hpp.

◆ checkIndexTypes()

static void jlm::llvm::GetElementPtrOperation::checkIndexTypes ( const std::vector< std::shared_ptr< const rvsdg::Type > > &  indexTypes)
inlinestaticprivate

Definition at line 286 of file GetElementPtr.hpp.

◆ copy()

std::unique_ptr< rvsdg::Operation > jlm::llvm::GetElementPtrOperation::copy ( ) const
overridevirtual

Implements jlm::rvsdg::Operation.

Definition at line 44 of file GetElementPtr.cpp.

◆ create()

static rvsdg::Output * jlm::llvm::GetElementPtrOperation::create ( rvsdg::Output baseAddress,
const std::vector< rvsdg::Output * > &  indices,
std::shared_ptr< const rvsdg::Type gepType 
)
inlinestatic

Creates a GetElementPtr RVSDG node.

Parameters
baseAddressThe base address for the pointer calculation.
indicesThe offsets from the base address.
gepTypeThe type used for address calculation.
Returns
The output of the created GetElementPtr RVSDG node.

Definition at line 231 of file GetElementPtr.hpp.

◆ createNode()

static rvsdg::SimpleNode & jlm::llvm::GetElementPtrOperation::createNode ( rvsdg::Output baseAddress,
const std::vector< rvsdg::Output * > &  indices,
const std::shared_ptr< const rvsdg::Type > &  gepType 
)
inlinestatic

Creates a GetElementPtr RVSDG node.

Parameters
baseAddressThe base address for the pointer calculation.
indicesThe offsets from the base address.
gepTypeThe type used for address calculation.
Returns
The created GetElementPtr RVSDG node.

Definition at line 204 of file GetElementPtr.hpp.

◆ createOperandTypes()

static std::vector< std::shared_ptr< const rvsdg::Type > > jlm::llvm::GetElementPtrOperation::createOperandTypes ( std::shared_ptr< const rvsdg::Type baseAddressType,
const std::vector< std::shared_ptr< const rvsdg::Type > > &  indexTypes 
)
inlinestaticprivate

Definition at line 347 of file GetElementPtr.hpp.

◆ createOperation()

static std::unique_ptr< GetElementPtrOperation > jlm::llvm::GetElementPtrOperation::createOperation ( const std::shared_ptr< const rvsdg::Type > &  baseAddressType,
const std::vector< std::shared_ptr< const rvsdg::Type > > &  indexTypes,
const std::shared_ptr< const rvsdg::Type > &  gepType 
)
inlinestatic

Definition at line 175 of file GetElementPtr.hpp.

◆ createTAC()

static std::unique_ptr< ThreeAddressCode > jlm::llvm::GetElementPtrOperation::createTAC ( const Variable baseAddress,
const std::vector< const Variable * > &  offsets,
std::shared_ptr< const rvsdg::Type gepType 
)
inlinestatic

Creates a GetElementPtr three address code.

Parameters
baseAddressThe base address for the pointer calculation.
offsetsThe offsets from the base address.
gepTypeThe type used for address calculation.
Returns
A getElementPtr three address code.

Definition at line 159 of file GetElementPtr.hpp.

◆ debug_string()

std::string jlm::llvm::GetElementPtrOperation::debug_string ( ) const
overridevirtual

Implements jlm::rvsdg::Operation.

Definition at line 38 of file GetElementPtr.cpp.

◆ extractIndexTypes()

template<class T >
static std::vector< std::shared_ptr< const rvsdg::Type > > jlm::llvm::GetElementPtrOperation::extractIndexTypes ( const std::vector< T * > &  indices)
inlinestaticprivate

Definition at line 335 of file GetElementPtr.hpp.

◆ getBaseAddressInput() [1/2]

static const rvsdg::Input & jlm::llvm::GetElementPtrOperation::getBaseAddressInput ( const rvsdg::Node node)
inlinestatic

Returns the base address input of a GetElementPtrOperation node.

Precondition
node must be a GetElementPtrOperation
Parameters
nodeThe GetElementPtrOperation node.
Returns
The base address on which the address calculation is performed.

Definition at line 141 of file GetElementPtr.hpp.

◆ getBaseAddressInput() [2/2]

static rvsdg::Input & jlm::llvm::GetElementPtrOperation::getBaseAddressInput ( rvsdg::Node node)
inlinestatic

Returns the base address input of a GetElementPtrOperation node.

Precondition
node must be a GetElementPtrOperation.
Parameters
nodeThe GetElementPtrOperation node.
Returns
The base address on which the address calculation is performed.

Definition at line 124 of file GetElementPtr.hpp.

◆ getIndexedType()

std::shared_ptr< const rvsdg::Type > jlm::llvm::GetElementPtrOperation::getIndexedType ( const std::shared_ptr< const rvsdg::Type > &  gepType,
const std::vector< rvsdg::Output * > &  indices 
)
staticprivate

Definition at line 110 of file GetElementPtr.cpp.

◆ getPointeeType()

std::shared_ptr< const rvsdg::Type > jlm::llvm::GetElementPtrOperation::getPointeeType ( ) const
inlinenoexcept

Definition at line 54 of file GetElementPtr.hpp.

◆ getResultType()

static std::shared_ptr< const rvsdg::Type > jlm::llvm::GetElementPtrOperation::getResultType ( const std::shared_ptr< const rvsdg::Type > &  baseAddressType,
const std::vector< std::shared_ptr< const rvsdg::Type > > &  indexTypes 
)
inlinestaticprivate

Definition at line 298 of file GetElementPtr.hpp.

◆ indices()

static rvsdg::Node::InputConstIteratorRange jlm::llvm::GetElementPtrOperation::indices ( const rvsdg::Node node)
inlinestaticnoexcept

Returns an iterator range to the indices of a GetElementPtrOperation node.

Precondition
node is expected to have a GetElementPtrOperation.
Parameters
nodeA GetElementPtrOperation node.
Returns
An iterator range for all the indices.

Definition at line 93 of file GetElementPtr.hpp.

◆ normalizeIdempotent()

std::optional< std::vector< rvsdg::Output * > > jlm::llvm::GetElementPtrOperation::normalizeIdempotent ( const GetElementPtrOperation operation,
const std::vector< rvsdg::Output * > &  operands 
)
static

Removes all GetElementPtrOperation nodes that either have no index operands or where all indices are constant zero.

Parameters
operationThe GetElementPtrOperation on which the transformation is performed.
operandsThe operands of the GetElementPtrOperation node.
Returns
If the normalization could be applied, then the results of the GetElementPtrOperation after the transformation. Otherwise, std::nullopt.

Definition at line 160 of file GetElementPtr.cpp.

◆ numIndices()

static size_t jlm::llvm::GetElementPtrOperation::numIndices ( const rvsdg::Node node)
inlinestaticnoexcept
Precondition
node must be a GetElementPtrOperation
Parameters
nodeThe GetElementPtrOperation node.
Returns
The number of indices of the node.

Definition at line 109 of file GetElementPtr.hpp.

◆ operator==()

bool jlm::llvm::GetElementPtrOperation::operator== ( const Operation &  other) const
overridenoexcept

Definition at line 16 of file GetElementPtr.cpp.

◆ tryGetAsConstant()

std::optional< GetElementPtrOperation::Constant > jlm::llvm::GetElementPtrOperation::tryGetAsConstant ( const rvsdg::SimpleNode gepNode)
static

Attempts to return the GetElementPtrOperation as a GetElementPtrOperation::Constant.

Parameters
gepNodeA GetElementPtrOperation node
Returns
If all indices are statically known, then a GetElementPtrOperation::Constant is returned, otherwise std::nullopt.

Definition at line 50 of file GetElementPtr.cpp.

Member Data Documentation

◆ gepType_

std::shared_ptr<const rvsdg::Type> jlm::llvm::GetElementPtrOperation::gepType_
private

Definition at line 357 of file GetElementPtr.hpp.


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