#ifndef LLVM_LIB_CODEGEN_SELECTIONDAG_SDNODEDBGVALUE_H
#define LLVM_LIB_CODEGEN_SELECTIONDAG_SDNODEDBGVALUE_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
class MDNode;
class SDNode;
class Value;
class SDDbgValue {
public:
enum DbgValueKind {
SDNODE = 0, CONST = 1, FRAMEIX = 2 };
private:
enum DbgValueKind kind;
union {
struct {
SDNode *Node; unsigned ResNo; } s;
const Value *Const; unsigned FrameIx; } u;
MDNode *Var;
MDNode *Expr;
bool IsIndirect;
uint64_t Offset;
DebugLoc DL;
unsigned Order;
bool Invalid;
public:
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) {
kind = SDNODE;
u.s.Node = N;
u.s.ResNo = R;
}
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) {
kind = CONST;
u.Const = C;
}
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) {
kind = FRAMEIX;
u.FrameIx = FI;
}
DbgValueKind getKind() const { return kind; }
MDNode *getVariable() const { return Var; }
MDNode *getExpression() const { return Expr; }
SDNode *getSDNode() const { assert (kind==SDNODE); return u.s.Node; }
unsigned getResNo() const { assert (kind==SDNODE); return u.s.ResNo; }
const Value *getConst() const { assert (kind==CONST); return u.Const; }
unsigned getFrameIx() const { assert (kind==FRAMEIX); return u.FrameIx; }
bool isIndirect() const { return IsIndirect; }
uint64_t getOffset() const { return Offset; }
DebugLoc getDebugLoc() const { return DL; }
unsigned getOrder() const { return Order; }
void setIsInvalidated() { Invalid = true; }
bool isInvalidated() const { return Invalid; }
};
}
#endif