99#ifndef LLVM_DEBUGINFO_DWARF_DWARFUNWINDTABLE_H
1010#define LLVM_DEBUGINFO_DWARF_DWARFUNWINDTABLE_H
1111
12+ #include " llvm/ADT/SmallVector.h"
1213#include " llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h"
1314#include " llvm/DebugInfo/DWARF/LowLevel/DWARFExpression.h"
1415#include " llvm/Support/Compiler.h"
@@ -122,6 +123,11 @@ class UnwindLocation {
122123 Location getLocation () const { return Kind; }
123124 uint32_t getRegister () const { return RegNum; }
124125 int32_t getOffset () const { return Offset; }
126+ bool hasAddressSpace () const {
127+ if (AddrSpace)
128+ return true ;
129+ return false ;
130+ }
125131 uint32_t getAddressSpace () const {
126132 assert (Kind == RegPlusOffset && AddrSpace);
127133 return *AddrSpace;
@@ -145,25 +151,10 @@ class UnwindLocation {
145151 std::optional<DWARFExpression> getDWARFExpressionBytes () const {
146152 return Expr;
147153 }
148- // / Dump a location expression as text and use the register information if
149- // / some is provided.
150- // /
151- // / \param OS the stream to use for output.
152- // /
153- // / \param MRI register information that helps emit register names insteead
154- // / of raw register numbers.
155- // /
156- // / \param IsEH true if the DWARF Call Frame Information is from .eh_frame
157- // / instead of from .debug_frame. This is needed for register number
158- // / conversion because some register numbers differ between the two sections
159- // / for certain architectures like x86.
160- LLVM_ABI void dump (raw_ostream &OS, DIDumpOptions DumpOpts) const ;
161154
162155 LLVM_ABI bool operator ==(const UnwindLocation &RHS) const ;
163156};
164157
165- LLVM_ABI raw_ostream &operator <<(raw_ostream &OS, const UnwindLocation &R);
166-
167158// / A class that can track all registers with locations in a UnwindRow object.
168159// /
169160// / Register locations use a map where the key is the register number and the
@@ -189,6 +180,13 @@ class RegisterLocations {
189180 return Pos->second ;
190181 }
191182
183+ SmallVector<uint32_t , 4 > getRegisters () const {
184+ SmallVector<uint32_t , 4 > Registers;
185+ for (auto &&[Register, _]: Locations)
186+ Registers.push_back (Register);
187+ return Registers;
188+ }
189+
192190 // / Set the location for the register in \a RegNum to \a Location.
193191 // /
194192 // / \param RegNum the register number to set the location for.
@@ -204,19 +202,6 @@ class RegisterLocations {
204202 // / \param RegNum the register number to remove the location for.
205203 void removeRegisterLocation (uint32_t RegNum) { Locations.erase (RegNum); }
206204
207- // / Dump all registers + locations that are currently defined in this object.
208- // /
209- // / \param OS the stream to use for output.
210- // /
211- // / \param MRI register information that helps emit register names insteead
212- // / of raw register numbers.
213- // /
214- // / \param IsEH true if the DWARF Call Frame Information is from .eh_frame
215- // / instead of from .debug_frame. This is needed for register number
216- // / conversion because some register numbers differ between the two sections
217- // / for certain architectures like x86.
218- LLVM_ABI void dump (raw_ostream &OS, DIDumpOptions DumpOpts) const ;
219-
220205 // / Returns true if we have any register locations in this object.
221206 bool hasLocations () const { return !Locations.empty (); }
222207
@@ -227,8 +212,6 @@ class RegisterLocations {
227212 }
228213};
229214
230- LLVM_ABI raw_ostream &operator <<(raw_ostream &OS, const RegisterLocations &RL);
231-
232215// / A class that represents a single row in the unwind table that is decoded by
233216// / parsing the DWARF Call Frame Information opcodes.
234217// /
@@ -281,27 +264,8 @@ class UnwindRow {
281264 const UnwindLocation &getCFAValue () const { return CFAValue; }
282265 RegisterLocations &getRegisterLocations () { return RegLocs; }
283266 const RegisterLocations &getRegisterLocations () const { return RegLocs; }
284-
285- // / Dump the UnwindRow to the stream.
286- // /
287- // / \param OS the stream to use for output.
288- // /
289- // / \param MRI register information that helps emit register names insteead
290- // / of raw register numbers.
291- // /
292- // / \param IsEH true if the DWARF Call Frame Information is from .eh_frame
293- // / instead of from .debug_frame. This is needed for register number
294- // / conversion because some register numbers differ between the two sections
295- // / for certain architectures like x86.
296- // /
297- // / \param IndentLevel specify the indent level as an integer. The UnwindRow
298- // / will be output to the stream preceded by 2 * IndentLevel number of spaces.
299- LLVM_ABI void dump (raw_ostream &OS, DIDumpOptions DumpOpts,
300- unsigned IndentLevel = 0 ) const ;
301267};
302268
303- LLVM_ABI raw_ostream &operator <<(raw_ostream &OS, const UnwindRow &Row);
304-
305269// / A class that contains all UnwindRow objects for an FDE or a single unwind
306270// / row for a CIE. To unwind an address the rows, which are sorted by start
307271// / address, can be searched to find the UnwindRow with the lowest starting
@@ -325,23 +289,6 @@ class UnwindTable {
325289 return Rows[Index];
326290 }
327291
328- // / Dump the UnwindTable to the stream.
329- // /
330- // / \param OS the stream to use for output.
331- // /
332- // / \param MRI register information that helps emit register names instead
333- // / of raw register numbers.
334- // /
335- // / \param IsEH true if the DWARF Call Frame Information is from .eh_frame
336- // / instead of from .debug_frame. This is needed for register number
337- // / conversion because some register numbers differ between the two sections
338- // / for certain architectures like x86.
339- // /
340- // / \param IndentLevel specify the indent level as an integer. The UnwindRow
341- // / will be output to the stream preceded by 2 * IndentLevel number of spaces.
342- LLVM_ABI void dump (raw_ostream &OS, DIDumpOptions DumpOpts,
343- unsigned IndentLevel = 0 ) const ;
344-
345292private:
346293 RowContainer Rows;
347294};
@@ -367,8 +314,6 @@ LLVM_ABI Expected<UnwindTable::RowContainer>
367314parseRows (const CFIProgram &CFIP, UnwindRow &CurrRow,
368315 const RegisterLocations *InitialLocs);
369316
370- LLVM_ABI raw_ostream &operator <<(raw_ostream &OS, const UnwindTable &Rows);
371-
372317} // end namespace dwarf
373318
374319} // end namespace llvm
0 commit comments