[llvm] 6b5e486 - Revert "[BPF] Narrow some interfaces"

Tamir Duberstein via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 11:51:01 PDT 2023


Author: Tamir Duberstein
Date: 2023-08-02T14:50:01-04:00
New Revision: 6b5e48642806c836f5f680f6d0c7fdbc85fb9d9f

URL: https://github.com/llvm/llvm-project/commit/6b5e48642806c836f5f680f6d0c7fdbc85fb9d9f
DIFF: https://github.com/llvm/llvm-project/commit/6b5e48642806c836f5f680f6d0c7fdbc85fb9d9f.diff

LOG: Revert "[BPF] Narrow some interfaces"

Review requested by @ast and @yonghong-song.

This reverts commit 82bc1839bc53db296be36947ec0c482c8ca3a3d8.

Added: 
    

Modified: 
    llvm/lib/Target/BPF/BTFDebug.cpp
    llvm/lib/Target/BPF/BTFDebug.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp
index 972d0fecedacf8..54427b073cb897 100644
--- a/llvm/lib/Target/BPF/BTFDebug.cpp
+++ b/llvm/lib/Target/BPF/BTFDebug.cpp
@@ -973,7 +973,8 @@ void BTFDebug::visitMapDefType(const DIType *Ty, uint32_t &TypeId) {
 }
 
 /// Read file contents from the actual file or from the source
-std::string BTFDebug::populateFileContent(const DIFile *File) {
+std::string BTFDebug::populateFileContent(const DISubprogram *SP) {
+  auto File = SP->getFile();
   std::string FileName;
 
   if (!File->getFilename().startswith("/") && File->getDirectory().size())
@@ -1004,9 +1005,9 @@ std::string BTFDebug::populateFileContent(const DIFile *File) {
   return FileName;
 }
 
-void BTFDebug::constructLineInfo(const DIFile *File, MCSymbol *Label,
+void BTFDebug::constructLineInfo(const DISubprogram *SP, MCSymbol *Label,
                                  uint32_t Line, uint32_t Column) {
-  std::string FileName = populateFileContent(File);
+  std::string FileName = populateFileContent(SP);
   BTFLineInfo LineInfo;
 
   LineInfo.Label = Label;
@@ -1373,7 +1374,7 @@ void BTFDebug::beginInstruction(const MachineInstr *MI) {
     if (LineInfoGenerated == false) {
       auto *S = MI->getMF()->getFunction().getSubprogram();
       MCSymbol *FuncLabel = Asm->getFunctionBegin();
-      constructLineInfo(S->getFile(), FuncLabel, S->getLine(), 0);
+      constructLineInfo(S, FuncLabel, S->getLine(), 0);
       LineInfoGenerated = true;
     }
 
@@ -1385,7 +1386,8 @@ void BTFDebug::beginInstruction(const MachineInstr *MI) {
   OS.emitLabel(LineSym);
 
   // Construct the lineinfo.
-  constructLineInfo(DL->getFile(), LineSym, DL.getLine(), DL.getCol());
+  auto SP = DL->getScope()->getSubprogram();
+  constructLineInfo(SP, LineSym, DL.getLine(), DL.getCol());
 
   LineInfoGenerated = true;
   PrevInstLoc = DL;

diff  --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h
index 90cfe3af13ecf1..7536006ed21ccd 100644
--- a/llvm/lib/Target/BPF/BTFDebug.h
+++ b/llvm/lib/Target/BPF/BTFDebug.h
@@ -341,12 +341,12 @@ class BTFDebug : public DebugHandlerBase {
   /// Check whether the type is a forward declaration candidate or not.
   bool IsForwardDeclCandidate(const DIType *Base);
 
-  /// Get the file content. Certain lines of the file
+  /// Get the file content for the subprogram. Certain lines of the file
   /// later may be put into string table and referenced by line info.
-  std::string populateFileContent(const DIFile *File);
+  std::string populateFileContent(const DISubprogram *SP);
 
   /// Construct a line info.
-  void constructLineInfo(const DIFile *File, MCSymbol *Label, uint32_t Line,
+  void constructLineInfo(const DISubprogram *SP, MCSymbol *Label, uint32_t Line,
                          uint32_t Column);
 
   /// Generate types and variables for globals.


        


More information about the llvm-commits mailing list