LLVM 22.0.0git
Public Member Functions | List of all members
llvm::DWARFCFIAnalysis Class Reference

DWARFCFIAnalysis validates the DWARF Call Frame Information one machine instruction at a time. More...

#include "llvm/DWARFCFIChecker/DWARFCFIAnalysis.h"

Public Member Functions

LLVM_ABI DWARFCFIAnalysis (MCContext *Context, MCInstrInfo const &MCII, bool IsEH, ArrayRef< MCCFIInstruction > Prologue)
 
LLVM_ABI void update (const MCInst &Inst, ArrayRef< MCCFIInstruction > Directives)
 

Detailed Description

DWARFCFIAnalysis validates the DWARF Call Frame Information one machine instruction at a time.

This class maintains an internal CFI state initialized with the prologue directives and updated with each instruction's associated directives. In each update, it checks if the machine instruction changes the CFI state in a way that matches the changes from the CFI directives. This checking may results in errors and warnings.

In current stage, the analysis is only aware of what registers the instruction modifies. If the modification is happening to a sub-register, the analysis considers the super-register is modified.

In each update, for each register (or CFA), the following cases can happen:

  1. The unwinding rule is not changed: a. The registers involved in this rule are not modified: the analysis proceeds without emitting error or warning. b. The registers involved in this rule are modified: it emits an error.
  2. The unwinding rule is changed: a. The rule is structurally modified (i.e., the location is changed): It emits a warning. b. The rule is structurally the same, but the register set is changed: it emits a warning. c. The rule is structurally the same, using the same set of registers, but the offset is changed: i. If the registers included in the rule are modified as well: It emits a warning. ii. If the registers included in the rule are not modified: It emits an error.

The analysis only checks the CFA unwinding rule when the rule is a register plus some offset. Therefore, for CFA, only cases 1, 2.b, and 2.c are checked, and in all other case(s), a warning is emitted.

Definition at line 76 of file DWARFCFIAnalysis.h.

Constructor & Destructor Documentation

◆ DWARFCFIAnalysis()

DWARFCFIAnalysis::DWARFCFIAnalysis ( MCContext Context,
MCInstrInfo const MCII,
bool  IsEH,
ArrayRef< MCCFIInstruction Prologue 
)

Member Function Documentation

◆ update()

void DWARFCFIAnalysis::update ( const MCInst Inst,
ArrayRef< MCCFIInstruction Directives 
)

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