blob: 9e15fc98bc4d5da62393405cee6a4cce0832b088 [file] [log] [blame]
Dale Johannesen06a26632010-03-06 00:03:23 +00001//===-- llvm/CodeGen/SDDbgValue.h - SD dbg_value handling--------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the SDDbgValue class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_SDDBGVALUE_H
15#define LLVM_CODEGEN_SDDBGVALUE_H
16
17#include "llvm/ADT/SmallVector.h"
18#include "llvm/Support/DebugLoc.h"
19
20namespace llvm {
21
22class MDNode;
23class SDNode;
24class Value;
25
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.
29
30class SDDbgValue {
31 SDNode *Node; // valid for non-constants
32 unsigned ResNo; // valid for non-constants
33 Value *Const; // valid for constants
34 MDNode *mdPtr;
35 uint64_t Offset;
36 DebugLoc DL;
37public:
38 // Constructor for non-constants.
39 SDDbgValue(MDNode *mdP, SDNode *N, unsigned R, uint64_t off, DebugLoc dl) :
40 Node(N), ResNo(R), Const(0), mdPtr(mdP), Offset(off), DL(dl) {}
41
42 // Constructor for constants.
43 SDDbgValue(MDNode *mdP, Value *C, uint64_t off, DebugLoc dl) : Node(0),
44 ResNo(0), Const(C), mdPtr(mdP), Offset(off), DL(dl) {}
45
46 // Returns the MDNode pointer.
47 MDNode *getMDPtr() { return mdPtr; }
48
49 // Returns the SDNode* (valid for non-constants only).
50 SDNode *getSDNode() { assert (!Const); return Node; }
51
52 // Returns the ResNo (valid for non-constants only).
53 unsigned getResNo() { assert (!Const); return ResNo; }
54
55 // Returns the Value* for a constant (invalid for non-constants).
56 Value *getConst() { assert (!Node); return Const; }
57
58 // Returns the offset.
59 uint64_t getOffset() { return Offset; }
60
61 // Returns the DebugLoc.
62 DebugLoc getDebugLoc() { return DL; }
63};
64
65} // end llvm namespace
66
67#endif