Jlm
Public Member Functions | Static Public Member Functions | List of all members
jlm::llvm::IOBarrierOperation Class Referencefinal

#include <IOBarrier.hpp>

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

Public Member Functions

 ~IOBarrierOperation () noexcept override
 
 IOBarrierOperation (const std::shared_ptr< const rvsdg::Type > &type)
 
const std::shared_ptr< const rvsdg::Type > & Type () const noexcept
 
bool operator== (const Operation &other) const noexcept override
 
std::string debug_string () const override
 
std::unique_ptr< Operation > copy () const override
 
- 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 rvsdg::InputBarredInput (const rvsdg::SimpleNode &node) noexcept
 
static rvsdg::SimpleNodecreateNode (rvsdg::Output &value, rvsdg::Output &ioState)
 

Detailed Description

An IOBarrier operation is used to sequentialize other operations after other IO state operations. It has no equivalent in LLVM.

Example:

int f(int x)
{
opaque(); //calls internally exit(0)
return x / 0;
}

The above code is valid C code and not undefined even though there is a division by zero present. The reason for this is that the function opaque() invokes exit(0), and the division by zero is never performed at runtime. In the RVSDG, the division operation has no dependency on the function call to opaque() and therefore it can happen that it is sequentialized before the call operation, transforming the valid program to an undefined program.

The IOBarrier operation ensures a sequentialization of these two operations by routing one of the division operands through it along with an I/O state as additional operand. The division operation consumes then the result value of the IOBarrier operation, effectively seuqentializing the division after the barrier and with that after the call operation:

... io = Call opaque .... xo = IOBarrier x io ... = ISDiv xo 0

Definition at line 45 of file IOBarrier.hpp.

Constructor & Destructor Documentation

◆ ~IOBarrierOperation()

jlm::llvm::IOBarrierOperation::~IOBarrierOperation ( )
overridedefaultnoexcept

◆ IOBarrierOperation()

jlm::llvm::IOBarrierOperation::IOBarrierOperation ( const std::shared_ptr< const rvsdg::Type > &  type)
inlineexplicit

Definition at line 50 of file IOBarrier.hpp.

Member Function Documentation

◆ BarredInput()

static rvsdg::Input& jlm::llvm::IOBarrierOperation::BarredInput ( const rvsdg::SimpleNode node)
inlinestaticnoexcept

Definition at line 70 of file IOBarrier.hpp.

◆ copy()

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

Implements jlm::rvsdg::Operation.

Definition at line 27 of file IOBarrier.cpp.

◆ createNode()

static rvsdg::SimpleNode& jlm::llvm::IOBarrierOperation::createNode ( rvsdg::Output value,
rvsdg::Output ioState 
)
inlinestatic

Definition at line 78 of file IOBarrier.hpp.

◆ debug_string()

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

Implements jlm::rvsdg::Operation.

Definition at line 21 of file IOBarrier.cpp.

◆ operator==()

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

Definition at line 14 of file IOBarrier.cpp.

◆ Type()

const std::shared_ptr<const rvsdg::Type>& jlm::llvm::IOBarrierOperation::Type ( ) const
inlinenoexcept

Definition at line 55 of file IOBarrier.hpp.


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