//===- DILineTableFromLocations.cpp - -------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #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" namespace mlir { namespace LLVM { #define GEN_PASS_DEF_DISCOPEFORLLVMFUNCOPPASS #include "mlir/Dialect/LLVMIR/Transforms/Passes.h.inc" } // namespace LLVM } // namespace mlir usingnamespacemlir; /// Attempt to extract a filename for the given loc. static FileLineColLoc extractFileLoc(Location loc) { … } /// Creates a DISubprogramAttr with the provided compile unit and attaches it /// to the function. Does nothing when the function already has an attached /// subprogram. static void addScopeToFunction(LLVM::LLVMFuncOp llvmFunc, LLVM::DICompileUnitAttr compileUnitAttr) { … } namespace { /// Add a debug info scope to LLVMFuncOp that are missing it. struct DIScopeForLLVMFuncOpPass : public LLVM::impl::DIScopeForLLVMFuncOpPassBase< DIScopeForLLVMFuncOpPass> { … }; } // end anonymous namespace