9#ifndef LLVM_DEBUGINFO_DWARF_LOWLEVEL_DWARFUNWINDTABLE_H
10#define LLVM_DEBUGINFO_DWARF_LOWLEVEL_DWARFUNWINDTABLE_H
62 std::optional<uint32_t> AddrSpace;
64 std::optional<DWARFExpression> Expr;
73 AddrSpace(
std::nullopt), Dereference(
false) {}
76 std::optional<uint32_t> AS,
bool Deref)
77 : Kind(K), RegNum(
Reg), Offset(Off), AddrSpace(AS), Dereference(Deref) {}
79 UnwindLocation(DWARFExpression
E,
bool Deref)
112 std::optional<uint32_t> AddrSpace = std::nullopt);
115 std::optional<uint32_t> AddrSpace = std::nullopt);
145 void setOffset(int32_t NewOffset) { Offset = NewOffset; }
167 std::map<uint32_t, UnwindLocation> Locations;
177 auto Pos = Locations.find(RegNum);
178 if (Pos == Locations.end())
196 Locations.erase(RegNum);
197 Locations.insert(std::make_pair(RegNum, Location));
208 size_t size()
const {
return Locations.size(); }
211 return Locations ==
RHS.Locations;
234 std::optional<uint64_t> Address;
282 size_t size()
const {
return Rows.size(); }
314parseRows(
const CFIProgram &CFIP, UnwindRow &CurrRow,
315 const RegisterLocations *InitialLocs);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SI Pre allocate WWM Registers
This file defines the SmallVector class.
Tagged union holding either a T or a Error.
Wrapper class representing virtual and physical registers.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM Value Representation.
A class that can track all registers with locations in a UnwindRow object.
bool operator==(const RegisterLocations &RHS) const
std::optional< UnwindLocation > getRegisterLocation(uint32_t RegNum) const
Return the location for the register in RegNum if there is a location.
SmallVector< uint32_t, 4 > getRegisters() const
void setRegisterLocation(uint32_t RegNum, const UnwindLocation &Location)
Set the location for the register in RegNum to Location.
bool hasLocations() const
Returns true if we have any register locations in this object.
void removeRegisterLocation(uint32_t RegNum)
Removes any rule for the register in RegNum.
A class that represents a location for the Call Frame Address (CFA) or a register.
static LLVM_ABI UnwindLocation createUndefined()
Create a location where the value is undefined and not available.
void setConstant(int32_t Value)
Some opcodes modify a constant value and we need to be able to update the constant value (DW_CFA_GNU_...
void setOffset(int32_t NewOffset)
Some opcodes will modify the CFA location's offset only, so we need to be able to modify the CFA offs...
uint32_t getRegister() const
static LLVM_ABI UnwindLocation createAtRegisterPlusOffset(uint32_t Reg, int32_t Off, std::optional< uint32_t > AddrSpace=std::nullopt)
static LLVM_ABI UnwindLocation createIsRegisterPlusOffset(uint32_t Reg, int32_t Off, std::optional< uint32_t > AddrSpace=std::nullopt)
Create a location where the saved value is in (Deref == false) or at (Deref == true) a regiser plus a...
int32_t getOffset() const
static LLVM_ABI UnwindLocation createAtDWARFExpression(DWARFExpression Expr)
static LLVM_ABI UnwindLocation createUnspecified()
Create a location whose rule is set to Unspecified.
static LLVM_ABI UnwindLocation createIsDWARFExpression(DWARFExpression Expr)
Create a location whose value is the result of evaluating a DWARF expression.
@ Undefined
Register is not available and can't be recovered.
@ Constant
Value is a constant value contained in "Offset": reg = Offset.
@ DWARFExpr
Register or CFA value is in or at a value found by evaluating a DWARF expression: reg = eval(dwarf_ex...
@ Same
Register value is in the register, nothing needs to be done to unwind it: reg = reg.
@ CFAPlusOffset
Register is in or at the CFA plus an offset: reg = CFA + offset reg = defef(CFA + offset)
@ Unspecified
Not specified.
@ RegPlusOffset
Register or CFA is in or at a register plus offset, optionally in an address space: reg = reg + offse...
Location getLocation() const
static LLVM_ABI UnwindLocation createIsConstant(int32_t Value)
uint32_t getAddressSpace() const
std::optional< DWARFExpression > getDWARFExpressionBytes() const
static LLVM_ABI UnwindLocation createAtCFAPlusOffset(int32_t Off)
static LLVM_ABI UnwindLocation createSame()
Create a location where the value is known to be in the register itself.
int32_t getConstant() const
bool getDereference() const
static LLVM_ABI UnwindLocation createIsCFAPlusOffset(int32_t Off)
Create a location that is in (Deref == false) or at (Deref == true) the CFA plus an offset.
void setRegister(uint32_t NewRegNum)
Some opcodes will modify the CFA location's register only, so we need to be able to modify the CFA re...
bool hasAddressSpace() const
A class that represents a single row in the unwind table that is decoded by parsing the DWARF Call Fr...
void setAddress(uint64_t Addr)
Set the address for this UnwindRow.
void slideAddress(uint64_t Offset)
Offset the address for this UnwindRow.
uint64_t getAddress() const
Get the address for this row.
const RegisterLocations & getRegisterLocations() const
UnwindLocation & getCFAValue()
const UnwindLocation & getCFAValue() const
RegisterLocations & getRegisterLocations()
bool hasAddress() const
Returns true if the address is valid in this object.
A class that contains all UnwindRow objects for an FDE or a single unwind row for a CIE.
UnwindTable(RowContainer &&Rows)
const_iterator end() const
std::vector< UnwindRow > RowContainer
RowContainer::const_iterator const_iterator
const_iterator begin() const
RowContainer::iterator iterator
const UnwindRow & operator[](size_t Index) const
constexpr uint32_t InvalidRegisterNumber
LLVM_ABI Expected< UnwindTable::RowContainer > parseRows(const CFIProgram &CFIP, UnwindRow &CurrRow, const RegisterLocations *InitialLocs)
Parse the information in the CFIProgram and update the CurrRow object that the state machine describe...
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.