MLIR 24.0.0git
LLVMRemarkImport.cpp File Reference
#include "mlir/Remark/LLVMRemarkImport.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/SymbolTable.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/Remarks/Remark.h"
#include "llvm/Remarks/RemarkParser.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/raw_ostream.h"

Go to the source code of this file.

Functions

static Location getFunctionLocation (Operation *anchor, llvm::StringMap< Location > &cache, StringRef functionName)
 Returns the location of the symbol functionName inside anchor, or the location of anchor if there is no such symbol.
static Location resolveLocation (Operation *anchor, llvm::StringMap< Location > &cache, StringRef file, unsigned line, unsigned column, StringRef functionName)
static Location resolveLocation (Operation *anchor, llvm::StringMap< Location > &cache, const llvm::DiagnosticInfoWithLocationBase &diag)
static remark::RemarkKind getRemarkKind (llvm::DiagnosticKind kind)
static remark::RemarkKind getRemarkKind (llvm::remarks::Type type)
static std::string getCategory (StringRef passName)
 Returns the MLIR remark category of the LLVM pass passName.
static std::string getArgKey (StringRef key)
 Renames the argument keys that the remark engine uses itself.
static void emitImportedRemark (remark::detail::RemarkEngine &engine, Location loc, const ImportedRemark &imported)
static void importLLVMRemark (remark::detail::RemarkEngine &engine, Location loc, const llvm::DiagnosticInfoOptimizationBase &diag)
static void importLLVMRemark (remark::detail::RemarkEngine &engine, Location loc, const llvm::remarks::Remark &remark)

Function Documentation

◆ emitImportedRemark()

◆ getArgKey()

std::string getArgKey ( StringRef key)
static

Renames the argument keys that the remark engine uses itself.

Definition at line 131 of file LLVMRemarkImport.cpp.

Referenced by emitImportedRemark().

◆ getCategory()

◆ getFunctionLocation()

Location getFunctionLocation ( Operation * anchor,
llvm::StringMap< Location > & cache,
StringRef functionName )
static

Returns the location of the symbol functionName inside anchor, or the location of anchor if there is no such symbol.

Definition at line 34 of file LLVMRemarkImport.cpp.

References mlir::Operation::getLoc(), mlir::Operation::hasTrait(), and mlir::SymbolTable::lookupSymbolIn().

Referenced by resolveLocation().

◆ getRemarkKind() [1/2]

◆ getRemarkKind() [2/2]

◆ importLLVMRemark() [1/2]

void importLLVMRemark ( remark::detail::RemarkEngine & engine,
Location loc,
const llvm::DiagnosticInfoOptimizationBase & diag )
static

◆ importLLVMRemark() [2/2]

void importLLVMRemark ( remark::detail::RemarkEngine & engine,
Location loc,
const llvm::remarks::Remark & remark )
static

Definition at line 191 of file LLVMRemarkImport.cpp.

References emitImportedRemark(), and getRemarkKind().

◆ resolveLocation() [1/2]

Location resolveLocation ( Operation * anchor,
llvm::StringMap< Location > & cache,
const llvm::DiagnosticInfoWithLocationBase & diag )
static

Definition at line 59 of file LLVMRemarkImport.cpp.

References diag(), and resolveLocation().

◆ resolveLocation() [2/2]

Location resolveLocation ( Operation * anchor,
llvm::StringMap< Location > & cache,
StringRef file,
unsigned line,
unsigned column,
StringRef functionName )
static