Print the correct index in the "match failed at index" message.
[oota-llvm.git] / lib / CodeGen / SelectionDAG / SDDbgValue.h
1 //===-- 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
20 namespace llvm {
21
22 class MDNode;
23 class SDNode;
24 class 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
30 class 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;
37   unsigned Order;
38 public:
39   // Constructor for non-constants.
40   SDDbgValue(MDNode *mdP, SDNode *N, unsigned R, uint64_t off, DebugLoc dl,
41              unsigned O) :
42     Node(N), ResNo(R), Const(0), mdPtr(mdP), Offset(off), DL(dl), Order(O) {}
43
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) {}
47
48   // Returns the MDNode pointer.
49   MDNode *getMDPtr() { return mdPtr; }
50
51   // Returns the SDNode* (valid for non-constants only).
52   SDNode *getSDNode() { assert (!Const); return Node; }
53
54   // Returns the ResNo (valid for non-constants only).
55   unsigned getResNo() { assert (!Const); return ResNo; }
56
57   // Returns the Value* for a constant (invalid for non-constants).
58   Value *getConst() { assert (!Node); return Const; }
59
60   // Returns the offset.
61   uint64_t getOffset() { return Offset; }
62
63   // Returns the DebugLoc.
64   DebugLoc getDebugLoc() { return DL; }
65
66   // Returns the SDNodeOrder.  This is the order of the preceding node in the
67   // input.
68   unsigned getOrder() { return Order; }
69 };
70
71 } // end llvm namespace
72
73 #endif