MLIR 22.0.0git
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.
char * mlirTranslateModuleToLLVMIRToString (MlirOperation module)
 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.
MlirType mlirTypeFromLLVMIRTranslatorTranslateType (MlirTypeFromLLVMIRTranslator translator, LLVMTypeRef llvmType)
 Translates the given LLVM IR type to the MLIR LLVM dialect.
 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.
LLVMTypeRef mlirTypeToLLVMIRTranslatorTranslateType (MlirTypeToLLVMIRTranslator translator, MlirType mlirType)
 Translates the given MLIR LLVM dialect to the LLVM IR type.

Function Documentation

◆ DEFINE_C_API_PTR_METHODS() [1/2]

Definition at line 46 of file LLVMIR.cpp.

References unwrap(), and wrap().

◆ DEFINE_C_API_PTR_METHODS() [2/2]

Definition at line 68 of file LLVMIR.cpp.

References 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(), and unwrap().

Referenced by mlirTranslateModuleToLLVMIRToString().

◆ mlirTranslateModuleToLLVMIRToString()

char * mlirTranslateModuleToLLVMIRToString ( MlirOperation module)

Definition at line 37 of file LLVMIR.cpp.

References mlirTranslateModuleToLLVMIR().

Referenced by populateDialectLLVMSubmodule().

◆ 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 56 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 61 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 78 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 83 of file LLVMIR.cpp.

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