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 /// Either Const or Node is nonzero, but not both.
28 /// We do not use SDValue here to avoid including its header.
31 SDNode *Node; // valid for non-constants
32 unsigned ResNo; // valid for non-constants
33 Value *Const; // valid for constants
39 // Constructor for non-constants.
40 SDDbgValue(MDNode *mdP, SDNode *N, unsigned R, uint64_t off, DebugLoc dl,
42 Node(N), ResNo(R), Const(0), mdPtr(mdP), Offset(off), DL(dl), Order(O) {}
44 // Constructor for constants.
45 SDDbgValue(MDNode *mdP, Value *C, uint64_t off, DebugLoc dl, unsigned O) :
46 Node(0), ResNo(0), Const(C), mdPtr(mdP), Offset(off), DL(dl), Order(O) {}
48 // Returns the MDNode pointer.
49 MDNode *getMDPtr() { return mdPtr; }
51 // Returns the SDNode* (valid for non-constants only).
52 SDNode *getSDNode() { assert (!Const); return Node; }
54 // Returns the ResNo (valid for non-constants only).
55 unsigned getResNo() { assert (!Const); return ResNo; }
57 // Returns the Value* for a constant (invalid for non-constants).
58 Value *getConst() { assert (!Node); return Const; }
60 // Returns the offset.
61 uint64_t getOffset() { return Offset; }
63 // Returns the DebugLoc.
64 DebugLoc getDebugLoc() { return DL; }
66 // Returns the SDNodeOrder. This is the order of the preceding node in the
68 unsigned getOrder() { return Order; }
71 } // end llvm namespace