LLVM  5.0.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::DIExpression Class Reference

DWARF expression. More...

#include "llvm/IR/DebugInfoMetadata.h"

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

Classes

class  expr_op_iterator
 An iterator for expression operands. More...
 
class  ExprOperand
 A lightweight wrapper around an expression operand. More...
 
struct  FragmentInfo
 Holds the characteristics of one fragment of a larger variable. More...
 

Public Types

enum  { NoDeref = false, WithDeref = true, WithStackValue = true }
 Constants for DIExpression::prepend. More...
 
using element_iterator = ArrayRef< uint64_t >::iterator
 
- Public Types inherited from llvm::MDNode
using op_iterator = const MDOperand *
 
using op_range = iterator_range< op_iterator >
 

Public Member Functions

 DEFINE_MDNODE_GET (DIExpression,(ArrayRef< uint64_t > Elements),(Elements)) TempDIExpression clone() const
 
ArrayRef< uint64_t > getElements () const
 
unsigned getNumElements () const
 
uint64_t getElement (unsigned I) const
 
bool isConstant () const
 Determine whether this represents a standalone constant value. More...
 
element_iterator elements_begin () const
 
element_iterator elements_end () const
 
bool isValid () const
 
bool startsWithDeref () const
 Return whether the first element a DW_OP_deref. More...
 
Optional< FragmentInfo > getFragmentInfo () const
 Retrieve the details of this fragment expression. More...
 
bool isFragment () const
 Return whether this is a piece of an aggregate variable. More...
 
bool extractIfOffset (int64_t &Offset) const
 If this is a constant offset, extract it. More...
 
expr_op_iterator expr_op_begin () const
 Visit the elements via ExprOperand wrappers. More...
 
expr_op_iterator expr_op_end () const
 
iterator_range< expr_op_iterator > expr_ops () const
 
- Public Member Functions inherited from llvm::MDNode
 MDNode (const MDNode &)=delete
 
void operator= (const MDNode &)=delete
 
void * operator new (size_t)=delete
 
TempMDNode clone () const
 Create a (temporary) clone of this. More...
 
LLVMContext & getContext () const
 
void replaceOperandWith (unsigned I, Metadata *New)
 Replace a specific operand. More...
 
bool isResolved () const
 Check if node is fully resolved. More...
 
bool isUniqued () const
 
bool isDistinct () const
 
bool isTemporary () const
 
void replaceAllUsesWith (Metadata *MD)
 RAUW a temporary. More...
 
void resolveCycles ()
 Resolve cycles. More...
 
op_iterator op_begin () const
 
op_iterator op_end () const
 
op_range operands () const
 
const MDOperand & getOperand (unsigned I) const
 
unsigned getNumOperands () const
 Return number of MDNode operands. More...
 
bool isTBAAVtableAccess () const
 Check whether MDNode is a vtable access. More...
 

Static Public Member Functions

static bool classof (const Metadata *MD)
 
static Optional< FragmentInfo > getFragmentInfo (expr_op_iterator Start, expr_op_iterator End)
 Retrieve the details of this fragment expression. More...
 
static void appendOffset (SmallVectorImpl< uint64_t > &Ops, int64_t Offset)
 Append Ops with operations to apply the Offset. More...
 
static DIExpression * prepend (const DIExpression *DIExpr, bool Deref, int64_t Offset=0, bool StackValue=false)
 Prepend DIExpr with a deref and offset operation and optionally turn it into a stack value. More...
 
- Static Public Member Functions inherited from llvm::MDNode
static MDTuple * get (LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
static MDTuple * getIfExists (LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
static MDTuple * getDistinct (LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
static TempMDTuple getTemporary (LLVMContext &Context, ArrayRef< Metadata * > MDs)
 
static void deleteTemporary (MDNode *N)
 Deallocate a node created by getTemporary. More...
 
template<class T >
static std::enable_if
< std::is_base_of< MDNode, T >
::value, T * >::type 
replaceWithPermanent (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a permanent one. More...
 
template<class T >
static std::enable_if
< std::is_base_of< MDNode, T >
::value, T * >::type 
replaceWithUniqued (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a uniqued one. More...
 
template<class T >
static std::enable_if
< std::is_base_of< MDNode, T >
::value, T * >::type 
replaceWithDistinct (std::unique_ptr< T, TempMDNodeDeleter > N)
 Replace a temporary node with a distinct one. More...
 
static bool classof (const Metadata *MD)
 Methods for support type inquiry through isa, cast, and dyn_cast: More...
 
static MDNode * concatenate (MDNode *A, MDNode *B)
 Methods for metadata merging. More...
 
static MDNode * intersect (MDNode *A, MDNode *B)
 
static MDNode * getMostGenericTBAA (MDNode *A, MDNode *B)
 
static MDNode * getMostGenericFPMath (MDNode *A, MDNode *B)
 
static MDNode * getMostGenericRange (MDNode *A, MDNode *B)
 
static MDNode * getMostGenericAliasScope (MDNode *A, MDNode *B)
 
static MDNode * getMostGenericAlignmentOrDereferenceable (MDNode *A, MDNode *B)
 

Friends

class LLVMContextImpl
 
class MDNode
 

Additional Inherited Members

- Protected Types inherited from llvm::MDNode
using mutable_op_range = iterator_range< MDOperand * >
 
 Active type of storage. More...
- Protected Member Functions inherited from llvm::MDNode
 MDNode (LLVMContext &Context, unsigned ID, StorageType Storage, ArrayRef< Metadata * > Ops1, ArrayRef< Metadata * > Ops2=None)
 
 ~MDNode ()=default
 
void * operator new (size_t Size, unsigned NumOps)
 
void operator delete (void *Mem)
 
void operator delete (void *, unsigned)
 Required by std, but never called. More...
 
void operator delete (void *, unsigned, bool)
 Required by std, but never called. More...
 
void dropAllReferences ()
 
MDOperand * mutable_begin ()
 
MDOperand * mutable_end ()
 
mutable_op_range mutable_operands ()
 
void setOperand (unsigned I, Metadata *New)
 Set an operand. More...
 
void storeDistinctInContext ()
 
- Static Protected Member Functions inherited from llvm::MDNode
template<class T , class StoreT >
static T * storeImpl (T *N, StorageType Storage, StoreT &Store)
 
template<class T >
static T * storeImpl (T *N, StorageType Storage)
 

Detailed Description

DWARF expression.

This is (almost) a DWARF expression that modifies the location of a variable, or the location of a single piece of a variable, or (when using DW_OP_stack_value) is the constant variable value.

TODO: Co-allocate the expression elements. TODO: Separate from MDNode, or otherwise drop Distinct and Temporary storage types.

Definition at line 2123 of file DebugInfoMetadata.h.

Member Typedef Documentation

using llvm::DIExpression::element_iterator = ArrayRef<uint64_t>::iterator

Definition at line 2159 of file DebugInfoMetadata.h.

Member Enumeration Documentation

anonymous enum

Constants for DIExpression::prepend.

Enumerator
NoDeref 
WithDeref 
WithStackValue 

Definition at line 2290 of file DebugInfoMetadata.h.

Member Function Documentation

void DIExpression::appendOffset ( SmallVectorImpl< uint64_t > &  Ops,
int64_t  Offset 
)
static

Append Ops with operations to apply the Offset.

Definition at line 664 of file DebugInfoMetadata.cpp.

References llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().

Referenced by prepend(), and replaceOneDbgValueForAlloca().

static bool llvm::DIExpression::classof ( const Metadata *  MD)
inlinestatic

Definition at line 2255 of file DebugInfoMetadata.h.

References llvm::Metadata::getMetadataID().

llvm::DIExpression::DEFINE_MDNODE_GET ( DIExpression  ,
(ArrayRef< uint64_t > Elements)  ,
(Elements)   
) const
inline

Definition at line 2143 of file DebugInfoMetadata.h.

element_iterator llvm::DIExpression::elements_begin ( ) const
inline
element_iterator llvm::DIExpression::elements_end ( ) const
inline
expr_op_iterator llvm::DIExpression::expr_op_begin ( ) const
inline

Visit the elements via ExprOperand wrappers.

These range iterators visit elements through ExprOperand wrappers. This is not guaranteed to be a valid range unless isValid() gives true.

Precondition
isValid() gives true.

Definition at line 2242 of file DebugInfoMetadata.h.

References elements_begin().

Referenced by llvm::DIExpressionCursor::DIExpressionCursor(), expr_ops(), getFragmentInfo(), and isValid().

expr_op_iterator llvm::DIExpression::expr_op_end ( ) const
inline
iterator_range<expr_op_iterator> llvm::DIExpression::expr_ops ( ) const
inline

Definition at line 2248 of file DebugInfoMetadata.h.

References expr_op_begin(), and expr_op_end().

Referenced by emitDebugValueComment(), and prepend().

bool DIExpression::extractIfOffset ( int64_t &  Offset) const

If this is a constant offset, extract it.

If there is no expression, return true with an offset of zero.

Definition at line 676 of file DebugInfoMetadata.cpp.

References getNumElements().

uint64_t llvm::DIExpression::getElement ( unsigned  I) const
inline
ArrayRef<uint64_t> llvm::DIExpression::getElements ( ) const
inline
Optional< DIExpression::FragmentInfo > DIExpression::getFragmentInfo ( expr_op_iterator  Start,
expr_op_iterator  End 
)
static
Optional<FragmentInfo> llvm::DIExpression::getFragmentInfo ( ) const
inline

Retrieve the details of this fragment expression.

Definition at line 2275 of file DebugInfoMetadata.h.

References expr_op_begin(), and expr_op_end().

Referenced by llvm::DIExpressionCursor::getFragmentInfo(), and isFragment().

unsigned llvm::DIExpression::getNumElements ( ) const
inline
bool DIExpression::isConstant ( ) const

Determine whether this represents a standalone constant value.

Definition at line 727 of file DebugInfoMetadata.cpp.

References llvm::dwarf::DW_OP_LLVM_fragment, getElement(), and getNumElements().

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

bool llvm::DIExpression::isFragment ( ) const
inline

Return whether this is a piece of an aggregate variable.

Definition at line 2280 of file DebugInfoMetadata.h.

References getFragmentInfo().

Referenced by llvm::DwarfExpression::addFragmentOffset(), llvm::DebugHandlerBase::fragmentsOverlap(), and llvm::DebugLocEntry::Value::isFragment().

bool DIExpression::isValid ( ) const
DIExpression * DIExpression::prepend ( const DIExpression *  DIExpr,
bool  Deref,
int64_t  Offset = 0,
bool  StackValue = false 
)
static
bool llvm::DIExpression::startsWithDeref ( ) const
inline

Return whether the first element a DW_OP_deref.

Definition at line 2260 of file DebugInfoMetadata.h.

References getElement(), and getNumElements().

Friends And Related Function Documentation

friend class LLVMContextImpl
friend

Definition at line 2124 of file DebugInfoMetadata.h.

friend class MDNode
friend

Definition at line 2125 of file DebugInfoMetadata.h.


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