2010-03-14 19:56:39 +00:00
|
|
|
//===-- llvm/CodeGen/SDNodeDbgValue.h - SelectionDAG dbg_value --*- C++ -*-===//
|
2010-03-06 00:03:23 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file declares the SDDbgValue class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_CODEGEN_SELECTIONDAG_SDNODEDBGVALUE_H
|
|
|
|
#define LLVM_LIB_CODEGEN_SELECTIONDAG_SDNODEDBGVALUE_H
|
2010-03-06 00:03:23 +00:00
|
|
|
|
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2014-03-05 10:30:38 +00:00
|
|
|
#include "llvm/IR/DebugLoc.h"
|
2010-11-29 18:16:10 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2010-03-06 00:03:23 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MDNode;
|
|
|
|
class SDNode;
|
|
|
|
class Value;
|
|
|
|
|
|
|
|
/// SDDbgValue - Holds the information from a dbg_value node through SDISel.
|
|
|
|
/// We do not use SDValue here to avoid including its header.
|
|
|
|
|
2013-09-11 18:05:11 +00:00
|
|
|
class SDDbgValue {
|
2010-03-10 22:13:47 +00:00
|
|
|
public:
|
|
|
|
enum DbgValueKind {
|
2010-03-10 23:37:24 +00:00
|
|
|
SDNODE = 0, // value is the result of an expression
|
|
|
|
CONST = 1, // value is a constant
|
|
|
|
FRAMEIX = 2 // value is contents of a stack location
|
2010-03-10 22:13:47 +00:00
|
|
|
};
|
|
|
|
private:
|
|
|
|
enum DbgValueKind kind;
|
|
|
|
union {
|
|
|
|
struct {
|
2010-03-10 23:37:24 +00:00
|
|
|
SDNode *Node; // valid for expressions
|
|
|
|
unsigned ResNo; // valid for expressions
|
2010-03-10 22:13:47 +00:00
|
|
|
} s;
|
2010-04-15 01:51:59 +00:00
|
|
|
const Value *Const; // valid for constants
|
2010-03-10 22:13:47 +00:00
|
|
|
unsigned FrameIx; // valid for stack objects
|
|
|
|
} u;
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
MDNode *Var;
|
|
|
|
MDNode *Expr;
|
2014-04-25 20:49:25 +00:00
|
|
|
bool IsIndirect;
|
2010-03-06 00:03:23 +00:00
|
|
|
uint64_t Offset;
|
|
|
|
DebugLoc DL;
|
2010-03-08 05:39:50 +00:00
|
|
|
unsigned Order;
|
2010-03-25 01:38:16 +00:00
|
|
|
bool Invalid;
|
2010-03-06 00:03:23 +00:00
|
|
|
public:
|
|
|
|
// Constructor for non-constants.
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
SDDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, bool indir,
|
|
|
|
uint64_t off, DebugLoc dl, unsigned O)
|
|
|
|
: Var(Var), Expr(Expr), IsIndirect(indir), Offset(off), DL(dl), Order(O),
|
|
|
|
Invalid(false) {
|
2010-03-10 23:37:24 +00:00
|
|
|
kind = SDNODE;
|
2010-03-10 22:13:47 +00:00
|
|
|
u.s.Node = N;
|
|
|
|
u.s.ResNo = R;
|
|
|
|
}
|
2010-03-06 00:03:23 +00:00
|
|
|
|
|
|
|
// Constructor for constants.
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
SDDbgValue(MDNode *Var, MDNode *Expr, const Value *C, uint64_t off,
|
|
|
|
DebugLoc dl, unsigned O)
|
|
|
|
: Var(Var), Expr(Expr), IsIndirect(false), Offset(off), DL(dl), Order(O),
|
|
|
|
Invalid(false) {
|
2010-03-10 23:37:24 +00:00
|
|
|
kind = CONST;
|
2010-03-10 22:13:47 +00:00
|
|
|
u.Const = C;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Constructor for frame indices.
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
SDDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, uint64_t off, DebugLoc dl,
|
|
|
|
unsigned O)
|
|
|
|
: Var(Var), Expr(Expr), IsIndirect(false), Offset(off), DL(dl), Order(O),
|
|
|
|
Invalid(false) {
|
2010-03-10 23:37:24 +00:00
|
|
|
kind = FRAMEIX;
|
2010-03-10 22:13:47 +00:00
|
|
|
u.FrameIx = FI;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the kind.
|
2014-10-13 20:43:47 +00:00
|
|
|
DbgValueKind getKind() const { return kind; }
|
2010-03-06 00:03:23 +00:00
|
|
|
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
// Returns the MDNode pointer for the variable.
|
2014-10-13 20:43:47 +00:00
|
|
|
MDNode *getVariable() const { return Var; }
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
|
|
|
|
// Returns the MDNode pointer for the expression.
|
2014-10-13 20:43:47 +00:00
|
|
|
MDNode *getExpression() const { return Expr; }
|
2010-03-06 00:03:23 +00:00
|
|
|
|
2010-03-10 22:13:47 +00:00
|
|
|
// Returns the SDNode* for a register ref
|
2014-10-13 20:43:47 +00:00
|
|
|
SDNode *getSDNode() const { assert (kind==SDNODE); return u.s.Node; }
|
2010-03-10 22:13:47 +00:00
|
|
|
|
|
|
|
// Returns the ResNo for a register ref
|
2014-10-13 20:43:47 +00:00
|
|
|
unsigned getResNo() const { assert (kind==SDNODE); return u.s.ResNo; }
|
2010-03-06 00:03:23 +00:00
|
|
|
|
2010-03-10 22:13:47 +00:00
|
|
|
// Returns the Value* for a constant
|
2014-10-13 20:43:47 +00:00
|
|
|
const Value *getConst() const { assert (kind==CONST); return u.Const; }
|
2010-03-06 00:03:23 +00:00
|
|
|
|
2010-03-10 22:13:47 +00:00
|
|
|
// Returns the FrameIx for a stack object
|
2014-10-13 20:43:47 +00:00
|
|
|
unsigned getFrameIx() const { assert (kind==FRAMEIX); return u.FrameIx; }
|
2010-03-06 00:03:23 +00:00
|
|
|
|
2014-04-25 20:49:25 +00:00
|
|
|
// Returns whether this is an indirect value.
|
2014-10-13 20:43:47 +00:00
|
|
|
bool isIndirect() const { return IsIndirect; }
|
2014-04-25 20:49:25 +00:00
|
|
|
|
2010-03-06 00:03:23 +00:00
|
|
|
// Returns the offset.
|
2014-10-13 20:43:47 +00:00
|
|
|
uint64_t getOffset() const { return Offset; }
|
2010-03-06 00:03:23 +00:00
|
|
|
|
|
|
|
// Returns the DebugLoc.
|
2014-10-13 20:43:47 +00:00
|
|
|
DebugLoc getDebugLoc() const { return DL; }
|
2010-03-08 05:39:50 +00:00
|
|
|
|
|
|
|
// Returns the SDNodeOrder. This is the order of the preceding node in the
|
|
|
|
// input.
|
2014-10-13 20:43:47 +00:00
|
|
|
unsigned getOrder() const { return Order; }
|
2010-03-25 01:38:16 +00:00
|
|
|
|
|
|
|
// setIsInvalidated / isInvalidated - Setter / getter of the "Invalidated"
|
|
|
|
// property. A SDDbgValue is invalid if the SDNode that produces the value is
|
|
|
|
// deleted.
|
|
|
|
void setIsInvalidated() { Invalid = true; }
|
2014-10-13 20:43:47 +00:00
|
|
|
bool isInvalidated() const { return Invalid; }
|
2010-03-06 00:03:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end llvm namespace
|
|
|
|
|
|
|
|
#endif
|