Dale Johannesen | 06a2663 | 2010-03-06 00:03:23 +0000 | [diff] [blame^] | 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 | public: |
| 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 |