Jlm
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
jlm::mlir::MlirToJlmConverter Class Referencefinal

#include <MlirToJlmConverter.hpp>

Collaboration diagram for jlm::mlir::MlirToJlmConverter:
Collaboration graph
[legend]

Public Member Functions

 MlirToJlmConverter ()
 
 MlirToJlmConverter (const MlirToJlmConverter &)=delete
 
 MlirToJlmConverter (MlirToJlmConverter &&)=delete
 
MlirToJlmConverteroperator= (const MlirToJlmConverter &)=delete
 
MlirToJlmConverteroperator= (MlirToJlmConverter &&)=delete
 
std::unique_ptr< llvm::LlvmRvsdgModuleReadAndConvertMlir (const util::FilePath &filePath)
 
std::unique_ptr< llvm::LlvmRvsdgModuleConvertMlir (std::unique_ptr<::mlir::Block > &block)
 

Static Public Member Functions

static std::unique_ptr< llvm::LlvmRvsdgModuleCreateAndConvert (std::unique_ptr<::mlir::Block > &block)
 

Private Member Functions

::llvm::SmallVector< jlm::rvsdg::Output * > ConvertRegion (::mlir::Region &region, rvsdg::Region &rvsdgRegion)
 
::llvm::SmallVector< jlm::rvsdg::Output * > ConvertBlock (::mlir::Block &block, rvsdg::Region &rvsdgRegion)
 
static ::llvm::SmallVector< jlm::rvsdg::Output * > GetConvertedInputs (::mlir::Operation &mlirOp, const std::unordered_map< void *, rvsdg::Output * > &outputMap)
 
rvsdg::NodeConvertCmpIOp (::mlir::arith::CmpIOp &CompOp, const ::llvm::SmallVector< rvsdg::Output * > &inputs, size_t nbits)
 
rvsdg::NodeConvertICmpOp (::mlir::LLVM::ICmpOp &operation, rvsdg::Region &rvsdgRegion, const ::llvm::SmallVector< rvsdg::Output * > &inputs)
 
rvsdg::NodeConvertFPBinaryNode (const ::mlir::Operation &mlirOperation, const ::llvm::SmallVector< rvsdg::Output * > &inputs)
 
jlm::llvm::fpcmp TryConvertFPCMP (const ::mlir::arith::CmpFPredicate &op)
 
rvsdg::NodeConvertBitBinaryNode (::mlir::Operation &mlirOperation, const ::llvm::SmallVector< rvsdg::Output * > &inputs)
 
std::vector< jlm::rvsdg::Output * > ConvertOperation (::mlir::Operation &mlirOperation, rvsdg::Region &rvsdgRegion, const ::llvm::SmallVector< rvsdg::Output * > &inputs)
 
llvm::fpsize ConvertFPSize (unsigned int size)
 
llvm::Linkage ConvertLinkage (std::string stringValue)
 
std::unique_ptr< llvm::LlvmRvsdgModuleConvertOmega (::mlir::rvsdg::OmegaNode &omegaNode)
 
rvsdg::NodeConvertLambda (::mlir::Operation &mlirLambda, rvsdg::Region &rvsdgRegion, const ::llvm::SmallVector< rvsdg::Output * > &inputs)
 
std::shared_ptr< const rvsdg::TypeConvertType (const ::mlir::Type &type)
 

Static Private Member Functions

static size_t GetIndexBitWidth ()
 

Private Attributes

std::unique_ptr<::mlir::MLIRContext > Context_
 
util::BijectiveMap<::mlir::LLVM::LLVMStructType *, std::shared_ptr< const llvm::StructType > > StructTypeMap_
 

Detailed Description

Definition at line 30 of file MlirToJlmConverter.hpp.

Constructor & Destructor Documentation

◆ MlirToJlmConverter() [1/3]

jlm::mlir::MlirToJlmConverter::MlirToJlmConverter ( )
inline

Definition at line 33 of file MlirToJlmConverter.hpp.

◆ MlirToJlmConverter() [2/3]

jlm::mlir::MlirToJlmConverter::MlirToJlmConverter ( const MlirToJlmConverter )
delete

◆ MlirToJlmConverter() [3/3]

jlm::mlir::MlirToJlmConverter::MlirToJlmConverter ( MlirToJlmConverter &&  )
delete

Member Function Documentation

◆ ConvertBitBinaryNode()

rvsdg::Node * jlm::mlir::MlirToJlmConverter::ConvertBitBinaryNode ( ::mlir::Operation &  mlirOperation,
const ::llvm::SmallVector< rvsdg::Output * > &  inputs 
)
private

Converts an MLIR integer binary operation into an RVSDG node.

Parameters
mlirOperationThe MLIR operation to be converted.
inputsThe inputs for the RVSDG node.
Returns
The converted RVSDG node OR nullptr if the operation cannot be casted to an operation

Definition at line 321 of file MlirToJlmConverter.cpp.

◆ ConvertBlock()

llvm::SmallVector< jlm::rvsdg::Output * > jlm::mlir::MlirToJlmConverter::ConvertBlock ( ::mlir::Block &  block,
rvsdg::Region rvsdgRegion 
)
private

Converts the MLIR block and all operations in it

Parameters
blockThe MLIR block to the converted
rvsdgRegionThe corresponding RVSDG region that will be populated with all the contents of the MLIR region.
Returns
The results of the region are returned as a std::vector

Definition at line 99 of file MlirToJlmConverter.cpp.

◆ ConvertCmpIOp()

rvsdg::Node * jlm::mlir::MlirToJlmConverter::ConvertCmpIOp ( ::mlir::arith::CmpIOp &  CompOp,
const ::llvm::SmallVector< rvsdg::Output * > &  inputs,
size_t  nbits 
)
private

Converts an MLIR arith integer comparison operation into an RVSDG node.

Parameters
CompOpThe MLIR comparison operation to be converted.
inputsThe inputs for the RVSDG node.
nbitsThe number of bits in the comparison.
Returns
The converted RVSDG node.

Definition at line 155 of file MlirToJlmConverter.cpp.

◆ ConvertFPBinaryNode()

rvsdg::Node * jlm::mlir::MlirToJlmConverter::ConvertFPBinaryNode ( const ::mlir::Operation &  mlirOperation,
const ::llvm::SmallVector< rvsdg::Output * > &  inputs 
)
private

Converts an MLIR floating point binary operation into an RVSDG node.

Parameters
mlirOperationThe MLIR operation to be converted.
inputsThe inputs for the RVSDG node.
Returns
The converted RVSDG node OR nullptr if the operation cannot be casted to an operation

Definition at line 273 of file MlirToJlmConverter.cpp.

◆ ConvertFPSize()

llvm::fpsize jlm::mlir::MlirToJlmConverter::ConvertFPSize ( unsigned int  size)
private

Converts a floating point size to jlm::llvm::fpsize.

Parameters
sizeunsinged int representing the size.
Returns
The fpsize.

Definition at line 1008 of file MlirToJlmConverter.cpp.

◆ ConvertICmpOp()

rvsdg::Node * jlm::mlir::MlirToJlmConverter::ConvertICmpOp ( ::mlir::LLVM::ICmpOp &  operation,
rvsdg::Region rvsdgRegion,
const ::llvm::SmallVector< rvsdg::Output * > &  inputs 
)
private

Converts an MLIR LLVM integer comparison operation into an RVSDG node.

Parameters
operationThe MLIR comparison operation to be converted.
rvsdgRegionThe RVSDG region that the generated RVSDG node is inserted into.
inputsThe inputs for the RVSDG node.
Returns
The converted RVSDG node.

Definition at line 207 of file MlirToJlmConverter.cpp.

◆ ConvertLambda()

jlm::rvsdg::Node * jlm::mlir::MlirToJlmConverter::ConvertLambda ( ::mlir::Operation &  mlirLambda,
rvsdg::Region rvsdgRegion,
const ::llvm::SmallVector< rvsdg::Output * > &  inputs 
)
private

Converts an MLIR lambda operation and inserts it into an RVSDG region.

Parameters
mlirLambdaThe MLIR lambda opeation to the converted
rvsdgRegionThe RVSDG region that the lambda node will reside in.
inputsThe inputs for the RVSDG node.
Returns
The converted Lambda node.

Definition at line 1081 of file MlirToJlmConverter.cpp.

◆ ConvertLinkage()

llvm::Linkage jlm::mlir::MlirToJlmConverter::ConvertLinkage ( std::string  stringValue)
private

Converts a string representing a linkage to jlm::llvm::linkage.

Parameters
stringValueThe string to be converted.
Returns
The linkage.

Definition at line 1030 of file MlirToJlmConverter.cpp.

◆ ConvertMlir()

std::unique_ptr< llvm::LlvmRvsdgModule > jlm::mlir::MlirToJlmConverter::ConvertMlir ( std::unique_ptr<::mlir::Block > &  block)

Converts the MLIR block and all operations in it, including their respective regions.

Parameters
blockThe RVSDG MLIR block to be converted.
Returns
The converted RVSDG graph.

Definition at line 41 of file MlirToJlmConverter.cpp.

◆ ConvertOmega()

std::unique_ptr< llvm::LlvmRvsdgModule > jlm::mlir::MlirToJlmConverter::ConvertOmega ( ::mlir::rvsdg::OmegaNode &  omegaNode)
private

Converts an MLIR omega operation and insterst it into an RVSDG region.

Parameters
omegaNodeThe MLIR omega opeation to the converted
Returns
The converted RVSDG graph.

Definition at line 63 of file MlirToJlmConverter.cpp.

◆ ConvertOperation()

std::vector< jlm::rvsdg::Output * > jlm::mlir::MlirToJlmConverter::ConvertOperation ( ::mlir::Operation &  mlirOperation,
rvsdg::Region rvsdgRegion,
const ::llvm::SmallVector< rvsdg::Output * > &  inputs 
)
private

Converts an MLIR operation into an RVSDG node.

Parameters
mlirOperationThe MLIR operation to be converted.
rvsdgRegionThe RVSDG region that the generated RVSDG node is inserted into.
inputsThe inputs for the RVSDG node.
Returns
The outputs of the RVSDG node.

Here we connect all subregion result to output of the gamma node

Definition at line 415 of file MlirToJlmConverter.cpp.

◆ ConvertRegion()

llvm::SmallVector< jlm::rvsdg::Output * > jlm::mlir::MlirToJlmConverter::ConvertRegion ( ::mlir::Region &  region,
rvsdg::Region rvsdgRegion 
)
private

Converts the MLIR region and all operations in it MLIR uses blocks as the innermost "container" so this function gets the block of the region and converts it.

Parameters
regionThe MLIR region to the converted
rvsdgRegionThe corresponding RVSDG region that will be populated with all the contents of the MLIR region.
Returns
The results of the region are returned as a std::vector

Definition at line 75 of file MlirToJlmConverter.cpp.

◆ ConvertType()

std::shared_ptr< const rvsdg::Type > jlm::mlir::MlirToJlmConverter::ConvertType ( const ::mlir::Type &  type)
private

Converts an MLIR type into an RVSDG type.

Parameters
typeThe MLIR type to be converted.
Returns
The converted RVSDG type.

Definition at line 1134 of file MlirToJlmConverter.cpp.

◆ CreateAndConvert()

static std::unique_ptr<llvm::LlvmRvsdgModule> jlm::mlir::MlirToJlmConverter::CreateAndConvert ( std::unique_ptr<::mlir::Block > &  block)
inlinestatic

Temporarily creates an MlirToJlmConverter that is used to convert an MLIR block to an RVSDG graph.

Parameters
blockThe RVSDG MLIR block to be converted.
Returns
The converted RVSDG graph.

Definition at line 79 of file MlirToJlmConverter.hpp.

◆ GetConvertedInputs()

llvm::SmallVector< jlm::rvsdg::Output * > jlm::mlir::MlirToJlmConverter::GetConvertedInputs ( ::mlir::Operation &  mlirOp,
const std::unordered_map< void *, rvsdg::Output * > &  outputMap 
)
private

Retreive the previously converted RVSDG ouputs from the map of operations and return them in the inputs vector.

Parameters
mlirOpThe MLIR operation that the inputs are retrieved for.
outputMapThe map of operations that have been converted. argument).
Returns
The vector that is populated with the inputs.

Definition at line 84 of file MlirToJlmConverter.cpp.

◆ GetIndexBitWidth()

static size_t jlm::mlir::MlirToJlmConverter::GetIndexBitWidth ( )
inlinestaticprivate

This function should return an architecture dependent number of bits that is used to represent the MLIR intex type.

Returns
The number of bits used to represent the index type (currently hardcoded to 32 bits for x86)

Definition at line 241 of file MlirToJlmConverter.hpp.

◆ operator=() [1/2]

MlirToJlmConverter& jlm::mlir::MlirToJlmConverter::operator= ( const MlirToJlmConverter )
delete

◆ operator=() [2/2]

MlirToJlmConverter& jlm::mlir::MlirToJlmConverter::operator= ( MlirToJlmConverter &&  )
delete

◆ ReadAndConvertMlir()

std::unique_ptr< llvm::LlvmRvsdgModule > jlm::mlir::MlirToJlmConverter::ReadAndConvertMlir ( const util::FilePath filePath)

Reads RVSDG MLIR from a file and converts it,

Parameters
filePathThe path to the file containing RVSDG MLIR IR.
Returns
The converted RVSDG graph.

Definition at line 28 of file MlirToJlmConverter.cpp.

◆ TryConvertFPCMP()

llvm::fpcmp jlm::mlir::MlirToJlmConverter::TryConvertFPCMP ( const ::mlir::arith::CmpFPredicate &  op)
private

Converts a floating point compare predicate to jlm::llvm::fpcmp.

Parameters
opthe predicate.
Returns
The corresponding fpcmp.

Definition at line 314 of file MlirToJlmConverter.cpp.

Member Data Documentation

◆ Context_

std::unique_ptr<::mlir::MLIRContext> jlm::mlir::MlirToJlmConverter::Context_
private

Definition at line 250 of file MlirToJlmConverter.hpp.

◆ StructTypeMap_

util::BijectiveMap<::mlir::LLVM::LLVMStructType *, std::shared_ptr<const llvm::StructType> > jlm::mlir::MlirToJlmConverter::StructTypeMap_
private

Definition at line 252 of file MlirToJlmConverter.hpp.


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