[llvm-commits] [llvm] r63136 - /llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Dale Johannesen
dalej at apple.com
Tue Jan 27 13:41:04 PST 2009
Author: johannes
Date: Tue Jan 27 15:41:04 2009
New Revision: 63136
URL: http://llvm.org/viewvc/llvm-project?rev=63136&view=rev
Log:
Add DebugLoc field and simple accessors.
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=63136&r1=63135&r2=63136&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Jan 27 15:41:04 2009
@@ -30,6 +30,7 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/RecyclingAllocator.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/CodeGen/DebugLoc.h"
#include <cassert>
namespace llvm {
@@ -901,6 +902,7 @@
inline bool isTargetOpcode() const;
inline bool isMachineOpcode() const;
inline unsigned getMachineOpcode() const;
+ inline DebugLoc getDebugLoc() const;
/// reachesChainWithoutSideEffects - Return true if this operand (which must
@@ -1077,6 +1079,9 @@
/// NodeId - Unique id per SDNode in the DAG.
int NodeId;
+ /// debugLoc - source line information.
+ DebugLoc debugLoc;
+
/// OperandList - The values that are used by this operation.
///
SDUse *OperandList;
@@ -1146,6 +1151,12 @@
/// setNodeId - Set unique node id.
void setNodeId(int Id) { NodeId = Id; }
+ /// getDebugLoc - Return the source location info.
+ DebugLoc getDebugLoc() const { return debugLoc; }
+
+ /// setDebugLoc - Set source location info.
+ void setDebugLoc(DebugLoc sl) { debugLoc = sl; }
+
/// use_iterator - This class provides iterator support for SDUse
/// operands that use a specific SDNode.
class use_iterator
@@ -1326,9 +1337,11 @@
return Ret;
}
+ /// The constructors that supply DebugLoc explicitly should be preferred
+ /// for new code.
SDNode(unsigned Opc, SDVTList VTs, const SDValue *Ops, unsigned NumOps)
: NodeType(Opc), OperandsNeedDelete(true), SubclassData(0),
- NodeId(-1),
+ NodeId(-1), debugLoc(DebugLoc::getNoDebugLoc()),
OperandList(NumOps ? new SDUse[NumOps] : 0),
ValueList(VTs.VTs),
NumOperands(NumOps), NumValues(VTs.NumVTs),
@@ -1343,8 +1356,33 @@
/// set later with InitOperands.
SDNode(unsigned Opc, SDVTList VTs)
: NodeType(Opc), OperandsNeedDelete(false), SubclassData(0),
- NodeId(-1), OperandList(0), ValueList(VTs.VTs),
- NumOperands(0), NumValues(VTs.NumVTs),
+ NodeId(-1), debugLoc(DebugLoc::getNoDebugLoc()), OperandList(0),
+ ValueList(VTs.VTs), NumOperands(0), NumValues(VTs.NumVTs),
+ UseList(NULL) {}
+
+ /// The next two constructors specify DebugLoc explicitly; the intent
+ /// is that they will replace the above two over time, and eventually
+ /// the ones above can be removed.
+ SDNode(unsigned Opc, SDVTList VTs, const SDValue *Ops, unsigned NumOps,
+ DebugLoc sl)
+ : NodeType(Opc), OperandsNeedDelete(true), SubclassData(0),
+ NodeId(-1), debugLoc(sl),
+ OperandList(NumOps ? new SDUse[NumOps] : 0),
+ ValueList(VTs.VTs),
+ NumOperands(NumOps), NumValues(VTs.NumVTs),
+ UseList(NULL) {
+ for (unsigned i = 0; i != NumOps; ++i) {
+ OperandList[i].setUser(this);
+ OperandList[i].setInitial(Ops[i]);
+ }
+ }
+
+ /// This constructor adds no operands itself; operands can be
+ /// set later with InitOperands.
+ SDNode(unsigned Opc, SDVTList VTs, DebugLoc sl)
+ : NodeType(Opc), OperandsNeedDelete(false), SubclassData(0),
+ NodeId(-1), debugLoc(sl), OperandList(0),
+ ValueList(VTs.VTs), NumOperands(0), NumValues(VTs.NumVTs),
UseList(NULL) {}
/// InitOperands - Initialize the operands list of this with 1 operand.
@@ -1441,6 +1479,9 @@
inline bool SDValue::hasOneUse() const {
return Node->hasNUsesOfValue(1, ResNo);
}
+inline DebugLoc SDValue::getDebugLoc() const {
+ return Node->getDebugLoc();
+}
// Define inline functions from the SDUse class.
More information about the llvm-commits
mailing list