1
//===-- llvm/CodeGen/SDNodeDbgValue.h - SelectionDAG dbg_value --*- C++ -*-===//
3
// The LLVM Compiler Infrastructure
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
10
// This file declares the SDDbgValue class.
12
//===----------------------------------------------------------------------===//
14
#ifndef LLVM_CODEGEN_SDNODEDBGVALUE_H
15
#define LLVM_CODEGEN_SDNODEDBGVALUE_H
17
#include "llvm/ADT/SmallVector.h"
18
#include "llvm/Support/DebugLoc.h"
19
#include "llvm/System/DataTypes.h"
27
/// SDDbgValue - Holds the information from a dbg_value node through SDISel.
28
/// We do not use SDValue here to avoid including its header.
33
SDNODE = 0, // value is the result of an expression
34
CONST = 1, // value is a constant
35
FRAMEIX = 2 // value is contents of a stack location
38
enum DbgValueKind kind;
41
SDNode *Node; // valid for expressions
42
unsigned ResNo; // valid for expressions
44
const Value *Const; // valid for constants
45
unsigned FrameIx; // valid for stack objects
53
// Constructor for non-constants.
54
SDDbgValue(MDNode *mdP, SDNode *N, unsigned R, uint64_t off, DebugLoc dl,
55
unsigned O) : mdPtr(mdP), Offset(off), DL(dl), Order(O),
62
// Constructor for constants.
63
SDDbgValue(MDNode *mdP, const Value *C, uint64_t off, DebugLoc dl,
65
mdPtr(mdP), Offset(off), DL(dl), Order(O), Invalid(false) {
70
// Constructor for frame indices.
71
SDDbgValue(MDNode *mdP, unsigned FI, uint64_t off, DebugLoc dl, unsigned O) :
72
mdPtr(mdP), Offset(off), DL(dl), Order(O), Invalid(false) {
78
DbgValueKind getKind() { return kind; }
80
// Returns the MDNode pointer.
81
MDNode *getMDPtr() { return mdPtr; }
83
// Returns the SDNode* for a register ref
84
SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; }
86
// Returns the ResNo for a register ref
87
unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; }
89
// Returns the Value* for a constant
90
const Value *getConst() { assert (kind==CONST); return u.Const; }
92
// Returns the FrameIx for a stack object
93
unsigned getFrameIx() { assert (kind==FRAMEIX); return u.FrameIx; }
95
// Returns the offset.
96
uint64_t getOffset() { return Offset; }
98
// Returns the DebugLoc.
99
DebugLoc getDebugLoc() { return DL; }
101
// Returns the SDNodeOrder. This is the order of the preceding node in the
103
unsigned getOrder() { return Order; }
105
// setIsInvalidated / isInvalidated - Setter / getter of the "Invalidated"
106
// property. A SDDbgValue is invalid if the SDNode that produces the value is
108
void setIsInvalidated() { Invalid = true; }
109
bool isInvalidated() { return Invalid; }
112
} // end llvm namespace