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 >> &offsetTypes, 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::unique_ptr< llvm::ThreeAddressCodeCreate (const Variable *baseAddress, const std::vector< const Variable * > &offsets, std::shared_ptr< const rvsdg::Type > pointeeType, std::shared_ptr< const rvsdg::Type > resultType)
 
static rvsdg::OutputCreate (rvsdg::Output *baseAddress, const std::vector< rvsdg::Output * > &offsets, std::shared_ptr< const rvsdg::Type > pointeeType, std::shared_ptr< const rvsdg::Type > resultType)
 

Static Private Member Functions

static void CheckPointerType (const rvsdg::Type &type)
 
template<class T >
static std::vector< std::shared_ptr< const rvsdg::BitType > > CheckAndExtractOffsetTypes (const std::vector< T * > &offsets)
 
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

This operation is the equivalent of LLVM's getelementptr instruction.

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

Definition at line 23 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 >> &  offsetTypes,
std::shared_ptr< const rvsdg::Type pointeeType 
)
inline

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

◆ CheckAndExtractOffsetTypes()

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

Definition at line 132 of file GetElementPtr.hpp.

◆ CheckPointerType()

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

Definition at line 122 of file GetElementPtr.hpp.

◆ copy()

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

Implements jlm::rvsdg::Operation.

Definition at line 42 of file GetElementPtr.cpp.

◆ Create() [1/2]

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

Creates a GetElementPtr three address code.

FIXME: We should not explicitly hand in the resultType parameter, but rather compute it from the pointeeType and the offsets. See LLVM's GetElementPtr instruction for reference.

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

Definition at line 69 of file GetElementPtr.hpp.

◆ Create() [2/2]

static rvsdg::Output* jlm::llvm::GetElementPtrOperation::Create ( rvsdg::Output baseAddress,
const std::vector< rvsdg::Output * > &  offsets,
std::shared_ptr< const rvsdg::Type pointeeType,
std::shared_ptr< const rvsdg::Type resultType 
)
inlinestatic

Creates a GetElementPtr RVSDG node.

FIXME: We should not explicitly hand in the resultType parameter, but rather compute it from the pointeeType and the offsets. See LLVM's GetElementPtr instruction for reference.

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

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

◆ debug_string()

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

Implements jlm::rvsdg::Operation.

Definition at line 36 of file GetElementPtr.cpp.

◆ GetPointeeType()

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

Definition at line 50 of file GetElementPtr.hpp.

◆ operator==()

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

Definition at line 14 of file GetElementPtr.cpp.

Member Data Documentation

◆ PointeeType_

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

Definition at line 158 of file GetElementPtr.hpp.


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