MLIR  21.0.0git
Functions
LLVMIR.cpp File Reference
#include "mlir-c/Target/LLVMIR.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "mlir/CAPI/IR.h"
#include "mlir/CAPI/Wrap.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "mlir/Target/LLVMIR/TypeFromLLVM.h"

Go to the source code of this file.

Functions

LLVMModuleRef mlirTranslateModuleToLLVMIR (MlirOperation module, LLVMContextRef context)
 Translate operation that satisfies LLVM dialect module requirements into an LLVM IR module living in the given context. More...
 
 DEFINE_C_API_PTR_METHODS (MlirTypeFromLLVMIRTranslator, mlir::LLVM::TypeFromLLVMIRTranslator) MlirTypeFromLLVMIRTranslator mlirTypeFromLLVMIRTranslatorCreate(MlirContext ctx)
 
void mlirTypeFromLLVMIRTranslatorDestroy (MlirTypeFromLLVMIRTranslator translator)
 Takes an LLVM::TypeFromLLVMIRTranslator owned by the caller and destroys it. More...
 
MlirType mlirTypeFromLLVMIRTranslatorTranslateType (MlirTypeFromLLVMIRTranslator translator, LLVMTypeRef llvmType)
 Translates the given LLVM IR type to the MLIR LLVM dialect. More...
 
 DEFINE_C_API_PTR_METHODS (MlirTypeToLLVMIRTranslator, mlir::LLVM::TypeToLLVMIRTranslator) MlirTypeToLLVMIRTranslator mlirTypeToLLVMIRTranslatorCreate(LLVMContextRef ctx)
 
void mlirTypeToLLVMIRTranslatorDestroy (MlirTypeToLLVMIRTranslator translator)
 Takes an LLVM::TypeToLLVMIRTranslator owned by the caller and destroys it. More...
 
LLVMTypeRef mlirTypeToLLVMIRTranslatorTranslateType (MlirTypeToLLVMIRTranslator translator, MlirType mlirType)
 Translates the given MLIR LLVM dialect to the LLVM IR type. More...
 

Function Documentation

◆ DEFINE_C_API_PTR_METHODS() [1/2]

Definition at line 37 of file LLVMIR.cpp.

References unwrap(), and wrap().

◆ DEFINE_C_API_PTR_METHODS() [2/2]

DEFINE_C_API_PTR_METHODS ( MlirTypeToLLVMIRTranslator  ,
mlir::LLVM::TypeToLLVMIRTranslator   
)

Definition at line 59 of file LLVMIR.cpp.

References unwrap(), and wrap().

◆ mlirTranslateModuleToLLVMIR()

LLVMModuleRef mlirTranslateModuleToLLVMIR ( MlirOperation  module,
LLVMContextRef  context 
)

Translate operation that satisfies LLVM dialect module requirements into an LLVM IR module living in the given context.

This translates operations from any dilalect that has a registered implementation of LLVMTranslationDialectInterface.

Returns
the generated LLVM IR Module from the translated MLIR module, it is owned by the caller.

Definition at line 23 of file LLVMIR.cpp.

References mlir::translateModuleToLLVMIR(), unwrap(), and wrap().

◆ mlirTypeFromLLVMIRTranslatorDestroy()

void mlirTypeFromLLVMIRTranslatorDestroy ( MlirTypeFromLLVMIRTranslator  translator)

Takes an LLVM::TypeFromLLVMIRTranslator owned by the caller and destroys it.

It is the responsibility of the user to only pass an LLVM::TypeFromLLVMIRTranslator class.

Definition at line 47 of file LLVMIR.cpp.

References unwrap().

◆ mlirTypeFromLLVMIRTranslatorTranslateType()

MlirType mlirTypeFromLLVMIRTranslatorTranslateType ( MlirTypeFromLLVMIRTranslator  translator,
LLVMTypeRef  llvmType 
)

Translates the given LLVM IR type to the MLIR LLVM dialect.

Definition at line 52 of file LLVMIR.cpp.

References mlir::LLVM::TypeFromLLVMIRTranslator::translateType(), unwrap(), and wrap().

◆ mlirTypeToLLVMIRTranslatorDestroy()

void mlirTypeToLLVMIRTranslatorDestroy ( MlirTypeToLLVMIRTranslator  translator)

Takes an LLVM::TypeToLLVMIRTranslator owned by the caller and destroys it.

It is the responsibility of the user to only pass an LLVM::TypeToLLVMIRTranslator class.

Definition at line 69 of file LLVMIR.cpp.

References unwrap().

◆ mlirTypeToLLVMIRTranslatorTranslateType()

LLVMTypeRef mlirTypeToLLVMIRTranslatorTranslateType ( MlirTypeToLLVMIRTranslator  translator,
MlirType  mlirType 
)

Translates the given MLIR LLVM dialect to the LLVM IR type.

Definition at line 74 of file LLVMIR.cpp.

References mlir::LLVM::TypeToLLVMIRTranslator::translateType(), unwrap(), and wrap().