LLVM 22.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
llvm::dwarf::CFIProgram Class Reference

Represent a sequence of Call Frame Information instructions that, when read in order, construct a table mapping PC to frame state. More...

#include "llvm/DebugInfo/DWARF/LowLevel/DWARFCFIProgram.h"

Classes

struct  Instruction
 An instruction consists of a DWARF CFI opcode and an optional sequence of operands. More...
 

Public Types

enum  OperandType {
  OT_Unset , OT_None , OT_Address , OT_Offset ,
  OT_FactoredCodeOffset , OT_SignedFactDataOffset , OT_UnsignedFactDataOffset , OT_Register ,
  OT_AddressSpace , OT_Expression
}
 Types of operands to CFI instructions In DWARF, this type is implicitly tied to a CFI instruction opcode and thus this type doesn't need to be explicitly written to the file (this is not a DWARF encoding). More...
 
typedef SmallVector< uint64_t, MaxOperandsOperands
 
using InstrList = std::vector< Instruction >
 
using iterator = InstrList::iterator
 
using const_iterator = InstrList::const_iterator
 

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
unsigned size () const
 
bool empty () const
 
uint64_t codeAlign () const
 
int64_t dataAlign () const
 
Triple::ArchType triple () const
 
 CFIProgram (uint64_t CodeAlignmentFactor, int64_t DataAlignmentFactor, Triple::ArchType Arch)
 
template<typename T >
Error parse (DWARFDataExtractorBase< T > &Data, uint64_t *Offset, uint64_t EndOffset)
 Parse and store a sequence of CFI instructions from Data, starting at *Offset and ending at EndOffset.
 
void addInstruction (const Instruction &I)
 
LLVM_ABI StringRef callFrameString (unsigned Opcode) const
 Get a DWARF CFI call frame string for the given DW_CFA opcode.
 
void addInstruction (uint8_t Opcode)
 Convenience method to add a new instruction with the given opcode.
 
void addInstruction (uint8_t Opcode, uint64_t Operand1)
 Add a new single-operand instruction.
 
void addInstruction (uint8_t Opcode, uint64_t Operand1, uint64_t Operand2)
 Add a new instruction that has two operands.
 
void addInstruction (uint8_t Opcode, uint64_t Operand1, uint64_t Operand2, uint64_t Operand3)
 Add a new instruction that has three operands.
 

Static Public Member Functions

static LLVM_ABI const charoperandTypeString (OperandType OT)
 Get the OperandType as a "const char *".
 
static LLVM_ABI ArrayRef< OperandType[MaxOperands]> getOperandTypes ()
 Retrieve the array describing the types of operands according to the enum above.
 

Static Public Attributes

static constexpr size_t MaxOperands = 3
 

Detailed Description

Represent a sequence of Call Frame Information instructions that, when read in order, construct a table mapping PC to frame state.

This can also be referred to as "CFI rules" in DWARF literature to avoid confusion with computer programs in the broader sense, and in this context each instruction would be a rule to establish the mapping. Refer to pg. 172 in the DWARF5 manual, "6.4.1 Structure of Call Frame Information".

Definition at line 34 of file DWARFCFIProgram.h.

Member Typedef Documentation

◆ const_iterator

using llvm::dwarf::CFIProgram::const_iterator = InstrList::const_iterator

Definition at line 59 of file DWARFCFIProgram.h.

◆ InstrList

Definition at line 57 of file DWARFCFIProgram.h.

◆ iterator

using llvm::dwarf::CFIProgram::iterator = InstrList::iterator

Definition at line 58 of file DWARFCFIProgram.h.

◆ Operands

Definition at line 37 of file DWARFCFIProgram.h.

Member Enumeration Documentation

◆ OperandType

Types of operands to CFI instructions In DWARF, this type is implicitly tied to a CFI instruction opcode and thus this type doesn't need to be explicitly written to the file (this is not a DWARF encoding).

The relationship of instrs to operand types can be obtained from getOperandTypes() and is only used to simplify instruction printing and error messages.

Enumerator
OT_Unset 
OT_None 
OT_Address 
OT_Offset 
OT_FactoredCodeOffset 
OT_SignedFactDataOffset 
OT_UnsignedFactDataOffset 
OT_Register 
OT_AddressSpace 
OT_Expression 

Definition at line 237 of file DWARFCFIProgram.h.

Constructor & Destructor Documentation

◆ CFIProgram()

llvm::dwarf::CFIProgram::CFIProgram ( uint64_t  CodeAlignmentFactor,
int64_t  DataAlignmentFactor,
Triple::ArchType  Arch 
)
inline

Definition at line 72 of file DWARFCFIProgram.h.

Member Function Documentation

◆ addInstruction() [1/5]

void llvm::dwarf::CFIProgram::addInstruction ( const Instruction I)
inline

Definition at line 226 of file DWARFCFIProgram.h.

References I.

Referenced by parse().

◆ addInstruction() [2/5]

void llvm::dwarf::CFIProgram::addInstruction ( uint8_t  Opcode)
inline

Convenience method to add a new instruction with the given opcode.

Definition at line 258 of file DWARFCFIProgram.h.

◆ addInstruction() [3/5]

void llvm::dwarf::CFIProgram::addInstruction ( uint8_t  Opcode,
uint64_t  Operand1 
)
inline

Add a new single-operand instruction.

Definition at line 263 of file DWARFCFIProgram.h.

◆ addInstruction() [4/5]

void llvm::dwarf::CFIProgram::addInstruction ( uint8_t  Opcode,
uint64_t  Operand1,
uint64_t  Operand2 
)
inline

Add a new instruction that has two operands.

Definition at line 269 of file DWARFCFIProgram.h.

◆ addInstruction() [5/5]

void llvm::dwarf::CFIProgram::addInstruction ( uint8_t  Opcode,
uint64_t  Operand1,
uint64_t  Operand2,
uint64_t  Operand3 
)
inline

Add a new instruction that has three operands.

Definition at line 276 of file DWARFCFIProgram.h.

◆ begin() [1/2]

iterator llvm::dwarf::CFIProgram::begin ( )
inline

Definition at line 61 of file DWARFCFIProgram.h.

◆ begin() [2/2]

const_iterator llvm::dwarf::CFIProgram::begin ( ) const
inline

Definition at line 62 of file DWARFCFIProgram.h.

◆ callFrameString()

StringRef CFIProgram::callFrameString ( unsigned  Opcode) const

Get a DWARF CFI call frame string for the given DW_CFA opcode.

Definition at line 21 of file DWARFCFIProgram.cpp.

References llvm::dwarf::CallFrameString().

Referenced by llvm::dwarf::parseRows().

◆ codeAlign()

uint64_t llvm::dwarf::CFIProgram::codeAlign ( ) const
inline

◆ dataAlign()

int64_t llvm::dwarf::CFIProgram::dataAlign ( ) const
inline

◆ empty()

bool llvm::dwarf::CFIProgram::empty ( ) const
inline

Definition at line 67 of file DWARFCFIProgram.h.

Referenced by llvm::dwarf::createUnwindTable().

◆ end() [1/2]

iterator llvm::dwarf::CFIProgram::end ( )
inline

Definition at line 63 of file DWARFCFIProgram.h.

◆ end() [2/2]

const_iterator llvm::dwarf::CFIProgram::end ( ) const
inline

Definition at line 64 of file DWARFCFIProgram.h.

◆ getOperandTypes()

ArrayRef< CFIProgram::OperandType[CFIProgram::MaxOperands]> CFIProgram::getOperandTypes ( )
static

◆ operandTypeString()

const char * CFIProgram::operandTypeString ( CFIProgram::OperandType  OT)
static

◆ parse()

template<typename T >
Error llvm::dwarf::CFIProgram::parse ( DWARFDataExtractorBase< T > &  Data,
uint64_t Offset,
uint64_t  EndOffset 
)
inline

Parse and store a sequence of CFI instructions from Data, starting at *Offset and ending at EndOffset.

*Offset is updated to EndOffset upon successful parsing, or indicates the offset where a problem occurred in case an error is returned.

Definition at line 82 of file DWARFCFIProgram.h.

References addInstruction(), llvm::CallingConv::C, llvm::createStringError(), llvm::Data, llvm::illegal_byte_sequence, llvm_unreachable, and llvm::Offset.

◆ size()

unsigned llvm::dwarf::CFIProgram::size ( ) const
inline

Definition at line 66 of file DWARFCFIProgram.h.

◆ triple()

Triple::ArchType llvm::dwarf::CFIProgram::triple ( ) const
inline

Definition at line 70 of file DWARFCFIProgram.h.

Referenced by llvm::dwarf::parseRows().

Member Data Documentation

◆ MaxOperands

constexpr size_t llvm::dwarf::CFIProgram::MaxOperands = 3
staticconstexpr

The documentation for this class was generated from the following files: