Jlm
Public Member Functions | Static Public 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]

Public Member Functions

 ~GetElementPtrOperation () noexcept override
 
 GetElementPtrOperation (const std::vector< std::shared_ptr< const rvsdg::BitType >> &indexTypes, std::shared_ptr< const rvsdg::Type > pointeeType)
 
 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
 
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< std::vector< uint64_t > > tryGetConstantIndices (const rvsdg::Node &node) noexcept
 
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 > pointeeType)
 
static rvsdg::SimpleNodecreateNode (rvsdg::Output &baseAddress, const std::vector< rvsdg::Output * > &indices, std::shared_ptr< const rvsdg::Type > pointeeType)
 
static rvsdg::Outputcreate (rvsdg::Output *baseAddress, const std::vector< rvsdg::Output * > &indices, std::shared_ptr< const rvsdg::Type > pointeeType)
 

Static Private Member Functions

static void checkPointerType (const rvsdg::Type &type)
 
template<class T >
static std::vector< std::shared_ptr< const rvsdg::BitType > > checkAndExtractIndexTypes (const std::vector< T * > &indices)
 
static std::vector< std::shared_ptr< const rvsdg::Type > > createOperandTypes (const std::vector< std::shared_ptr< const rvsdg::BitType >> &indexTypes)
 

Private Attributes

std::shared_ptr< const rvsdg::TypepointeeType_
 

Detailed Description

Represents LLVM's getelementptr instruction.

See LLVM Language Reference Manual for more details.

FIXME: We currently do not support vector of pointers for the baseAddress.

FIXME: We should type check that pointeeType and the number/types of indices fit together.

Definition at line 28 of file GetElementPtr.hpp.

Constructor & Destructor Documentation

◆ ~GetElementPtrOperation()

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

◆ GetElementPtrOperation() [1/3]

jlm::llvm::GetElementPtrOperation::GetElementPtrOperation ( const std::vector< std::shared_ptr< const rvsdg::BitType >> &  indexTypes,
std::shared_ptr< const rvsdg::Type pointeeType 
)
inline

Definition at line 33 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

◆ checkAndExtractIndexTypes()

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

Definition at line 215 of file GetElementPtr.hpp.

◆ checkPointerType()

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

Definition at line 205 of file GetElementPtr.hpp.

◆ copy()

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

Implements jlm::rvsdg::Operation.

Definition at line 43 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 pointeeType 
)
inlinestatic

Creates a GetElementPtr RVSDG node.

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

Definition at line 195 of file GetElementPtr.hpp.

◆ createNode()

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

Creates a GetElementPtr RVSDG node.

Parameters
baseAddressThe base address for the pointer calculation.
indicesThe offsets from the base address.
pointeeTypeThe type the base address points to.
Returns
The created GetElementPtr RVSDG node.

Definition at line 168 of file GetElementPtr.hpp.

◆ createOperandTypes()

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

Definition at line 233 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 pointeeType 
)
inlinestatic

Creates a GetElementPtr three address code.

Parameters
baseAddressThe base address for the pointer calculation.
offsetsThe offsets from the base address.
pointeeTypeThe type the base address points to.
Returns
A getElementPtr three address code.

Definition at line 143 of file GetElementPtr.hpp.

◆ debug_string()

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

Implements jlm::rvsdg::Operation.

Definition at line 37 of file GetElementPtr.cpp.

◆ 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 125 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 108 of file GetElementPtr.hpp.

◆ getPointeeType()

const rvsdg::Type& jlm::llvm::GetElementPtrOperation::getPointeeType ( ) const
inlinenoexcept

Definition at line 54 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 77 of file GetElementPtr.hpp.

◆ 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 93 of file GetElementPtr.hpp.

◆ operator==()

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

Definition at line 15 of file GetElementPtr.cpp.

◆ tryGetConstantIndices()

std::optional< std::vector< uint64_t > > jlm::llvm::GetElementPtrOperation::tryGetConstantIndices ( const rvsdg::Node node)
staticnoexcept

Attempts to find the constant indices of a GetElementPtrOperation node.

Parameters
nodeThe GetElementPtrOperation node.
Returns
The constant indices if all of them are found to be constant, otherwise std::nullopt.

Definition at line 49 of file GetElementPtr.cpp.

Member Data Documentation

◆ pointeeType_

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

Definition at line 241 of file GetElementPtr.hpp.


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