1 //===-- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the SelectionDAG class, and transitively defines the
11 // SDNode class and subclasses.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_SELECTIONDAG_H
16 #define LLVM_CODEGEN_SELECTIONDAG_H
18 #include "llvm/CodeGen/SelectionDAGNodes.h"
19 #include "llvm/CodeGen/SelectionDAGCSEMap.h"
20 #include "llvm/ADT/ilist"
30 class MachineDebugInfo;
31 class MachineFunction;
33 /// SelectionDAG class - This is used to represent a portion of an LLVM function
34 /// in a low-level Data Dependence DAG representation suitable for instruction
35 /// selection. This DAG is constructed as the first step of instruction
36 /// selection in order to allow implementation of machine specific optimizations
37 /// and code simplifications.
39 /// The representation used by the SelectionDAG is a target-independent
40 /// representation, which has some similarities to the GCC RTL representation,
41 /// but is significantly more simple, powerful, and is a graph form instead of a
49 // Root - The root of the entire DAG. EntryNode - The starting token.
50 SDOperand Root, EntryNode;
52 // AllNodes - A linked list of nodes in the current DAG.
53 ilist<SDNode> AllNodes;
55 // ValueNodes - track SrcValue nodes
56 std::map<std::pair<const Value*, int>, SDNode*> ValueNodes;
59 SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineDebugInfo *di)
60 : TLI(tli), MF(mf), DI(di) {
61 EntryNode = Root = getNode(ISD::EntryToken, MVT::Other);
65 MachineFunction &getMachineFunction() const { return MF; }
66 const TargetMachine &getTarget() const;
67 TargetLowering &getTargetLoweringInfo() const { return TLI; }
68 MachineDebugInfo *getMachineDebugInfo() const { return DI; }
70 /// viewGraph - Pop up a ghostview window with the DAG rendered using 'dot'.
75 typedef ilist<SDNode>::const_iterator allnodes_const_iterator;
76 allnodes_const_iterator allnodes_begin() const { return AllNodes.begin(); }
77 allnodes_const_iterator allnodes_end() const { return AllNodes.end(); }
78 typedef ilist<SDNode>::iterator allnodes_iterator;
79 allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
80 allnodes_iterator allnodes_end() { return AllNodes.end(); }
82 /// getRoot - Return the root tag of the SelectionDAG.
84 const SDOperand &getRoot() const { return Root; }
86 /// getEntryNode - Return the token chain corresponding to the entry of the
88 const SDOperand &getEntryNode() const { return EntryNode; }
90 /// setRoot - Set the current root tag of the SelectionDAG.
92 const SDOperand &setRoot(SDOperand N) { return Root = N; }
94 /// Combine - This iterates over the nodes in the SelectionDAG, folding
95 /// certain types of nodes together, or eliminating superfluous nodes. When
96 /// the AfterLegalize argument is set to 'true', Combine takes care not to
97 /// generate any nodes that will be illegal on the target.
98 void Combine(bool AfterLegalize);
100 /// Legalize - This transforms the SelectionDAG into a SelectionDAG that is
101 /// compatible with the target instruction selector, as indicated by the
102 /// TargetLowering object.
104 /// Note that this is an involved process that may invalidate pointers into
108 /// RemoveDeadNodes - This method deletes all unreachable nodes in the
110 void RemoveDeadNodes();
112 SDOperand getString(const std::string &Val);
113 SDOperand getConstant(uint64_t Val, MVT::ValueType VT);
114 SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT);
115 SDOperand getConstantFP(double Val, MVT::ValueType VT);
116 SDOperand getTargetConstantFP(double Val, MVT::ValueType VT);
117 SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT,
119 SDOperand getTargetGlobalAddress(const GlobalValue *GV, MVT::ValueType VT,
121 SDOperand getFrameIndex(int FI, MVT::ValueType VT);
122 SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT);
123 SDOperand getJumpTable(int JTI, MVT::ValueType VT);
124 SDOperand getTargetJumpTable(int JTI, MVT::ValueType VT);
125 SDOperand getConstantPool(Constant *C, MVT::ValueType VT,
126 unsigned Alignment=0, int offset = 0);
127 SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT,
128 unsigned Alignment=0, int offset = 0);
129 SDOperand getBasicBlock(MachineBasicBlock *MBB);
130 SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
131 SDOperand getTargetExternalSymbol(const char *Sym, MVT::ValueType VT);
132 SDOperand getValueType(MVT::ValueType);
133 SDOperand getRegister(unsigned Reg, MVT::ValueType VT);
135 SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N) {
136 return getNode(ISD::CopyToReg, MVT::Other, Chain,
137 getRegister(Reg, N.getValueType()), N);
140 // This version of the getCopyToReg method takes an extra operand, which
141 // indicates that there is potentially an incoming flag value (if Flag is not
142 // null) and that there should be a flag result.
143 SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N,
145 std::vector<MVT::ValueType> VTs;
146 VTs.push_back(MVT::Other);
147 VTs.push_back(MVT::Flag);
148 SDOperand Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Flag };
149 return getNode(ISD::CopyToReg, VTs, Ops, Flag.Val ? 4 : 3);
152 // Similar to last getCopyToReg() except parameter Reg is a SDOperand
153 SDOperand getCopyToReg(SDOperand Chain, SDOperand Reg, SDOperand N,
155 std::vector<MVT::ValueType> VTs;
156 VTs.push_back(MVT::Other);
157 VTs.push_back(MVT::Flag);
158 SDOperand Ops[] = { Chain, Reg, N, Flag };
159 return getNode(ISD::CopyToReg, VTs, Ops, Flag.Val ? 4 : 3);
162 SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT::ValueType VT) {
163 std::vector<MVT::ValueType> ResultTys;
164 ResultTys.push_back(VT);
165 ResultTys.push_back(MVT::Other);
166 SDOperand Ops[] = { Chain, getRegister(Reg, VT) };
167 return getNode(ISD::CopyFromReg, ResultTys, Ops, 2);
170 // This version of the getCopyFromReg method takes an extra operand, which
171 // indicates that there is potentially an incoming flag value (if Flag is not
172 // null) and that there should be a flag result.
173 SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT::ValueType VT,
175 std::vector<MVT::ValueType> ResultTys;
176 ResultTys.push_back(VT);
177 ResultTys.push_back(MVT::Other);
178 ResultTys.push_back(MVT::Flag);
179 SDOperand Ops[] = { Chain, getRegister(Reg, VT), Flag };
180 return getNode(ISD::CopyFromReg, ResultTys, Ops, Flag.Val ? 3 : 2);
183 SDOperand getCondCode(ISD::CondCode Cond);
185 /// getZeroExtendInReg - Return the expression required to zero extend the Op
186 /// value assuming it was the smaller SrcTy value.
187 SDOperand getZeroExtendInReg(SDOperand Op, MVT::ValueType SrcTy);
189 /// getCALLSEQ_START - Return a new CALLSEQ_START node, which always must have
190 /// a flag result (to ensure it's not CSE'd).
191 SDOperand getCALLSEQ_START(SDOperand Chain, SDOperand Op) {
192 std::vector<MVT::ValueType> ResultTys;
193 ResultTys.push_back(MVT::Other);
194 ResultTys.push_back(MVT::Flag);
195 SDOperand Ops[] = { Chain, Op };
196 return getNode(ISD::CALLSEQ_START, ResultTys, Ops, 2);
199 /// getNode - Gets or creates the specified node.
201 SDOperand getNode(unsigned Opcode, MVT::ValueType VT);
202 SDOperand getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N);
203 SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
204 SDOperand N1, SDOperand N2);
205 SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
206 SDOperand N1, SDOperand N2, SDOperand N3);
207 SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
208 SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4);
209 SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
210 SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4,
212 SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
213 const SDOperand *Ops, unsigned NumOps);
214 SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
215 const std::vector<SDOperand> &Ops) {
216 return getNode(Opcode, VT, &Ops[0], Ops.size());
218 SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys,
219 const SDOperand *Ops, unsigned NumOps);
220 SDOperand getNode(unsigned Opcode, std::vector<MVT::ValueType> &ResultTys,
221 const std::vector<SDOperand> &Ops) {
222 return getNode(Opcode, ResultTys, &Ops[0], Ops.size());
226 /// getSetCC - Helper function to make it easier to build SetCC's if you just
227 /// have an ISD::CondCode instead of an SDOperand.
229 SDOperand getSetCC(MVT::ValueType VT, SDOperand LHS, SDOperand RHS,
230 ISD::CondCode Cond) {
231 return getNode(ISD::SETCC, VT, LHS, RHS, getCondCode(Cond));
234 /// getSelectCC - Helper function to make it easier to build SelectCC's if you
235 /// just have an ISD::CondCode instead of an SDOperand.
237 SDOperand getSelectCC(SDOperand LHS, SDOperand RHS,
238 SDOperand True, SDOperand False, ISD::CondCode Cond) {
239 MVT::ValueType VT = True.getValueType();
240 return getNode(ISD::SELECT_CC, VT, LHS, RHS, True, False,getCondCode(Cond));
243 /// getVAArg - VAArg produces a result and token chain, and takes a pointer
244 /// and a source value as input.
245 SDOperand getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr,
248 /// getLoad - Loads are not normal binary operators: their result type is not
249 /// determined by their operands, and they produce a value AND a token chain.
251 SDOperand getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr,
253 SDOperand getVecLoad(unsigned Count, MVT::ValueType VT, SDOperand Chain,
254 SDOperand Ptr, SDOperand SV);
255 SDOperand getExtLoad(unsigned Opcode, MVT::ValueType VT, SDOperand Chain,
256 SDOperand Ptr, SDOperand SV, MVT::ValueType EVT);
258 // getSrcValue - construct a node to track a Value* through the backend
259 SDOperand getSrcValue(const Value* I, int offset = 0);
261 /// UpdateNodeOperands - *Mutate* the specified node in-place to have the
262 /// specified operands. If the resultant node already exists in the DAG,
263 /// this does not modify the specified node, instead it returns the node that
264 /// already exists. If the resultant node does not exist in the DAG, the
265 /// input node is returned. As a degenerate case, if you specify the same
266 /// input operands as the node already has, the input node is returned.
267 SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op);
268 SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2);
269 SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2,
271 SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2,
272 SDOperand Op3, SDOperand Op4);
273 SDOperand UpdateNodeOperands(SDOperand N, SDOperand Op1, SDOperand Op2,
274 SDOperand Op3, SDOperand Op4, SDOperand Op5);
275 SDOperand UpdateNodeOperands(SDOperand N, SDOperand *Ops, unsigned NumOps);
277 /// SelectNodeTo - These are used for target selectors to *mutate* the
278 /// specified node to have the specified return type, Target opcode, and
279 /// operands. Note that target opcodes are stored as
280 /// ISD::BUILTIN_OP_END+TargetOpcode in the node opcode field. The 0th value
281 /// of the resultant node is returned.
282 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT);
283 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
285 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
286 SDOperand Op1, SDOperand Op2);
287 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
288 SDOperand Op1, SDOperand Op2, SDOperand Op3);
289 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
290 SDOperand Op1, SDOperand Op2, SDOperand Op3,
292 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
293 SDOperand Op1, SDOperand Op2, SDOperand Op3,
294 SDOperand Op4, SDOperand Op5);
295 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
296 SDOperand Op1, SDOperand Op2, SDOperand Op3,
297 SDOperand Op4, SDOperand Op5, SDOperand Op6);
298 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
299 SDOperand Op1, SDOperand Op2, SDOperand Op3,
300 SDOperand Op4, SDOperand Op5, SDOperand Op6,
302 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
303 SDOperand Op1, SDOperand Op2, SDOperand Op3,
304 SDOperand Op4, SDOperand Op5, SDOperand Op6,
305 SDOperand Op7, SDOperand Op8);
306 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1,
307 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2);
308 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1,
309 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
311 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1,
312 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
313 SDOperand Op3, SDOperand Op4);
314 SDOperand SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1,
315 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
316 SDOperand Op3, SDOperand Op4, SDOperand Op5);
318 /// getTargetNode - These are used for target selectors to create a new node
319 /// with specified return type(s), target opcode, and operands.
321 /// Note that getTargetNode returns the resultant node. If there is already a
322 /// node of the specified opcode and operands, it returns that node instead of
324 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT);
325 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
327 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
328 SDOperand Op1, SDOperand Op2);
329 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
330 SDOperand Op1, SDOperand Op2, SDOperand Op3);
331 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
332 SDOperand Op1, SDOperand Op2, SDOperand Op3,
334 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
335 SDOperand Op1, SDOperand Op2, SDOperand Op3,
336 SDOperand Op4, SDOperand Op5);
337 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
338 SDOperand Op1, SDOperand Op2, SDOperand Op3,
339 SDOperand Op4, SDOperand Op5, SDOperand Op6);
340 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
341 SDOperand Op1, SDOperand Op2, SDOperand Op3,
342 SDOperand Op4, SDOperand Op5, SDOperand Op6,
344 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
345 SDOperand Op1, SDOperand Op2, SDOperand Op3,
346 SDOperand Op4, SDOperand Op5, SDOperand Op6,
347 SDOperand Op7, SDOperand Op8);
348 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
349 const SDOperand *Ops, unsigned NumOps);
350 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
351 MVT::ValueType VT2, SDOperand Op1);
352 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
353 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2);
354 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
355 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
357 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
358 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
359 SDOperand Op3, SDOperand Op4);
360 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
361 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
362 SDOperand Op3, SDOperand Op4, SDOperand Op5);
363 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
364 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
365 SDOperand Op3, SDOperand Op4, SDOperand Op5,
367 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
368 MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
369 SDOperand Op3, SDOperand Op4, SDOperand Op5,
370 SDOperand Op6, SDOperand Op7);
371 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
372 MVT::ValueType VT2, MVT::ValueType VT3,
373 SDOperand Op1, SDOperand Op2);
374 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
375 MVT::ValueType VT2, MVT::ValueType VT3,
376 SDOperand Op1, SDOperand Op2,
377 SDOperand Op3, SDOperand Op4, SDOperand Op5);
378 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
379 MVT::ValueType VT2, MVT::ValueType VT3,
380 SDOperand Op1, SDOperand Op2,
381 SDOperand Op3, SDOperand Op4, SDOperand Op5,
383 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
384 MVT::ValueType VT2, MVT::ValueType VT3,
385 SDOperand Op1, SDOperand Op2,
386 SDOperand Op3, SDOperand Op4, SDOperand Op5,
387 SDOperand Op6, SDOperand Op7);
388 SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
390 const SDOperand *Ops, unsigned NumOps);
392 /// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
393 /// This can cause recursive merging of nodes in the DAG. Use the first
394 /// version if 'From' is known to have a single result, use the second
395 /// if you have two nodes with identical results, use the third otherwise.
397 /// These methods all take an optional vector, which (if not null) is
398 /// populated with any nodes that are deleted from the SelectionDAG, due to
399 /// new equivalences that are discovered.
401 void ReplaceAllUsesWith(SDOperand From, SDOperand Op,
402 std::vector<SDNode*> *Deleted = 0);
403 void ReplaceAllUsesWith(SDNode *From, SDNode *To,
404 std::vector<SDNode*> *Deleted = 0);
405 void ReplaceAllUsesWith(SDNode *From, const std::vector<SDOperand> &To,
406 std::vector<SDNode*> *Deleted = 0);
408 /// ReplaceAllUsesOfValueWith - Replace any uses of From with To, leaving
409 /// uses of other values produced by From.Val alone. The Deleted vector is
410 /// handled the same was as for ReplaceAllUsesWith, but it is required for
412 void ReplaceAllUsesOfValueWith(SDOperand From, SDOperand To,
413 std::vector<SDNode*> &Deleted);
415 /// DeleteNode - Remove the specified node from the system. This node must
416 /// have no referrers.
417 void DeleteNode(SDNode *N);
419 /// AssignNodeIds - Assign a unique node id for each node in the DAG based on
420 /// their allnodes order. It returns the maximum id.
421 unsigned AssignNodeIds();
423 /// AssignTopologicalOrder - Assign a unique node id for each node in the DAG
424 /// based on their topological order. It returns the maximum id and a vector
425 /// of the SDNodes* in assigned order by reference.
426 unsigned AssignTopologicalOrder(std::vector<SDNode*> &TopOrder);
430 /// InsertISelMapEntry - A helper function to insert a key / element pair
431 /// into a SDOperand to SDOperand map. This is added to avoid the map
432 /// insertion operator from being inlined.
433 static void InsertISelMapEntry(std::map<SDOperand, SDOperand> &Map,
434 SDNode *Key, unsigned KeyResNo,
435 SDNode *Element, unsigned ElementResNo);
438 void RemoveNodeFromCSEMaps(SDNode *N);
439 SDNode *AddNonLeafNodeToCSEMaps(SDNode *N);
440 SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op, void *&InsertPos);
441 SDNode *FindModifiedNodeSlot(SDNode *N, SDOperand Op1, SDOperand Op2,
443 SDNode *FindModifiedNodeSlot(SDNode *N, const SDOperand *Ops, unsigned NumOps,
446 void DeleteNodeNotInCSEMaps(SDNode *N);
447 MVT::ValueType *getNodeValueTypes(MVT::ValueType VT1);
448 MVT::ValueType *getNodeValueTypes(MVT::ValueType VT1, MVT::ValueType VT2);
449 MVT::ValueType *getNodeValueTypes(std::vector<MVT::ValueType> &RetVals);
452 /// SimplifySetCC - Try to simplify a setcc built with the specified operands
453 /// and cc. If unable to simplify it, return a null SDOperand.
454 SDOperand SimplifySetCC(MVT::ValueType VT, SDOperand N1,
455 SDOperand N2, ISD::CondCode Cond);
457 // List of non-single value types.
458 std::list<std::vector<MVT::ValueType> > VTList;
460 // Maps to auto-CSE operations.
461 std::map<std::pair<unsigned, MVT::ValueType>, SDNode *> NullaryOps;
463 std::map<std::pair<unsigned, MVT::ValueType>, RegisterSDNode*> RegNodes;
464 std::vector<CondCodeSDNode*> CondCodeNodes;
466 std::map<std::pair<const GlobalValue*, int>, SDNode*> GlobalValues;
467 std::map<std::pair<const GlobalValue*, int>, SDNode*> TargetGlobalValues;
468 std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> Constants;
469 std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstants;
470 std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> ConstantFPs;
471 std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstantFPs;
472 std::map<int, SDNode*> FrameIndices, TargetFrameIndices, JumpTableIndices,
473 TargetJumpTableIndices;
474 std::map<std::pair<Constant *,
475 std::pair<int, unsigned> >, SDNode*> ConstantPoolIndices;
476 std::map<std::pair<Constant *,
477 std::pair<int, unsigned> >, SDNode*> TargetConstantPoolIndices;
478 std::map<MachineBasicBlock *, SDNode*> BBNodes;
479 std::vector<SDNode*> ValueTypeNodes;
480 std::map<std::string, SDNode*> ExternalSymbols;
481 std::map<std::string, SDNode*> TargetExternalSymbols;
482 std::map<std::string, StringSDNode*> StringNodes;
483 SelectionDAGCSEMap CSEMap;
486 template <> struct GraphTraits<SelectionDAG*> : public GraphTraits<SDNode*> {
487 typedef SelectionDAG::allnodes_iterator nodes_iterator;
488 static nodes_iterator nodes_begin(SelectionDAG *G) {
489 return G->allnodes_begin();
491 static nodes_iterator nodes_end(SelectionDAG *G) {
492 return G->allnodes_end();
496 } // end namespace llvm