14 #ifndef LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXPRESSION_H
15 #define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFEXPRESSION_H
18 #include "llvm/Support/DataTypes.h"
24 class TargetRegisterInfo;
43 : Start(Expr.
begin()), End(Expr.
end()) {}
46 : Start(C.Start), End(C.End) {}
56 void consume(
unsigned N) { std::advance(Start, N); }
77 operator bool()
const {
return Start != End; }
124 virtual void emitOp(uint8_t
Op,
const char *Comment =
nullptr) = 0;
135 void addReg(
int DwarfReg,
const char *Comment =
nullptr);
157 unsigned MaxSize = ~1U);
166 void addShr(
unsigned ShiftBy);
215 unsigned FragmentOffsetInBits = 0);
222 unsigned FragmentOffsetInBits = 0);
233 void emitOp(uint8_t
Op,
const char *Comment =
nullptr)
override;
234 void emitSigned(int64_t
Value)
override;
235 void emitUnsigned(uint64_t Value)
override;
237 unsigned MachineReg)
override;
249 void emitOp(uint8_t
Op,
const char *Comment =
nullptr)
override;
250 void emitSigned(int64_t
Value)
override;
251 void emitUnsigned(uint64_t Value)
override;
253 unsigned MachineReg)
override;
void addShr(unsigned ShiftBy)
Emit a shift-right dwarf operation.
DIELoc - Represents an expression location.
DIExpression::expr_op_iterator begin() const
void addUnsignedConstant(uint64_t Value)
Emit an unsigned constant.
void setMemoryLocationKind()
Lock this down to become a memory location description.
Optional< DIExpression::ExprOperand > peek() const
Return the current operation.
Base class containing the logic for constructing DWARF expressions independently of whether they are ...
DwarfExpression(unsigned DwarfVersion)
void addBReg(int DwarfReg, int Offset)
Emit a DW_OP_breg operation.
void addFBReg(int Offset)
Emit DW_OP_fbreg <Offset>.
enum llvm::DwarfExpression::@277 LocationKind
The kind of location description being produced.
Holds a DIExpression and keeps track of how many operands have been consumed so far.
DwarfExpression implementation for .debug_loc entries.
void addReg(int DwarfReg, const char *Comment=nullptr)
Emit a DW_OP_reg operation.
void setSubRegisterPiece(unsigned SizeInBits, unsigned OffsetInBits)
Push a DW_OP_piece / DW_OP_bit_piece for emitting later, if one is needed to represent a subregister...
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
void maskSubRegister()
Add masking operations to stencil out a subregister.
virtual void emitUnsigned(uint64_t Value)=0
Emit a raw unsigned value.
Optional< DIExpression::ExprOperand > take()
Consume one operation.
Optional< DIExpression::FragmentInfo > getFragmentInfo() const
Retrieve the fragment information, if any.
This dwarf writer support class manages information associated with a source file.
DIEDwarfExpression(const AsmPrinter &AP, DwarfUnit &DU, DIELoc &DIE)
DIExpressionCursor(const DIExpression *Expr)
virtual void emitOp(uint8_t Op, const char *Comment=nullptr)=0
Output a dwarf operand and an optional assembler comment.
Optional< DIExpression::ExprOperand > peekNext() const
Return the next operation.
expr_op_iterator getNext() const
Get the next iterator.
A structured debug information entry.
This class is intended to be used as a driving class for all asm writers.
uint64_t OffsetInBits
Current Fragment Offset in Bits.
virtual void emitSigned(int64_t Value)=0
Emit a raw signed value.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
DIExpressionCursor(const DIExpressionCursor &C)
unsigned SubRegisterOffsetInBits
void addExpression(DIExpressionCursor &&Expr, unsigned FragmentOffsetInBits=0)
Emit all remaining operations in the DIExpressionCursor.
bool addMachineReg(const TargetRegisterInfo &TRI, unsigned MachineReg, unsigned MaxSize=~1U)
Emit a partial DWARF register operation.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
~DwarfExpression()=default
void addStackValue()
Emit a DW_OP_stack_value, if supported.
Optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
Class for arbitrary precision integers.
void addAnd(unsigned Mask)
Emit a bitwise and dwarf operation.
DIExpression::expr_op_iterator end() const
unsigned SubRegisterSizeInBits
Sometimes we need to add a DW_OP_bit_piece to describe a subregister.
void consume(unsigned N)
Consume N operations.
void finalize()
This needs to be called last to commit any pending changes.
DebugLocDwarfExpression(unsigned DwarfVersion, ByteStreamer &BS)
DIExpressionCursor(ArrayRef< uint64_t > Expr)
DwarfExpression implementation for singular DW_AT_location.
void addFragmentOffset(const DIExpression *Expr)
If applicable, emit an empty DW_OP_piece / DW_OP_bit_piece to advance to the fragment described by Ex...
Holds information about all subregisters comprising a register location.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
void addOpPiece(unsigned SizeInBits, unsigned OffsetInBits=0)
Emit a DW_OP_piece or DW_OP_bit_piece operation for a variable fragment.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
An iterator for expression operands.
void addSignedConstant(int64_t Value)
Emit a signed constant.
SmallVector< Register, 2 > DwarfRegs
The register location, if any.
expr_op_iterator expr_op_end() const
bool addMachineRegExpression(const TargetRegisterInfo &TRI, DIExpressionCursor &Expr, unsigned MachineReg, unsigned FragmentOffsetInBits=0)
Emit a machine register location.
virtual bool isFrameRegister(const TargetRegisterInfo &TRI, unsigned MachineReg)=0
Return whether the given machine register is the frame register in the current function.