MLIR  20.0.0git
Namespaces | Macros | Functions
DIScopeForLLVMFuncOp.cpp File Reference
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Pass/Pass.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Path.h"
#include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::LLVM
 

Macros

#define GEN_PASS_DEF_DISCOPEFORLLVMFUNCOPPASS
 

Functions

static FileLineColLoc extractFileLoc (Location loc)
 Attempt to extract a filename for the given loc. More...
 
static void addScopeToFunction (LLVM::LLVMFuncOp llvmFunc, LLVM::DICompileUnitAttr compileUnitAttr)
 Creates a DISubprogramAttr with the provided compile unit and attaches it to the function. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_DISCOPEFORLLVMFUNCOPPASS

#define GEN_PASS_DEF_DISCOPEFORLLVMFUNCOPPASS

Definition at line 19 of file DIScopeForLLVMFuncOp.cpp.

Function Documentation

◆ addScopeToFunction()

static void addScopeToFunction ( LLVM::LLVMFuncOp  llvmFunc,
LLVM::DICompileUnitAttr  compileUnitAttr 
)
static

Creates a DISubprogramAttr with the provided compile unit and attaches it to the function.

Does nothing when the function already has an attached subprogram.

Definition at line 40 of file DIScopeForLLVMFuncOp.cpp.

References mlir::DistinctAttr::create(), extractFileLoc(), mlir::LocationAttr::findInstanceOf(), mlir::get(), mlir::FileLineColLoc::getColumn(), mlir::FileLineColLoc::getFilename(), and mlir::FileLineColLoc::getLine().

◆ extractFileLoc()

static FileLineColLoc extractFileLoc ( Location  loc)
static

Attempt to extract a filename for the given loc.

Definition at line 27 of file DIScopeForLLVMFuncOp.cpp.

Referenced by addScopeToFunction().