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

#include <JlmToMlirConverter.hpp>

Public Member Functions

 JlmToMlirConverter ()
 
 JlmToMlirConverter (const JlmToMlirConverter &)=delete
 
 JlmToMlirConverter (JlmToMlirConverter &&)=delete
 
JlmToMlirConverteroperator= (const JlmToMlirConverter &)=delete
 
JlmToMlirConverteroperator= (JlmToMlirConverter &&)=delete
 
::mlir::rvsdg::OmegaNode ConvertModule (const llvm::LlvmRvsdgModule &rvsdgModule)
 
::llvm::SmallVector<::mlir::Value > ConvertRegion (rvsdg::Region &region, ::mlir::Block &block, bool isRoot=false)
 
static ::llvm::SmallVector<::mlir::Value > GetConvertedInputs (const rvsdg::Node &node, const std::unordered_map< rvsdg::Output *, ::mlir::Value > &valueMap)
 
::mlir::Operation * ConvertNode (const rvsdg::Node &node, ::mlir::Block &block, const ::llvm::SmallVector<::mlir::Value > &inputs)
 
::mlir::Operation * ConvertFpBinaryNode (const jlm::llvm::FBinaryOperation &op, ::llvm::SmallVector<::mlir::Value > inputs)
 
::mlir::Operation * ConvertFpCompareNode (const jlm::llvm::FCmpOperation &op, ::llvm::SmallVector<::mlir::Value > inputs)
 
::mlir::Operation * ConvertBitBinaryNode (const rvsdg::SimpleOperation &bitOp, ::llvm::SmallVector<::mlir::Value > inputs)
 
::mlir::Operation * ConvertIntegerBinaryOperation (const jlm::llvm::IntegerBinaryOperation &operation, ::llvm::SmallVector<::mlir::Value > inputs)
 
::mlir::Operation * BitCompareNode (const rvsdg::SimpleOperation &bitOp, ::llvm::SmallVector<::mlir::Value > inputs)
 
::mlir::Operation * ConvertPointerCompareNode (const llvm::PtrCmpOperation &pointerCompareOp, ::llvm::SmallVector<::mlir::Value > inputs)
 
::mlir::Operation * ConvertSimpleNode (const rvsdg::SimpleNode &node, ::mlir::Block &block, const ::llvm::SmallVector<::mlir::Value > &inputs)
 
::mlir::Operation * ConvertLambda (const rvsdg::LambdaNode &node, ::mlir::Block &block, const ::llvm::SmallVector<::mlir::Value > &inputs)
 
::mlir::Operation * ConvertGamma (const rvsdg::GammaNode &gammaNode, ::mlir::Block &block, const ::llvm::SmallVector<::mlir::Value > &inputs)
 
::mlir::Operation * ConvertTheta (const rvsdg::ThetaNode &thetaNode, ::mlir::Block &block, const ::llvm::SmallVector<::mlir::Value > &inputs)
 
::mlir::Operation * ConvertDelta (const rvsdg::DeltaNode &node, ::mlir::Block &block, const ::llvm::SmallVector<::mlir::Value > &inputs)
 
::mlir::FloatType ConvertFPType (const llvm::fpsize size)
 
::mlir::FunctionType ConvertFunctionType (const jlm::rvsdg::FunctionType &functionType)
 
::mlir::Type ConvertType (const rvsdg::Type &type)
 
::llvm::SmallVector<::mlir::Type > GetMemStateRange (size_t nresults)
 

Static Public Member Functions

static void Print (::mlir::rvsdg::OmegaNode &omega, const util::FilePath &filePath)
 

Public Attributes

std::unique_ptr<::mlir::OpBuilder > Builder_
 
std::unique_ptr<::mlir::MLIRContext > Context_
 

Detailed Description

Definition at line 34 of file JlmToMlirConverter.hpp.

Constructor & Destructor Documentation

◆ JlmToMlirConverter() [1/3]

jlm::mlir::JlmToMlirConverter::JlmToMlirConverter ( )
inline

Definition at line 37 of file JlmToMlirConverter.hpp.

◆ JlmToMlirConverter() [2/3]

jlm::mlir::JlmToMlirConverter::JlmToMlirConverter ( const JlmToMlirConverter )
delete

◆ JlmToMlirConverter() [3/3]

jlm::mlir::JlmToMlirConverter::JlmToMlirConverter ( JlmToMlirConverter &&  )
delete

Member Function Documentation

◆ BitCompareNode()

mlir::Operation * jlm::mlir::JlmToMlirConverter::BitCompareNode ( const rvsdg::SimpleOperation bitOp,
::llvm::SmallVector<::mlir::Value >  inputs 
)

Converts an RVSDG BitCompareOperation to an MLIR RVSDG operation.

Parameters
bitOpThe RVSDG BitCompareOperation to be converted
inputsThe inputs to the BitCompareOperation.
Returns
The converted MLIR RVSDG operation.

Definition at line 328 of file JlmToMlirConverter.cpp.

◆ ConvertBitBinaryNode()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertBitBinaryNode ( const rvsdg::SimpleOperation bitOp,
::llvm::SmallVector<::mlir::Value >  inputs 
)

Converts an RVSDG binary_op to an MLIR RVSDG operation.

Parameters
bitOpThe RVSDG BitBinaryOperation to be converted
inputsThe inputs to the BitBinaryOperation.
Returns
The converted MLIR RVSDG operation.

Definition at line 241 of file JlmToMlirConverter.cpp.

◆ ConvertDelta()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertDelta ( const rvsdg::DeltaNode node,
::mlir::Block &  block,
const ::llvm::SmallVector<::mlir::Value > &  inputs 
)

Converts an RVSDG delta node to an MLIR RVSDG DeltaNode.

Parameters
nodeThe RVSDG delta node to be converted
blockThe MLIR RVSDG block to insert the delta node.
inputsThe inputs to the DeltaNode.
Returns
The converted MLIR RVSDG DeltaNode.

Definition at line 941 of file JlmToMlirConverter.cpp.

◆ ConvertFpBinaryNode()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertFpBinaryNode ( const jlm::llvm::FBinaryOperation op,
::llvm::SmallVector<::mlir::Value >  inputs 
)

Converts a floating point binary operation to an MLIR operation.

Parameters
opThe jlm::llvm::FBinaryOperation to be converted
inputsThe inputs to the jlm::llvm::FBinaryOperation.
Returns
The converted MLIR operation.

Definition at line 205 of file JlmToMlirConverter.cpp.

◆ ConvertFpCompareNode()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertFpCompareNode ( const jlm::llvm::FCmpOperation op,
::llvm::SmallVector<::mlir::Value >  inputs 
)

Converts an FCmpOperation to an MLIR operation.

Parameters
opThe FCmpOperation to be converted.
inputsThe inputs to the FCmpOperation.
Returns
The converted MLIR operation.

Definition at line 227 of file JlmToMlirConverter.cpp.

◆ ConvertFPType()

mlir::FloatType jlm::mlir::JlmToMlirConverter::ConvertFPType ( const llvm::fpsize  size)

Converts an RVSDG floating point size to an MLIR floating point type.

Parameters
sizeThe jlm::llvm::fpsize to be converted.
Returns
The corresponding mlir::FloatType.

Definition at line 966 of file JlmToMlirConverter.cpp.

◆ ConvertFunctionType()

mlir::FunctionType jlm::mlir::JlmToMlirConverter::ConvertFunctionType ( const jlm::rvsdg::FunctionType functionType)

Converts an JLM function type to an MLIR LLVM function type.

Parameters
functionTypeThe JLM function type to be converted.
Returns
The corresponding MLIR LLVM function type.

Definition at line 989 of file JlmToMlirConverter.cpp.

◆ ConvertGamma()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertGamma ( const rvsdg::GammaNode gammaNode,
::mlir::Block &  block,
const ::llvm::SmallVector<::mlir::Value > &  inputs 
)

Converts an RVSDG gamma node to an MLIR RVSDG GammaNode.

Parameters
gammaNodeThe RVSDG gamma node to be converted
blockThe MLIR RVSDG block to insert the gamma node.
inputsThe inputs to the gamma node.
Returns
The converted MLIR RVSDG GammaNode.

Definition at line 870 of file JlmToMlirConverter.cpp.

◆ ConvertIntegerBinaryOperation()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertIntegerBinaryOperation ( const jlm::llvm::IntegerBinaryOperation operation,
::llvm::SmallVector<::mlir::Value >  inputs 
)

Converts an integer binary operation to an MLIR operation.

Parameters
operationThe integer binary operation to be converted
inputsThe inputs to the operation
Returns
The converted MLIR operation

Definition at line 1086 of file JlmToMlirConverter.cpp.

◆ ConvertLambda()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertLambda ( const rvsdg::LambdaNode node,
::mlir::Block &  block,
const ::llvm::SmallVector<::mlir::Value > &  inputs 
)

Converts an RVSDG lambda node to an MLIR RVSDG LambdaNode.

Parameters
nodeThe RVSDG lambda node to be converted
blockThe MLIR RVSDG block to insert the lambda node.
inputsThe inputs to the lambda::node.
Returns
The converted MLIR RVSDG LambdaNode.

Definition at line 835 of file JlmToMlirConverter.cpp.

◆ ConvertModule()

mlir::rvsdg::OmegaNode jlm::mlir::JlmToMlirConverter::ConvertModule ( const llvm::LlvmRvsdgModule rvsdgModule)

Converts an RVSDG module to MLIR RVSDG.

Parameters
rvsdgModuleThe RVSDG module to be converted.
Returns
An MLIR RVSDG OmegaNode containing the whole graph of the rvsdgModule. It is the responsibility of the caller to call ->destroy() on the returned omega, once it is no longer needed.

Definition at line 57 of file JlmToMlirConverter.cpp.

◆ ConvertNode()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertNode ( const rvsdg::Node node,
::mlir::Block &  block,
const ::llvm::SmallVector<::mlir::Value > &  inputs 
)

Converts an RVSDG node to an MLIR RVSDG operation.

Parameters
nodeThe RVSDG node to be converted
blockThe MLIR RVSDG block to insert the converted node.
inputsThe inputs to the node.
Returns
The converted MLIR RVSDG operation.

Definition at line 172 of file JlmToMlirConverter.cpp.

◆ ConvertPointerCompareNode()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertPointerCompareNode ( const llvm::PtrCmpOperation pointerCompareOp,
::llvm::SmallVector<::mlir::Value >  inputs 
)

Converts an RVSDG BitCompareOperation to an MLIR RVSDG operation.

Parameters
pointerCompareOpThe RVSDG BitCompareOperation to be converted
inputsThe inputs to the BitCompareOperation.
Returns
The converted MLIR RVSDG operation.

Definition at line 368 of file JlmToMlirConverter.cpp.

◆ ConvertRegion()

llvm::SmallVector<::mlir::Value > jlm::mlir::JlmToMlirConverter::ConvertRegion ( rvsdg::Region region,
::mlir::Block &  block,
bool  isRoot = false 
)

Converts all nodes in an RVSDG region. Conversion of structural nodes cause their regions to also be converted.

Parameters
regionThe RVSDG region to be converted
blockThe MLIR RVSDG block that corresponds to this RVSDG region, and to which converted nodes are insterted.
isRootWhether the region is the root of the RVSDG.
Returns
A list of outputs of the converted region/block.

It is similar to the GetConvertedInputs function

Definition at line 74 of file JlmToMlirConverter.cpp.

◆ ConvertSimpleNode()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertSimpleNode ( const rvsdg::SimpleNode node,
::mlir::Block &  block,
const ::llvm::SmallVector<::mlir::Value > &  inputs 
)

Converts an RVSDG SimpleNode to an MLIR RVSDG operation.

Parameters
nodeThe RVSDG node to be converted
blockThe MLIR RVSDG block to insert the converted node.
inputsThe inputs to the SimpleNode.
Returns
The converted MLIR RVSDG operation.

MLIR match operation can match multiple values to one index But jlm implements this with multiple mappings For easy conversion, we only created one mapping per value

The default alternative has an empty mapping

Definition at line 421 of file JlmToMlirConverter.cpp.

◆ ConvertTheta()

mlir::Operation * jlm::mlir::JlmToMlirConverter::ConvertTheta ( const rvsdg::ThetaNode thetaNode,
::mlir::Block &  block,
const ::llvm::SmallVector<::mlir::Value > &  inputs 
)

Definition at line 909 of file JlmToMlirConverter.cpp.

◆ ConvertType()

mlir::Type jlm::mlir::JlmToMlirConverter::ConvertType ( const rvsdg::Type type)

Converts an RVSDG type to an MLIR RVSDG type.

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

Definition at line 1005 of file JlmToMlirConverter.cpp.

◆ GetConvertedInputs()

llvm::SmallVector<::mlir::Value > jlm::mlir::JlmToMlirConverter::GetConvertedInputs ( const rvsdg::Node node,
const std::unordered_map< rvsdg::Output *, ::mlir::Value > &  valueMap 
)

Retreive the previously converted MLIR values from the map of operations

Parameters
nodeThe RVSDG node to get the inputs for.
valueMapA map of RVSDG outputs to their corresponding MLIR values.
Returns
The vector of inputs to the node.

Definition at line 142 of file JlmToMlirConverter.cpp.

◆ GetMemStateRange()

llvm::SmallVector<::mlir::Type > jlm::mlir::JlmToMlirConverter::GetMemStateRange ( size_t  nresults)

Generate a vector with memory state types.

Parameters
nresultsThe number of memory state types to generate.
Returns
The vector with memory state types.

Definition at line 824 of file JlmToMlirConverter.cpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ Print()

void jlm::mlir::JlmToMlirConverter::Print ( ::mlir::rvsdg::OmegaNode &  omega,
const util::FilePath filePath 
)
static

Prints MLIR RVSDG to a file.

Parameters
omegaThe MLIR RVSDG Omega node to be printed.
filePathThe path to the file to print the MLIR to.

Definition at line 36 of file JlmToMlirConverter.cpp.

Member Data Documentation

◆ Builder_

std::unique_ptr<::mlir::OpBuilder> jlm::mlir::JlmToMlirConverter::Builder_

Definition at line 265 of file JlmToMlirConverter.hpp.

◆ Context_

std::unique_ptr<::mlir::MLIRContext> jlm::mlir::JlmToMlirConverter::Context_

Definition at line 266 of file JlmToMlirConverter.hpp.


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