[llvm] [NFC] Remove UnwindTable dependency on CIE, and FDE (PR #142520)
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 19 18:28:11 PDT 2025
================
@@ -352,53 +351,57 @@ class UnwindTable {
LLVM_ABI void dump(raw_ostream &OS, DIDumpOptions DumpOpts,
unsigned IndentLevel = 0) const;
- /// Create an UnwindTable from a Common Information Entry (CIE).
- ///
- /// \param Cie The Common Information Entry to extract the table from. The
- /// CFIProgram is retrieved from the \a Cie object and used to create the
- /// UnwindTable.
- ///
- /// \returns An error if the DWARF Call Frame Information opcodes have state
- /// machine errors, or a valid UnwindTable otherwise.
- LLVM_ABI static Expected<UnwindTable> create(const CIE *Cie);
-
- /// Create an UnwindTable from a Frame Descriptor Entry (FDE).
- ///
- /// \param Fde The Frame Descriptor Entry to extract the table from. The
- /// CFIProgram is retrieved from the \a Fde object and used to create the
- /// UnwindTable.
- ///
- /// \returns An error if the DWARF Call Frame Information opcodes have state
- /// machine errors, or a valid UnwindTable otherwise.
- LLVM_ABI static Expected<UnwindTable> create(const FDE *Fde);
-
private:
RowContainer Rows;
- /// The end address when data is extracted from a FDE. This value will be
- /// invalid when a UnwindTable is extracted from a CIE.
- std::optional<uint64_t> EndAddress;
-
- /// Parse the information in the CFIProgram and update the CurrRow object
- /// that the state machine describes.
- ///
- /// This is an internal implementation that emulates the state machine
- /// described in the DWARF Call Frame Information opcodes and will push
- /// CurrRow onto the Rows container when needed.
- ///
- /// \param CFIP the CFI program that contains the opcodes from a CIE or FDE.
- ///
- /// \param CurrRow the current row to modify while parsing the state machine.
- ///
- /// \param InitialLocs If non-NULL, we are parsing a FDE and this contains
- /// the initial register locations from the CIE. If NULL, then a CIE's
- /// opcodes are being parsed and this is not needed. This is used for the
- /// DW_CFA_restore and DW_CFA_restore_extended opcodes.
- Error parseRows(const CFIProgram &CFIP, UnwindRow &CurrRow,
- const RegisterLocations *InitialLocs);
};
+/// Parse the information in the CFIProgram and update the CurrRow object
+/// that the state machine describes.
+///
+/// This function emulates the state machine described in the DWARF Call Frame
+/// Information opcodes and will push CurrRow onto a RowContainer when needed.
+///
+/// \param CFIP the CFI program that contains the opcodes from a CIE or FDE.
+///
+/// \param CurrRow the current row to modify while parsing the state machine.
+///
+/// \param InitialLocs If non-NULL, we are parsing a FDE and this contains
+/// the initial register locations from the CIE. If NULL, then a CIE's
+/// opcodes are being parsed and this is not needed. This is used for the
+/// DW_CFA_restore and DW_CFA_restore_extended opcodes.
+///
+/// \returns An error if the DWARF Call Frame Information opcodes have state
+/// machine errors, or the accumulated rows otherwise.
+LLVM_ABI Expected<UnwindTable::RowContainer>
+parseRows(const CFIProgram &CFIP, UnwindRow &CurrRow,
+ const RegisterLocations *InitialLocs);
----------------
igorkudrin wrote:
Do you expect any users for this function besides `createUnwindTable()`? If not, it would be better to move it to the cpp file and make it static. In this case, I would also pass `RowContainer` as a reference to avoid creating temporary objects.
https://github.com/llvm/llvm-project/pull/142520
More information about the llvm-commits
mailing list