+/// SDDbgInfo - Keeps track of dbg_value information through SDISel. We do
+/// not build SDNodes for these so as not to perturb the generated code;
+/// instead the info is kept off to the side in this structure. SDNodes may
+/// have an associated dbg_value entry in DbgValMap. Debug info that is not
+/// associated with any SDNode is held in DbgConstMap. It is possible for
+/// optimizations to change a variable to a constant, in which case the
+/// corresponding debug info is moved from the variable to the constant table
+/// (NYI).
+class SDDbgInfo {
+ DenseMap<const SDNode*, SDDbgValue*> DbgVblMap;
+ SmallVector<SDDbgValue*, 4> DbgConstMap;
+
+ void operator=(const SDDbgInfo&); // Do not implement.
+ SDDbgInfo(const SDDbgInfo&); // Do not implement.
+public:
+ SDDbgInfo() {}
+
+ void add(const SDNode *Node, SDDbgValue *V) {
+ DbgVblMap[Node] = V;
+ }
+ void add(SDDbgValue *V) { DbgConstMap.push_back(V); }
+ void remove(const SDNode *Node) {
+ DenseMap<const SDNode*, SDDbgValue*>::iterator Itr =
+ DbgVblMap.find(Node);
+ if (Itr != DbgVblMap.end())
+ DbgVblMap.erase(Itr);
+ }
+ // No need to remove a constant.
+ void clear() {
+ DbgVblMap.clear();
+ DbgConstMap.clear();
+ }
+ SDDbgValue *getSDDbgValue(const SDNode *Node) {
+ return DbgVblMap[Node];
+ }
+ typedef SmallVector<SDDbgValue*, 4>::iterator ConstDbgIterator;
+ ConstDbgIterator DbgConstBegin() { return DbgConstMap.begin(); }
+ ConstDbgIterator DbgConstEnd() { return DbgConstMap.end(); }
+};
+