LLVM  3.7.0
Public Member Functions | Protected Attributes | List of all members
llvm::DwarfExpression Class Referenceabstract

Base class containing the logic for constructing DWARF expressions independently of whether they are emitted into a DIE or into a .debug_loc entry. More...

#include <DwarfExpression.h>

Inheritance diagram for llvm::DwarfExpression:
[legend]
Collaboration diagram for llvm::DwarfExpression:
[legend]

Public Member Functions

 DwarfExpression (const TargetRegisterInfo &TRI, unsigned DwarfVersion)
 
virtual ~DwarfExpression ()
 
virtual void EmitOp (uint8_t Op, const char *Comment=nullptr)=0
 Output a dwarf operand and an optional assembler comment. More...
 
virtual void EmitSigned (int64_t Value)=0
 Emit a raw signed value. More...
 
virtual void EmitUnsigned (uint64_t Value)=0
 Emit a raw unsigned value. More...
 
virtual bool isFrameRegister (unsigned MachineReg)=0
 Return whether the given machine register is the frame register in the current function. More...
 
void AddReg (int DwarfReg, const char *Comment=nullptr)
 Emit a dwarf register operation. More...
 
void AddRegIndirect (int DwarfReg, int Offset, bool Deref=false)
 Emit an (double-)indirect dwarf register operation. More...
 
void AddOpPiece (unsigned SizeInBits, unsigned OffsetInBits=0)
 Emit a dwarf register operation for describing. More...
 
void AddShr (unsigned ShiftBy)
 Emit a shift-right dwarf expression. More...
 
bool AddMachineRegIndirect (unsigned MachineReg, int Offset=0)
 Emit an indirect dwarf register operation for the given machine register. More...
 
bool AddMachineRegPiece (unsigned MachineReg, unsigned PieceSizeInBits=0, unsigned PieceOffsetInBits=0)
 Emit a partial DWARF register operation. More...
 
void AddSignedConstant (int Value)
 Emit a signed constant. More...
 
void AddUnsignedConstant (unsigned Value)
 Emit an unsigned constant. More...
 
bool AddMachineRegExpression (const DIExpression *Expr, unsigned MachineReg, unsigned PieceOffsetInBits=0)
 Emit an entire expression on top of a machine register location. More...
 
void AddExpression (DIExpression::expr_op_iterator I, DIExpression::expr_op_iterator E, unsigned PieceOffsetInBits=0)
 Emit a the operations remaining the DIExpressionIterator I. More...
 

Protected Attributes

const TargetRegisterInfoTRI
 
unsigned DwarfVersion
 

Detailed Description

Base class containing the logic for constructing DWARF expressions independently of whether they are emitted into a DIE or into a .debug_loc entry.

Definition at line 31 of file DwarfExpression.h.

Constructor & Destructor Documentation

llvm::DwarfExpression::DwarfExpression ( const TargetRegisterInfo TRI,
unsigned  DwarfVersion 
)
inline

Definition at line 38 of file DwarfExpression.h.

virtual llvm::DwarfExpression::~DwarfExpression ( )
inlinevirtual

Definition at line 41 of file DwarfExpression.h.

Member Function Documentation

void DwarfExpression::AddExpression ( DIExpression::expr_op_iterator  I,
DIExpression::expr_op_iterator  E,
unsigned  PieceOffsetInBits = 0 
)

Emit a the operations remaining the DIExpressionIterator I.

Parameters
PieceOffsetInBitsIf this is one piece out of a fragmented location, this is the offset of the piece inside the entire variable.

Definition at line 243 of file DwarfExpression.cpp.

References AddOpPiece(), EmitOp(), EmitUnsigned(), llvm::DIExpression::ExprOperand::getArg(), getOffsetOrZero(), llvm::DIExpression::ExprOperand::getOp(), I, and llvm_unreachable.

Referenced by llvm::DwarfCompileUnit::addComplexAddress(), and AddMachineRegExpression().

bool DwarfExpression::AddMachineRegExpression ( const DIExpression Expr,
unsigned  MachineReg,
unsigned  PieceOffsetInBits = 0 
)

Emit an entire expression on top of a machine register location.

Parameters
PieceOffsetInBitsIf this is one piece out of a fragmented location, this is the offset of the piece inside the entire variable.
Returns
false if no DWARF register exists for MachineReg.

Definition at line 195 of file DwarfExpression.cpp.

References AddExpression(), AddMachineRegIndirect(), AddMachineRegPiece(), advance(), llvm::DIExpression::expr_op_begin(), llvm::DIExpression::expr_op_end(), getOffsetOrZero(), I, llvm_unreachable, and N.

Referenced by llvm::DwarfCompileUnit::addComplexAddress().

bool DwarfExpression::AddMachineRegIndirect ( unsigned  MachineReg,
int  Offset = 0 
)

Emit an indirect dwarf register operation for the given machine register.

Returns
false if no DWARF register exists for MachineReg.

Definition at line 68 of file DwarfExpression.cpp.

References AddRegIndirect(), EmitOp(), EmitSigned(), llvm::MCRegisterInfo::getDwarfRegNum(), isFrameRegister(), and TRI.

Referenced by llvm::DwarfCompileUnit::addComplexAddress(), AddMachineRegExpression(), and llvm::DwarfUnit::addRegisterOffset().

bool DwarfExpression::AddMachineRegPiece ( unsigned  MachineReg,
unsigned  PieceSizeInBits = 0,
unsigned  PieceOffsetInBits = 0 
)

Emit a partial DWARF register operation.

Parameters
MachineRegthe register
PieceSizeInBitssize and
PieceOffsetInBitsoffset of the piece in bits, if this is one piece of an aggregate value.

If size and offset is zero an operation for the entire register is emitted: Some targets do not provide a DWARF register number for every register. If this is the case, this function will attempt to emit a DWARF register by emitting a piece of a super-register or by piecing together multiple subregisters that alias the register.

Returns
false if no DWARF register exists for MachineReg.

Definition at line 84 of file DwarfExpression.cpp.

References AddOpPiece(), AddReg(), AddShr(), llvm::SmallBitVector::any(), llvm::MCRegisterInfo::getDwarfRegNum(), llvm::TargetRegisterInfo::getMinimalPhysRegClass(), llvm::TargetRegisterClass::getSize(), llvm::MCRegisterInfo::getSubRegIdxOffset(), llvm::MCRegisterInfo::getSubRegIdxSize(), llvm::MCRegisterInfo::getSubRegIndex(), llvm::TargetRegisterInfo::isPhysicalRegister(), llvm::MCRegisterInfo::DiffListIterator::isValid(), llvm::SmallBitVector::set(), and TRI.

Referenced by AddMachineRegExpression(), and llvm::DwarfUnit::addRegisterOpPiece().

void DwarfExpression::AddOpPiece ( unsigned  SizeInBits,
unsigned  OffsetInBits = 0 
)

Emit a dwarf register operation for describing.

  • a small value occupying only part of a register or
  • a register representing only part of a value.

Definition at line 48 of file DwarfExpression.cpp.

References EmitOp(), and EmitUnsigned().

Referenced by AddExpression(), and AddMachineRegPiece().

void DwarfExpression::AddReg ( int  DwarfReg,
const char *  Comment = nullptr 
)

Emit a dwarf register operation.

Definition at line 25 of file DwarfExpression.cpp.

References EmitOp(), and EmitUnsigned().

Referenced by AddMachineRegPiece().

void DwarfExpression::AddRegIndirect ( int  DwarfReg,
int  Offset,
bool  Deref = false 
)

Emit an (double-)indirect dwarf register operation.

Definition at line 35 of file DwarfExpression.cpp.

References EmitOp(), EmitSigned(), and EmitUnsigned().

Referenced by AddMachineRegIndirect().

void DwarfExpression::AddShr ( unsigned  ShiftBy)

Emit a shift-right dwarf expression.

Definition at line 62 of file DwarfExpression.cpp.

References EmitOp(), and EmitUnsigned().

Referenced by AddMachineRegPiece().

void DwarfExpression::AddSignedConstant ( int  Value)

Emit a signed constant.

Definition at line 162 of file DwarfExpression.cpp.

References DwarfVersion, EmitOp(), and EmitSigned().

Referenced by emitDebugLocValue().

void DwarfExpression::AddUnsignedConstant ( unsigned  Value)

Emit an unsigned constant.

Definition at line 179 of file DwarfExpression.cpp.

References DwarfVersion, EmitOp(), and EmitUnsigned().

virtual void llvm::DwarfExpression::EmitOp ( uint8_t  Op,
const char *  Comment = nullptr 
)
pure virtual
virtual void llvm::DwarfExpression::EmitSigned ( int64_t  Value)
pure virtual
virtual void llvm::DwarfExpression::EmitUnsigned ( uint64_t  Value)
pure virtual
virtual bool llvm::DwarfExpression::isFrameRegister ( unsigned  MachineReg)
pure virtual

Return whether the given machine register is the frame register in the current function.

Implemented in llvm::DIEDwarfExpression, and llvm::DebugLocDwarfExpression.

Referenced by AddMachineRegIndirect().

Member Data Documentation

unsigned llvm::DwarfExpression::DwarfVersion
protected

Definition at line 35 of file DwarfExpression.h.

Referenced by AddSignedConstant(), and AddUnsignedConstant().

const TargetRegisterInfo& llvm::DwarfExpression::TRI
protected

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