#ifndef LLVM_CODEGEN_SDNODEDBGVALUE_H
#define LLVM_CODEGEN_SDNODEDBGVALUE_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/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 *mdPtr;
uint64_t Offset;
DebugLoc DL;
unsigned Order;
bool Invalid;
public:
SDDbgValue(MDNode *mdP, SDNode *N, unsigned R, uint64_t off, DebugLoc dl,
unsigned O) : mdPtr(mdP), Offset(off), DL(dl), Order(O),
Invalid(false) {
kind = SDNODE;
u.s.Node = N;
u.s.ResNo = R;
}
SDDbgValue(MDNode *mdP, const Value *C, uint64_t off, DebugLoc dl,
unsigned O) :
mdPtr(mdP), Offset(off), DL(dl), Order(O), Invalid(false) {
kind = CONST;
u.Const = C;
}
SDDbgValue(MDNode *mdP, unsigned FI, uint64_t off, DebugLoc dl, unsigned O) :
mdPtr(mdP), Offset(off), DL(dl), Order(O), Invalid(false) {
kind = FRAMEIX;
u.FrameIx = FI;
}
DbgValueKind getKind() { return kind; }
MDNode *getMDPtr() { return mdPtr; }
SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; }
unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; }
const Value *getConst() { assert (kind==CONST); return u.Const; }
unsigned getFrameIx() { assert (kind==FRAMEIX); return u.FrameIx; }
uint64_t getOffset() { return Offset; }
DebugLoc getDebugLoc() { return DL; }
unsigned getOrder() { return Order; }
void setIsInvalidated() { Invalid = true; }
bool isInvalidated() { return Invalid; }
};
}
#endif