1 //===-- llvm/CodeGen/SDDbgValue.h - SD dbg_value handling--------*- 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_SDDBGVALUE_H
15 #define LLVM_CODEGEN_SDDBGVALUE_H
17 #include "llvm/ADT/SmallVector.h"
18 #include "llvm/Support/DebugLoc.h"
26 /// SDDbgValue - Holds the information from a dbg_value node through SDISel.
27 /// We do not use SDValue here to avoid including its header.
32 SDNODE = 0, // value is the result of an expression
33 CONST = 1, // value is a constant
34 FRAMEIX = 2 // value is contents of a stack location
37 enum DbgValueKind kind;
40 SDNode *Node; // valid for expressions
41 unsigned ResNo; // valid for expressions
43 Value *Const; // valid for constants
44 unsigned FrameIx; // valid for stack objects
51 // Constructor for non-constants.
52 SDDbgValue(MDNode *mdP, SDNode *N, unsigned R, uint64_t off, DebugLoc dl,
53 unsigned O) : mdPtr(mdP), Offset(off), DL(dl), Order(O) {
59 // Constructor for constants.
60 SDDbgValue(MDNode *mdP, Value *C, uint64_t off, DebugLoc dl, unsigned O) :
61 mdPtr(mdP), Offset(off), DL(dl), Order(O) {
66 // Constructor for frame indices.
67 SDDbgValue(MDNode *mdP, unsigned FI, uint64_t off, DebugLoc dl, unsigned O) :
68 mdPtr(mdP), Offset(off), DL(dl), Order(O) {
74 DbgValueKind getKind() { return kind; }
76 // Returns the MDNode pointer.
77 MDNode *getMDPtr() { return mdPtr; }
79 // Returns the SDNode* for a register ref
80 SDNode *getSDNode() { assert (kind==SDNODE); return u.s.Node; }
82 // Returns the ResNo for a register ref
83 unsigned getResNo() { assert (kind==SDNODE); return u.s.ResNo; }
85 // Returns the Value* for a constant
86 Value *getConst() { assert (kind==CONST); return u.Const; }
88 // Returns the FrameIx for a stack object
89 unsigned getFrameIx() { assert (kind==FRAMEIX); return u.FrameIx; }
91 // Returns the offset.
92 uint64_t getOffset() { return Offset; }
94 // Returns the DebugLoc.
95 DebugLoc getDebugLoc() { return DL; }
97 // Returns the SDNodeOrder. This is the order of the preceding node in the
99 unsigned getOrder() { return Order; }
102 } // end llvm namespace