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

#include <slice.hpp>

Inheritance diagram for jlm::rvsdg::BitSliceOperation:
Inheritance graph
[legend]
Collaboration diagram for jlm::rvsdg::BitSliceOperation:
Collaboration graph
[legend]

Public Member Functions

 ~BitSliceOperation () noexcept override
 
 BitSliceOperation (const std::shared_ptr< const BitType > &argument, size_t low, size_t high) noexcept
 
bool operator== (const Operation &other) const noexcept override
 
std::string debug_string () const override
 
size_t low () const noexcept
 
size_t high () const noexcept
 
std::unique_ptr< Operationcopy () const override
 
const Typeargument_type () const noexcept
 
- Public Member Functions inherited from jlm::rvsdg::UnaryOperation
 ~UnaryOperation () noexcept override
 
 UnaryOperation (std::shared_ptr< const Type > operand, std::shared_ptr< const Type > result)
 
- 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
 
bool operator!= (const Operation &other) const noexcept
 

Static Public Member Functions

static std::optional< std::vector< Output * > > normalizeIdempotent (const BitSliceOperation &operation, const std::vector< Output * > &operands)
 
static std::optional< std::vector< Output * > > distributeSlice (const BitSliceOperation &operation, const std::vector< Output * > &operands)
 
static std::optional< std::vector< Output * > > narrowSlice (const BitSliceOperation &operation, const std::vector< Output * > &operands)
 
static std::optional< std::vector< Output * > > foldConstant (const BitSliceOperation &operation, const std::vector< Output * > &operands)
 

Private Attributes

size_t low_
 

Detailed Description

Definition at line 17 of file slice.hpp.

Constructor & Destructor Documentation

◆ ~BitSliceOperation()

jlm::rvsdg::BitSliceOperation::~BitSliceOperation ( )
overridedefaultnoexcept

◆ BitSliceOperation()

jlm::rvsdg::BitSliceOperation::BitSliceOperation ( const std::shared_ptr< const BitType > &  argument,
size_t  low,
size_t  high 
)
inlinenoexcept

Definition at line 22 of file slice.hpp.

Member Function Documentation

◆ argument_type()

const Type & jlm::rvsdg::BitSliceOperation::argument_type ( ) const
inlinenoexcept

Definition at line 52 of file slice.hpp.

◆ copy()

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

Implements jlm::rvsdg::Operation.

Definition at line 124 of file slice.cpp.

◆ debug_string()

std::string jlm::rvsdg::BitSliceOperation::debug_string ( ) const
overridevirtual

Implements jlm::rvsdg::Operation.

Definition at line 25 of file slice.cpp.

◆ distributeSlice()

std::optional< std::vector< Output * > > jlm::rvsdg::BitSliceOperation::distributeSlice ( const BitSliceOperation operation,
const std::vector< Output * > &  operands 
)
static

Distribute a BitSliceOperation node over a BitConcatOperation node:

c = BitConcatOperation x1[8] x2[8] s = BitSliceOperation[4:12] c => s1 = BitSliceOperation[4:8] x1 s2 = BitSliceOperation[0:4] x2 s = BitConcatOperation s1 s2

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

Definition at line 87 of file slice.cpp.

◆ foldConstant()

std::optional< std::vector< Output * > > jlm::rvsdg::BitSliceOperation::foldConstant ( const BitSliceOperation operation,
const std::vector< Output * > &  operands 
)
static

Performs constant folding by statically evaluating the constant operand and replacing the operations result with the resulting constant.

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

Definition at line 48 of file slice.cpp.

◆ high()

size_t jlm::rvsdg::BitSliceOperation::high ( ) const
inlinenoexcept

Definition at line 43 of file slice.hpp.

◆ low()

size_t jlm::rvsdg::BitSliceOperation::low ( ) const
inlinenoexcept

Definition at line 37 of file slice.hpp.

◆ narrowSlice()

std::optional< std::vector< Output * > > jlm::rvsdg::BitSliceOperation::narrowSlice ( const BitSliceOperation operation,
const std::vector< Output * > &  operands 
)
static

Narrow a BitSliceOperation node preceded by another BitSliceOperation node:

b1 = BitSliceOperation[3:10] x b2 = BitSliceOperation[1:4] b1 => b2 = BitSliceOperation[4:7] x

Parameters
operationThe BitSliceOperation on which the transformation is performed.
operandsThe operands of the BitSliceOperation node.
Returns
If the narrowing could be applied, then the operand of the BitSliceOperation node. Otherwise, std::nullopt.

Definition at line 67 of file slice.cpp.

◆ normalizeIdempotent()

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

Removes the BitSliceOperation if its slicing boundaries align with the size of the operand, i.e., low == 0 and high = numBits.

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

Definition at line 31 of file slice.cpp.

◆ operator==()

bool jlm::rvsdg::BitSliceOperation::operator== ( const Operation other) const
overridevirtualnoexcept

Implements jlm::rvsdg::Operation.

Definition at line 18 of file slice.cpp.

Member Data Documentation

◆ low_

size_t jlm::rvsdg::BitSliceOperation::low_
private

Definition at line 120 of file slice.hpp.


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