Skip to content

[NFC] Make unwind table internal data structures more accessible #145804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

amsen20
Copy link
Contributor

@amsen20 amsen20 commented Jun 25, 2025

All these changes are being used in PR#145633

CFIProgram:

  • addInstruction methods already exists, but more convenient ones are private, this PR makes them public

UnwindLocation:

  • Added a field accessor method for Dereference like other field access methods.

@llvmbot
Copy link
Member

llvmbot commented Jun 25, 2025

@llvm/pr-subscribers-debuginfo

Author: AmirHossein PashaeeHir (amsen20)

Changes

All these changes are being used in PR#145633

CFIProgram:

  • addInstruction methods already exists, but more convenient ones are private, this PR makes them public

UnwindLocation:

  • Added a field accessor method for Dereference like other field access methods.

Full diff: https://github.com/llvm/llvm-project/pull/145804.diff

2 Files Affected:

  • (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h (+6-6)
  • (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h (+2)
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h
index 1d89ac3578c10..79a2be7ef2584 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFCFIProgram.h
@@ -112,12 +112,6 @@ class CFIProgram {
   /// above. This is indexed by opcode.
   LLVM_ABI static ArrayRef<OperandType[MaxOperands]> getOperandTypes();
 
-private:
-  std::vector<Instruction> Instructions;
-  const uint64_t CodeAlignmentFactor;
-  const int64_t DataAlignmentFactor;
-  Triple::ArchType Arch;
-
   /// Convenience method to add a new instruction with the given opcode.
   void addInstruction(uint8_t Opcode) {
     Instructions.push_back(Instruction(Opcode));
@@ -144,6 +138,12 @@ class CFIProgram {
     Instructions.back().Ops.push_back(Operand2);
     Instructions.back().Ops.push_back(Operand3);
   }
+
+private:
+  std::vector<Instruction> Instructions;
+  const uint64_t CodeAlignmentFactor;
+  const int64_t DataAlignmentFactor;
+  Triple::ArchType Arch;
 };
 
 } // end namespace dwarf
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index 3b367009a379d..89d12437a7d31 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -138,6 +138,8 @@ class UnwindLocation {
     return *AddrSpace;
   }
   int32_t getConstant() const { return Offset; }
+  bool getDereference() const { return Dereference; }
+
   /// Some opcodes will modify the CFA location's register only, so we need
   /// to be able to modify the CFA register when evaluating DWARF Call Frame
   /// Information opcodes.

@amsen20
Copy link
Contributor Author

amsen20 commented Jun 25, 2025

This also has a collusion with this NFC. The first one that lands, I will update the other one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants