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()) {}
74 operator bool()
const {
return Start != End; }
110 virtual void EmitOp(uint8_t
Op,
const char *Comment =
nullptr) = 0;
120 void AddReg(
int DwarfReg,
const char *Comment =
nullptr);
130 void AddShr(
unsigned ShiftBy);
166 unsigned MaxSize = ~1U);
186 unsigned FragmentOffsetInBits = 0);
193 unsigned FragmentOffsetInBits = 0);
208 void EmitOp(uint8_t
Op,
const char *Comment =
nullptr)
override;
212 unsigned MachineReg)
override;
223 void EmitOp(uint8_t
Op,
const char *Comment =
nullptr)
override;
227 unsigned MachineReg)
override;
const_iterator end(StringRef path)
Get end iterator over path.
DIELoc - Represents an expression location.
Optional< DIExpression::ExprOperand > peek() const
Return the current operation.
void AddExpression(DIExpressionCursor &&Expr, unsigned FragmentOffsetInBits=0)
Emit all remaining operations in the DIExpressionCursor.
Base class containing the logic for constructing DWARF expressions independently of whether they are ...
bool AddMachineRegIndirect(const TargetRegisterInfo &TRI, unsigned MachineReg, int Offset=0)
Emit an indirect dwarf register operation for the given machine register.
void EmitSigned(int64_t Value) override
Emit a raw signed value.
const_iterator begin(StringRef path)
Get begin iterator over path.
void AddShr(unsigned ShiftBy)
Emit a shift-right dwarf expression.
bool isFrameRegister(const TargetRegisterInfo &TRI, unsigned MachineReg) override
Return whether the given machine register is the frame register in the current function.
bool isFrameRegister(const TargetRegisterInfo &TRI, unsigned MachineReg) override
Return whether the given machine register is the frame register in the current function.
void AddOpPiece(unsigned SizeInBits, unsigned OffsetInBits=0)
Emit a DW_OP_piece or DW_OP_bit_piece operation for a variable fragment.
virtual void EmitOp(uint8_t Op, const char *Comment=nullptr)=0
Output a dwarf operand and an optional assembler comment.
DwarfExpression(unsigned DwarfVersion)
static void advance(T &it, size_t Val)
void EmitOp(uint8_t Op, const char *Comment=nullptr) override
Output a dwarf operand and an optional assembler comment.
Holds a DIExpression and keeps track of how many operands have been consumed so far.
DwarfExpression implementation for .debug_loc entries.
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...
void EmitSigned(int64_t Value) override
Emit a raw signed value.
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
void EmitOp(uint8_t Op, const char *Comment=nullptr) override
Output a dwarf operand and an optional assembler comment.
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)
Optional< DIExpression::ExprOperand > peekNext() const
Return the next operation.
void EmitUnsigned(uint64_t Value) override
Emit a raw unsigned value.
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.
void AddRegIndirect(int DwarfReg, int Offset, bool Deref=false)
Emit an (double-)indirect dwarf register operation.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual void EmitUnsigned(uint64_t Value)=0
Emit a raw unsigned value.
unsigned SubRegisterOffsetInBits
virtual ~DwarfExpression()
void AddUnsignedConstant(uint64_t Value)
Emit an unsigned constant.
Optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
Class for arbitrary precision integers.
void EmitUnsigned(uint64_t Value) override
Emit a raw unsigned value.
bool AddMachineReg(const TargetRegisterInfo &TRI, unsigned MachineReg, unsigned MaxSize=~1U)
Emit a partial DWARF register operation.
unsigned SubRegisterSizeInBits
Sometimes we need to add a DW_OP_bit_piece to describe a subregister.
void consume(unsigned N)
Consume N operations.
void AddSignedConstant(int64_t Value)
Emit a signed constant.
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...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool AddMachineRegExpression(const TargetRegisterInfo &TRI, DIExpressionCursor &Expr, unsigned MachineReg, unsigned FragmentOffsetInBits=0)
Emit a machine register location.
LLVM Value Representation.
virtual void EmitSigned(int64_t Value)=0
Emit a raw signed value.
An iterator for expression operands.
void AddStackValue()
Emit a DW_OP_stack_value, if supported.
expr_op_iterator expr_op_end() const
void AddReg(int DwarfReg, const char *Comment=nullptr)
Emit a dwarf register operation.
virtual bool isFrameRegister(const TargetRegisterInfo &TRI, unsigned MachineReg)=0
Return whether the given machine register is the frame register in the current function.