1 //===-- llvm/CodeGen/SelectionDAG.h - InstSelection DAG ---------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // 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/ADT/ilist.h"
19 #include "llvm/ADT/DenseSet.h"
20 #include "llvm/ADT/StringMap.h"
21 #include "llvm/CodeGen/SelectionDAGNodes.h"
22 #include "llvm/Support/RecyclingAllocator.h"
23 #include "llvm/Target/TargetMachine.h"
33 class FunctionLoweringInfo
;
34 class MachineConstantPoolValue
;
35 class MachineFunction
;
36 class MachineModuleInfo
;
40 template<> struct ilist_traits
<SDNode
> : public ilist_default_traits
<SDNode
> {
42 mutable ilist_half_node
<SDNode
> Sentinel
;
44 SDNode
*createSentinel() const {
45 return static_cast<SDNode
*>(&Sentinel
);
47 static void destroySentinel(SDNode
*) {}
49 SDNode
*provideInitialHead() const { return createSentinel(); }
50 SDNode
*ensureHead(SDNode
*) const { return createSentinel(); }
51 static void noteHead(SDNode
*, SDNode
*) {}
53 static void deleteNode(SDNode
*) {
54 assert(0 && "ilist_traits<SDNode> shouldn't see a deleteNode call!");
57 static void createNode(const SDNode
&);
61 Unrestricted
, // Combine may create illegal operations and illegal types.
62 NoIllegalTypes
, // Combine may create illegal operations but no illegal types.
63 NoIllegalOperations
// Combine may only create legal operations and types.
67 void checkForCycles(const SDNode
*N
);
68 void checkForCycles(const SelectionDAG
*DAG
);
70 /// SelectionDAG class - This is used to represent a portion of an LLVM function
71 /// in a low-level Data Dependence DAG representation suitable for instruction
72 /// selection. This DAG is constructed as the first step of instruction
73 /// selection in order to allow implementation of machine specific optimizations
74 /// and code simplifications.
76 /// The representation used by the SelectionDAG is a target-independent
77 /// representation, which has some similarities to the GCC RTL representation,
78 /// but is significantly more simple, powerful, and is a graph form instead of a
84 FunctionLoweringInfo
&FLI
;
85 MachineModuleInfo
*MMI
;
89 /// EntryNode - The starting token.
92 /// Root - The root of the entire DAG.
95 /// AllNodes - A linked list of nodes in the current DAG.
96 ilist
<SDNode
> AllNodes
;
98 /// NodeAllocatorType - The AllocatorType for allocating SDNodes. We use
99 /// pool allocation with recycling.
100 typedef RecyclingAllocator
<BumpPtrAllocator
, SDNode
, sizeof(LargestSDNode
),
101 AlignOf
<MostAlignedSDNode
>::Alignment
>
104 /// NodeAllocator - Pool allocation for nodes.
105 NodeAllocatorType NodeAllocator
;
107 /// CSEMap - This structure is used to memoize nodes, automatically performing
108 /// CSE with existing nodes when a duplicate is requested.
109 FoldingSet
<SDNode
> CSEMap
;
111 /// OperandAllocator - Pool allocation for machine-opcode SDNode operands.
112 BumpPtrAllocator OperandAllocator
;
114 /// Allocator - Pool allocation for misc. objects that are created once per
116 BumpPtrAllocator Allocator
;
118 /// SDNodeOrdering - The ordering of the SDNodes. It roughly corresponds to
119 /// the ordering of the original LLVM instructions.
120 SDNodeOrdering
*Ordering
;
122 /// VerifyNode - Sanity check the given node. Aborts if it is invalid.
123 void VerifyNode(SDNode
*N
);
125 /// setGraphColorHelper - Implementation of setSubgraphColor.
126 /// Return whether we had to truncate the search.
128 bool setSubgraphColorHelper(SDNode
*N
, const char *Color
,
129 DenseSet
<SDNode
*> &visited
,
130 int level
, bool &printed
);
132 void operator=(const SelectionDAG
&); // Do not implement.
133 SelectionDAG(const SelectionDAG
&); // Do not implement.
136 SelectionDAG(TargetLowering
&tli
, FunctionLoweringInfo
&fli
);
139 /// init - Prepare this SelectionDAG to process code in the given
142 void init(MachineFunction
&mf
, MachineModuleInfo
*mmi
, DwarfWriter
*dw
);
144 /// clear - Clear state and free memory necessary to make this
145 /// SelectionDAG ready to process a new block.
149 MachineFunction
&getMachineFunction() const { return *MF
; }
150 const TargetMachine
&getTarget() const;
151 TargetLowering
&getTargetLoweringInfo() const { return TLI
; }
152 FunctionLoweringInfo
&getFunctionLoweringInfo() const { return FLI
; }
153 MachineModuleInfo
*getMachineModuleInfo() const { return MMI
; }
154 DwarfWriter
*getDwarfWriter() const { return DW
; }
155 LLVMContext
*getContext() const {return Context
; }
157 /// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
159 void viewGraph(const std::string
&Title
);
163 std::map
<const SDNode
*, std::string
> NodeGraphAttrs
;
166 /// clearGraphAttrs - Clear all previously defined node graph attributes.
167 /// Intended to be used from a debugging tool (eg. gdb).
168 void clearGraphAttrs();
170 /// setGraphAttrs - Set graph attributes for a node. (eg. "color=red".)
172 void setGraphAttrs(const SDNode
*N
, const char *Attrs
);
174 /// getGraphAttrs - Get graph attributes for a node. (eg. "color=red".)
175 /// Used from getNodeAttributes.
176 const std::string
getGraphAttrs(const SDNode
*N
) const;
178 /// setGraphColor - Convenience for setting node color attribute.
180 void setGraphColor(const SDNode
*N
, const char *Color
);
182 /// setGraphColor - Convenience for setting subgraph color attribute.
184 void setSubgraphColor(SDNode
*N
, const char *Color
);
186 typedef ilist
<SDNode
>::const_iterator allnodes_const_iterator
;
187 allnodes_const_iterator
allnodes_begin() const { return AllNodes
.begin(); }
188 allnodes_const_iterator
allnodes_end() const { return AllNodes
.end(); }
189 typedef ilist
<SDNode
>::iterator allnodes_iterator
;
190 allnodes_iterator
allnodes_begin() { return AllNodes
.begin(); }
191 allnodes_iterator
allnodes_end() { return AllNodes
.end(); }
192 ilist
<SDNode
>::size_type
allnodes_size() const {
193 return AllNodes
.size();
196 /// getRoot - Return the root tag of the SelectionDAG.
198 const SDValue
&getRoot() const { return Root
; }
200 /// getEntryNode - Return the token chain corresponding to the entry of the
202 SDValue
getEntryNode() const {
203 return SDValue(const_cast<SDNode
*>(&EntryNode
), 0);
206 /// setRoot - Set the current root tag of the SelectionDAG.
208 const SDValue
&setRoot(SDValue N
) {
209 assert((!N
.getNode() || N
.getValueType() == MVT::Other
) &&
210 "DAG root value is not a chain!");
212 checkForCycles(N
.getNode());
215 checkForCycles(this);
219 /// Combine - This iterates over the nodes in the SelectionDAG, folding
220 /// certain types of nodes together, or eliminating superfluous nodes. The
221 /// Level argument controls whether Combine is allowed to produce nodes and
222 /// types that are illegal on the target.
223 void Combine(CombineLevel Level
, AliasAnalysis
&AA
,
224 CodeGenOpt::Level OptLevel
);
226 /// LegalizeTypes - This transforms the SelectionDAG into a SelectionDAG that
227 /// only uses types natively supported by the target. Returns "true" if it
228 /// made any changes.
230 /// Note that this is an involved process that may invalidate pointers into
232 bool LegalizeTypes();
234 /// Legalize - This transforms the SelectionDAG into a SelectionDAG that is
235 /// compatible with the target instruction selector, as indicated by the
236 /// TargetLowering object.
238 /// Note that this is an involved process that may invalidate pointers into
240 void Legalize(CodeGenOpt::Level OptLevel
);
242 /// LegalizeVectors - This transforms the SelectionDAG into a SelectionDAG
243 /// that only uses vector math operations supported by the target. This is
244 /// necessary as a separate step from Legalize because unrolling a vector
245 /// operation can introduce illegal types, which requires running
246 /// LegalizeTypes again.
248 /// This returns true if it made any changes; in that case, LegalizeTypes
249 /// is called again before Legalize.
251 /// Note that this is an involved process that may invalidate pointers into
253 bool LegalizeVectors();
255 /// RemoveDeadNodes - This method deletes all unreachable nodes in the
257 void RemoveDeadNodes();
259 /// DeleteNode - Remove the specified node from the system. This node must
260 /// have no referrers.
261 void DeleteNode(SDNode
*N
);
263 /// getVTList - Return an SDVTList that represents the list of values
265 SDVTList
getVTList(EVT VT
);
266 SDVTList
getVTList(EVT VT1
, EVT VT2
);
267 SDVTList
getVTList(EVT VT1
, EVT VT2
, EVT VT3
);
268 SDVTList
getVTList(EVT VT1
, EVT VT2
, EVT VT3
, EVT VT4
);
269 SDVTList
getVTList(const EVT
*VTs
, unsigned NumVTs
);
271 //===--------------------------------------------------------------------===//
272 // Node creation methods.
274 SDValue
getConstant(uint64_t Val
, EVT VT
, bool isTarget
= false);
275 SDValue
getConstant(const APInt
&Val
, EVT VT
, bool isTarget
= false);
276 SDValue
getConstant(const ConstantInt
&Val
, EVT VT
, bool isTarget
= false);
277 SDValue
getIntPtrConstant(uint64_t Val
, bool isTarget
= false);
278 SDValue
getTargetConstant(uint64_t Val
, EVT VT
) {
279 return getConstant(Val
, VT
, true);
281 SDValue
getTargetConstant(const APInt
&Val
, EVT VT
) {
282 return getConstant(Val
, VT
, true);
284 SDValue
getTargetConstant(const ConstantInt
&Val
, EVT VT
) {
285 return getConstant(Val
, VT
, true);
287 SDValue
getConstantFP(double Val
, EVT VT
, bool isTarget
= false);
288 SDValue
getConstantFP(const APFloat
& Val
, EVT VT
, bool isTarget
= false);
289 SDValue
getConstantFP(const ConstantFP
&CF
, EVT VT
, bool isTarget
= false);
290 SDValue
getTargetConstantFP(double Val
, EVT VT
) {
291 return getConstantFP(Val
, VT
, true);
293 SDValue
getTargetConstantFP(const APFloat
& Val
, EVT VT
) {
294 return getConstantFP(Val
, VT
, true);
296 SDValue
getTargetConstantFP(const ConstantFP
&Val
, EVT VT
) {
297 return getConstantFP(Val
, VT
, true);
299 SDValue
getGlobalAddress(const GlobalValue
*GV
, EVT VT
,
300 int64_t offset
= 0, bool isTargetGA
= false,
301 unsigned char TargetFlags
= 0);
302 SDValue
getTargetGlobalAddress(const GlobalValue
*GV
, EVT VT
,
304 unsigned char TargetFlags
= 0) {
305 return getGlobalAddress(GV
, VT
, offset
, true, TargetFlags
);
307 SDValue
getFrameIndex(int FI
, EVT VT
, bool isTarget
= false);
308 SDValue
getTargetFrameIndex(int FI
, EVT VT
) {
309 return getFrameIndex(FI
, VT
, true);
311 SDValue
getJumpTable(int JTI
, EVT VT
, bool isTarget
= false,
312 unsigned char TargetFlags
= 0);
313 SDValue
getTargetJumpTable(int JTI
, EVT VT
, unsigned char TargetFlags
= 0) {
314 return getJumpTable(JTI
, VT
, true, TargetFlags
);
316 SDValue
getConstantPool(Constant
*C
, EVT VT
,
317 unsigned Align
= 0, int Offs
= 0, bool isT
=false,
318 unsigned char TargetFlags
= 0);
319 SDValue
getTargetConstantPool(Constant
*C
, EVT VT
,
320 unsigned Align
= 0, int Offset
= 0,
321 unsigned char TargetFlags
= 0) {
322 return getConstantPool(C
, VT
, Align
, Offset
, true, TargetFlags
);
324 SDValue
getConstantPool(MachineConstantPoolValue
*C
, EVT VT
,
325 unsigned Align
= 0, int Offs
= 0, bool isT
=false,
326 unsigned char TargetFlags
= 0);
327 SDValue
getTargetConstantPool(MachineConstantPoolValue
*C
,
328 EVT VT
, unsigned Align
= 0,
329 int Offset
= 0, unsigned char TargetFlags
=0) {
330 return getConstantPool(C
, VT
, Align
, Offset
, true, TargetFlags
);
332 // When generating a branch to a BB, we don't in general know enough
333 // to provide debug info for the BB at that time, so keep this one around.
334 SDValue
getBasicBlock(MachineBasicBlock
*MBB
);
335 SDValue
getBasicBlock(MachineBasicBlock
*MBB
, DebugLoc dl
);
336 SDValue
getExternalSymbol(const char *Sym
, EVT VT
);
337 SDValue
getExternalSymbol(const char *Sym
, DebugLoc dl
, EVT VT
);
338 SDValue
getTargetExternalSymbol(const char *Sym
, EVT VT
,
339 unsigned char TargetFlags
= 0);
340 SDValue
getValueType(EVT
);
341 SDValue
getRegister(unsigned Reg
, EVT VT
);
342 SDValue
getLabel(unsigned Opcode
, DebugLoc dl
, SDValue Root
,
344 SDValue
getBlockAddress(BlockAddress
*BA
, EVT VT
,
345 bool isTarget
= false, unsigned char TargetFlags
= 0);
347 SDValue
getCopyToReg(SDValue Chain
, DebugLoc dl
, unsigned Reg
, SDValue N
) {
348 return getNode(ISD::CopyToReg
, dl
, MVT::Other
, Chain
,
349 getRegister(Reg
, N
.getValueType()), N
);
352 // This version of the getCopyToReg method takes an extra operand, which
353 // indicates that there is potentially an incoming flag value (if Flag is not
354 // null) and that there should be a flag result.
355 SDValue
getCopyToReg(SDValue Chain
, DebugLoc dl
, unsigned Reg
, SDValue N
,
357 SDVTList VTs
= getVTList(MVT::Other
, MVT::Flag
);
358 SDValue Ops
[] = { Chain
, getRegister(Reg
, N
.getValueType()), N
, Flag
};
359 return getNode(ISD::CopyToReg
, dl
, VTs
, Ops
, Flag
.getNode() ? 4 : 3);
362 // Similar to last getCopyToReg() except parameter Reg is a SDValue
363 SDValue
getCopyToReg(SDValue Chain
, DebugLoc dl
, SDValue Reg
, SDValue N
,
365 SDVTList VTs
= getVTList(MVT::Other
, MVT::Flag
);
366 SDValue Ops
[] = { Chain
, Reg
, N
, Flag
};
367 return getNode(ISD::CopyToReg
, dl
, VTs
, Ops
, Flag
.getNode() ? 4 : 3);
370 SDValue
getCopyFromReg(SDValue Chain
, DebugLoc dl
, unsigned Reg
, EVT VT
) {
371 SDVTList VTs
= getVTList(VT
, MVT::Other
);
372 SDValue Ops
[] = { Chain
, getRegister(Reg
, VT
) };
373 return getNode(ISD::CopyFromReg
, dl
, VTs
, Ops
, 2);
376 // This version of the getCopyFromReg method takes an extra operand, which
377 // indicates that there is potentially an incoming flag value (if Flag is not
378 // null) and that there should be a flag result.
379 SDValue
getCopyFromReg(SDValue Chain
, DebugLoc dl
, unsigned Reg
, EVT VT
,
381 SDVTList VTs
= getVTList(VT
, MVT::Other
, MVT::Flag
);
382 SDValue Ops
[] = { Chain
, getRegister(Reg
, VT
), Flag
};
383 return getNode(ISD::CopyFromReg
, dl
, VTs
, Ops
, Flag
.getNode() ? 3 : 2);
386 SDValue
getCondCode(ISD::CondCode Cond
);
388 /// Returns the ConvertRndSat Note: Avoid using this node because it may
389 /// disappear in the future and most targets don't support it.
390 SDValue
getConvertRndSat(EVT VT
, DebugLoc dl
, SDValue Val
, SDValue DTy
,
392 SDValue Rnd
, SDValue Sat
, ISD::CvtCode Code
);
394 /// getVectorShuffle - Return an ISD::VECTOR_SHUFFLE node. The number of
395 /// elements in VT, which must be a vector type, must match the number of
396 /// mask elements NumElts. A integer mask element equal to -1 is treated as
398 SDValue
getVectorShuffle(EVT VT
, DebugLoc dl
, SDValue N1
, SDValue N2
,
399 const int *MaskElts
);
401 /// getSExtOrTrunc - Convert Op, which must be of integer type, to the
402 /// integer type VT, by either sign-extending or truncating it.
403 SDValue
getSExtOrTrunc(SDValue Op
, DebugLoc DL
, EVT VT
);
405 /// getZExtOrTrunc - Convert Op, which must be of integer type, to the
406 /// integer type VT, by either zero-extending or truncating it.
407 SDValue
getZExtOrTrunc(SDValue Op
, DebugLoc DL
, EVT VT
);
409 /// getZeroExtendInReg - Return the expression required to zero extend the Op
410 /// value assuming it was the smaller SrcTy value.
411 SDValue
getZeroExtendInReg(SDValue Op
, DebugLoc DL
, EVT SrcTy
);
413 /// getNOT - Create a bitwise NOT operation as (XOR Val, -1).
414 SDValue
getNOT(DebugLoc DL
, SDValue Val
, EVT VT
);
416 /// getCALLSEQ_START - Return a new CALLSEQ_START node, which always must have
417 /// a flag result (to ensure it's not CSE'd). CALLSEQ_START does not have a
419 SDValue
getCALLSEQ_START(SDValue Chain
, SDValue Op
) {
420 SDVTList VTs
= getVTList(MVT::Other
, MVT::Flag
);
421 SDValue Ops
[] = { Chain
, Op
};
422 return getNode(ISD::CALLSEQ_START
, DebugLoc::getUnknownLoc(),
426 /// getCALLSEQ_END - Return a new CALLSEQ_END node, which always must have a
427 /// flag result (to ensure it's not CSE'd). CALLSEQ_END does not have
428 /// a useful DebugLoc.
429 SDValue
getCALLSEQ_END(SDValue Chain
, SDValue Op1
, SDValue Op2
,
431 SDVTList NodeTys
= getVTList(MVT::Other
, MVT::Flag
);
432 SmallVector
<SDValue
, 4> Ops
;
433 Ops
.push_back(Chain
);
436 Ops
.push_back(InFlag
);
437 return getNode(ISD::CALLSEQ_END
, DebugLoc::getUnknownLoc(), NodeTys
,
439 (unsigned)Ops
.size() - (InFlag
.getNode() == 0 ? 1 : 0));
442 /// getUNDEF - Return an UNDEF node. UNDEF does not have a useful DebugLoc.
443 SDValue
getUNDEF(EVT VT
) {
444 return getNode(ISD::UNDEF
, DebugLoc::getUnknownLoc(), VT
);
447 /// getGLOBAL_OFFSET_TABLE - Return a GLOBAL_OFFSET_TABLE node. This does
448 /// not have a useful DebugLoc.
449 SDValue
getGLOBAL_OFFSET_TABLE(EVT VT
) {
450 return getNode(ISD::GLOBAL_OFFSET_TABLE
, DebugLoc::getUnknownLoc(), VT
);
453 /// getNode - Gets or creates the specified node.
455 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
);
456 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
, SDValue N
);
457 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
, SDValue N1
, SDValue N2
);
458 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
,
459 SDValue N1
, SDValue N2
, SDValue N3
);
460 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
,
461 SDValue N1
, SDValue N2
, SDValue N3
, SDValue N4
);
462 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
,
463 SDValue N1
, SDValue N2
, SDValue N3
, SDValue N4
,
465 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
,
466 const SDUse
*Ops
, unsigned NumOps
);
467 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, EVT VT
,
468 const SDValue
*Ops
, unsigned NumOps
);
469 SDValue
getNode(unsigned Opcode
, DebugLoc DL
,
470 const std::vector
<EVT
> &ResultTys
,
471 const SDValue
*Ops
, unsigned NumOps
);
472 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, const EVT
*VTs
, unsigned NumVTs
,
473 const SDValue
*Ops
, unsigned NumOps
);
474 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, SDVTList VTs
,
475 const SDValue
*Ops
, unsigned NumOps
);
476 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, SDVTList VTs
);
477 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, SDVTList VTs
, SDValue N
);
478 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, SDVTList VTs
,
479 SDValue N1
, SDValue N2
);
480 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, SDVTList VTs
,
481 SDValue N1
, SDValue N2
, SDValue N3
);
482 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, SDVTList VTs
,
483 SDValue N1
, SDValue N2
, SDValue N3
, SDValue N4
);
484 SDValue
getNode(unsigned Opcode
, DebugLoc DL
, SDVTList VTs
,
485 SDValue N1
, SDValue N2
, SDValue N3
, SDValue N4
,
488 /// getStackArgumentTokenFactor - Compute a TokenFactor to force all
489 /// the incoming stack arguments to be loaded from the stack. This is
490 /// used in tail call lowering to protect stack arguments from being
492 SDValue
getStackArgumentTokenFactor(SDValue Chain
);
494 SDValue
getMemcpy(SDValue Chain
, DebugLoc dl
, SDValue Dst
, SDValue Src
,
495 SDValue Size
, unsigned Align
, bool AlwaysInline
,
496 const Value
*DstSV
, uint64_t DstSVOff
,
497 const Value
*SrcSV
, uint64_t SrcSVOff
);
499 SDValue
getMemmove(SDValue Chain
, DebugLoc dl
, SDValue Dst
, SDValue Src
,
500 SDValue Size
, unsigned Align
,
501 const Value
*DstSV
, uint64_t DstOSVff
,
502 const Value
*SrcSV
, uint64_t SrcSVOff
);
504 SDValue
getMemset(SDValue Chain
, DebugLoc dl
, SDValue Dst
, SDValue Src
,
505 SDValue Size
, unsigned Align
,
506 const Value
*DstSV
, uint64_t DstSVOff
);
508 /// getSetCC - Helper function to make it easier to build SetCC's if you just
509 /// have an ISD::CondCode instead of an SDValue.
511 SDValue
getSetCC(DebugLoc DL
, EVT VT
, SDValue LHS
, SDValue RHS
,
512 ISD::CondCode Cond
) {
513 return getNode(ISD::SETCC
, DL
, VT
, LHS
, RHS
, getCondCode(Cond
));
516 /// getVSetCC - Helper function to make it easier to build VSetCC's nodes
517 /// if you just have an ISD::CondCode instead of an SDValue.
519 SDValue
getVSetCC(DebugLoc DL
, EVT VT
, SDValue LHS
, SDValue RHS
,
520 ISD::CondCode Cond
) {
521 return getNode(ISD::VSETCC
, DL
, VT
, LHS
, RHS
, getCondCode(Cond
));
524 /// getSelectCC - Helper function to make it easier to build SelectCC's if you
525 /// just have an ISD::CondCode instead of an SDValue.
527 SDValue
getSelectCC(DebugLoc DL
, SDValue LHS
, SDValue RHS
,
528 SDValue True
, SDValue False
, ISD::CondCode Cond
) {
529 return getNode(ISD::SELECT_CC
, DL
, True
.getValueType(),
530 LHS
, RHS
, True
, False
, getCondCode(Cond
));
533 /// getVAArg - VAArg produces a result and token chain, and takes a pointer
534 /// and a source value as input.
535 SDValue
getVAArg(EVT VT
, DebugLoc dl
, SDValue Chain
, SDValue Ptr
,
538 /// getAtomic - Gets a node for an atomic op, produces result and chain and
540 SDValue
getAtomic(unsigned Opcode
, DebugLoc dl
, EVT MemVT
, SDValue Chain
,
541 SDValue Ptr
, SDValue Cmp
, SDValue Swp
, const Value
* PtrVal
,
542 unsigned Alignment
=0);
543 SDValue
getAtomic(unsigned Opcode
, DebugLoc dl
, EVT MemVT
, SDValue Chain
,
544 SDValue Ptr
, SDValue Cmp
, SDValue Swp
,
545 MachineMemOperand
*MMO
);
547 /// getAtomic - Gets a node for an atomic op, produces result and chain and
548 /// takes 2 operands.
549 SDValue
getAtomic(unsigned Opcode
, DebugLoc dl
, EVT MemVT
, SDValue Chain
,
550 SDValue Ptr
, SDValue Val
, const Value
* PtrVal
,
551 unsigned Alignment
= 0);
552 SDValue
getAtomic(unsigned Opcode
, DebugLoc dl
, EVT MemVT
, SDValue Chain
,
553 SDValue Ptr
, SDValue Val
,
554 MachineMemOperand
*MMO
);
556 /// getMemIntrinsicNode - Creates a MemIntrinsicNode that may produce a
557 /// result and takes a list of operands. Opcode may be INTRINSIC_VOID,
558 /// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not
559 /// less than FIRST_TARGET_MEMORY_OPCODE.
560 SDValue
getMemIntrinsicNode(unsigned Opcode
, DebugLoc dl
,
561 const EVT
*VTs
, unsigned NumVTs
,
562 const SDValue
*Ops
, unsigned NumOps
,
563 EVT MemVT
, const Value
*srcValue
, int SVOff
,
564 unsigned Align
= 0, bool Vol
= false,
565 bool ReadMem
= true, bool WriteMem
= true);
567 SDValue
getMemIntrinsicNode(unsigned Opcode
, DebugLoc dl
, SDVTList VTList
,
568 const SDValue
*Ops
, unsigned NumOps
,
569 EVT MemVT
, const Value
*srcValue
, int SVOff
,
570 unsigned Align
= 0, bool Vol
= false,
571 bool ReadMem
= true, bool WriteMem
= true);
573 SDValue
getMemIntrinsicNode(unsigned Opcode
, DebugLoc dl
, SDVTList VTList
,
574 const SDValue
*Ops
, unsigned NumOps
,
575 EVT MemVT
, MachineMemOperand
*MMO
);
577 /// getMergeValues - Create a MERGE_VALUES node from the given operands.
578 SDValue
getMergeValues(const SDValue
*Ops
, unsigned NumOps
, DebugLoc dl
);
580 /// getLoad - Loads are not normal binary operators: their result type is not
581 /// determined by their operands, and they produce a value AND a token chain.
583 SDValue
getLoad(EVT VT
, DebugLoc dl
, SDValue Chain
, SDValue Ptr
,
584 const Value
*SV
, int SVOffset
, bool isVolatile
,
585 bool isNonTemporal
, unsigned Alignment
);
586 SDValue
getExtLoad(ISD::LoadExtType ExtType
, DebugLoc dl
, EVT VT
,
587 SDValue Chain
, SDValue Ptr
, const Value
*SV
,
588 int SVOffset
, EVT MemVT
, bool isVolatile
,
589 bool isNonTemporal
, unsigned Alignment
);
590 SDValue
getIndexedLoad(SDValue OrigLoad
, DebugLoc dl
, SDValue Base
,
591 SDValue Offset
, ISD::MemIndexedMode AM
);
592 SDValue
getLoad(ISD::MemIndexedMode AM
, DebugLoc dl
, ISD::LoadExtType ExtType
,
593 EVT VT
, SDValue Chain
, SDValue Ptr
, SDValue Offset
,
594 const Value
*SV
, int SVOffset
, EVT MemVT
,
595 bool isVolatile
, bool isNonTemporal
, unsigned Alignment
);
596 SDValue
getLoad(ISD::MemIndexedMode AM
, DebugLoc dl
, ISD::LoadExtType ExtType
,
597 EVT VT
, SDValue Chain
, SDValue Ptr
, SDValue Offset
,
598 EVT MemVT
, MachineMemOperand
*MMO
);
600 /// getStore - Helper function to build ISD::STORE nodes.
602 SDValue
getStore(SDValue Chain
, DebugLoc dl
, SDValue Val
, SDValue Ptr
,
603 const Value
*SV
, int SVOffset
, bool isVolatile
,
604 bool isNonTemporal
, unsigned Alignment
);
605 SDValue
getStore(SDValue Chain
, DebugLoc dl
, SDValue Val
, SDValue Ptr
,
606 MachineMemOperand
*MMO
);
607 SDValue
getTruncStore(SDValue Chain
, DebugLoc dl
, SDValue Val
, SDValue Ptr
,
608 const Value
*SV
, int SVOffset
, EVT TVT
,
609 bool isNonTemporal
, bool isVolatile
,
611 SDValue
getTruncStore(SDValue Chain
, DebugLoc dl
, SDValue Val
, SDValue Ptr
,
612 EVT TVT
, MachineMemOperand
*MMO
);
613 SDValue
getIndexedStore(SDValue OrigStoe
, DebugLoc dl
, SDValue Base
,
614 SDValue Offset
, ISD::MemIndexedMode AM
);
616 /// getSrcValue - Construct a node to track a Value* through the backend.
617 SDValue
getSrcValue(const Value
*v
);
619 /// getShiftAmountOperand - Return the specified value casted to
620 /// the target's desired shift amount type.
621 SDValue
getShiftAmountOperand(SDValue Op
);
623 /// UpdateNodeOperands - *Mutate* the specified node in-place to have the
624 /// specified operands. If the resultant node already exists in the DAG,
625 /// this does not modify the specified node, instead it returns the node that
626 /// already exists. If the resultant node does not exist in the DAG, the
627 /// input node is returned. As a degenerate case, if you specify the same
628 /// input operands as the node already has, the input node is returned.
629 SDValue
UpdateNodeOperands(SDValue N
, SDValue Op
);
630 SDValue
UpdateNodeOperands(SDValue N
, SDValue Op1
, SDValue Op2
);
631 SDValue
UpdateNodeOperands(SDValue N
, SDValue Op1
, SDValue Op2
,
633 SDValue
UpdateNodeOperands(SDValue N
, SDValue Op1
, SDValue Op2
,
634 SDValue Op3
, SDValue Op4
);
635 SDValue
UpdateNodeOperands(SDValue N
, SDValue Op1
, SDValue Op2
,
636 SDValue Op3
, SDValue Op4
, SDValue Op5
);
637 SDValue
UpdateNodeOperands(SDValue N
,
638 const SDValue
*Ops
, unsigned NumOps
);
640 /// SelectNodeTo - These are used for target selectors to *mutate* the
641 /// specified node to have the specified return type, Target opcode, and
642 /// operands. Note that target opcodes are stored as
643 /// ~TargetOpcode in the node opcode field. The resultant node is returned.
644 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT
);
645 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT
, SDValue Op1
);
646 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT
,
647 SDValue Op1
, SDValue Op2
);
648 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT
,
649 SDValue Op1
, SDValue Op2
, SDValue Op3
);
650 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT
,
651 const SDValue
*Ops
, unsigned NumOps
);
652 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT1
, EVT VT2
);
653 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT1
,
654 EVT VT2
, const SDValue
*Ops
, unsigned NumOps
);
655 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT1
,
656 EVT VT2
, EVT VT3
, const SDValue
*Ops
, unsigned NumOps
);
657 SDNode
*SelectNodeTo(SDNode
*N
, unsigned MachineOpc
, EVT VT1
,
658 EVT VT2
, EVT VT3
, EVT VT4
, const SDValue
*Ops
,
660 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT1
,
661 EVT VT2
, SDValue Op1
);
662 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT1
,
663 EVT VT2
, SDValue Op1
, SDValue Op2
);
664 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT1
,
665 EVT VT2
, SDValue Op1
, SDValue Op2
, SDValue Op3
);
666 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, EVT VT1
,
667 EVT VT2
, EVT VT3
, SDValue Op1
, SDValue Op2
, SDValue Op3
);
668 SDNode
*SelectNodeTo(SDNode
*N
, unsigned TargetOpc
, SDVTList VTs
,
669 const SDValue
*Ops
, unsigned NumOps
);
671 /// MorphNodeTo - These *mutate* the specified node to have the specified
672 /// return type, opcode, and operands.
673 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT
);
674 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT
, SDValue Op1
);
675 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT
,
676 SDValue Op1
, SDValue Op2
);
677 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT
,
678 SDValue Op1
, SDValue Op2
, SDValue Op3
);
679 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT
,
680 const SDValue
*Ops
, unsigned NumOps
);
681 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT1
, EVT VT2
);
682 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT1
,
683 EVT VT2
, const SDValue
*Ops
, unsigned NumOps
);
684 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT1
,
685 EVT VT2
, EVT VT3
, const SDValue
*Ops
, unsigned NumOps
);
686 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT1
,
687 EVT VT2
, SDValue Op1
);
688 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT1
,
689 EVT VT2
, SDValue Op1
, SDValue Op2
);
690 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, EVT VT1
,
691 EVT VT2
, SDValue Op1
, SDValue Op2
, SDValue Op3
);
692 SDNode
*MorphNodeTo(SDNode
*N
, unsigned Opc
, SDVTList VTs
,
693 const SDValue
*Ops
, unsigned NumOps
);
695 /// getMachineNode - These are used for target selectors to create a new node
696 /// with specified return type(s), MachineInstr opcode, and operands.
698 /// Note that getMachineNode returns the resultant node. If there is already
699 /// a node of the specified opcode and operands, it returns that node instead
700 /// of the current one.
701 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT
);
702 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT
,
704 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT
,
705 SDValue Op1
, SDValue Op2
);
706 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT
,
707 SDValue Op1
, SDValue Op2
, SDValue Op3
);
708 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT
,
709 const SDValue
*Ops
, unsigned NumOps
);
710 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
, EVT VT2
);
711 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
, EVT VT2
,
713 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
,
714 EVT VT2
, SDValue Op1
, SDValue Op2
);
715 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
,
716 EVT VT2
, SDValue Op1
, SDValue Op2
, SDValue Op3
);
717 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
, EVT VT2
,
718 const SDValue
*Ops
, unsigned NumOps
);
719 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
, EVT VT2
,
720 EVT VT3
, SDValue Op1
, SDValue Op2
);
721 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
, EVT VT2
,
722 EVT VT3
, SDValue Op1
, SDValue Op2
, SDValue Op3
);
723 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
, EVT VT2
,
724 EVT VT3
, const SDValue
*Ops
, unsigned NumOps
);
725 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, EVT VT1
, EVT VT2
,
726 EVT VT3
, EVT VT4
, const SDValue
*Ops
, unsigned NumOps
);
727 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
,
728 const std::vector
<EVT
> &ResultTys
, const SDValue
*Ops
,
730 MachineSDNode
*getMachineNode(unsigned Opcode
, DebugLoc dl
, SDVTList VTs
,
731 const SDValue
*Ops
, unsigned NumOps
);
733 /// getTargetExtractSubreg - A convenience function for creating
734 /// TargetInstrInfo::EXTRACT_SUBREG nodes.
735 SDValue
getTargetExtractSubreg(int SRIdx
, DebugLoc DL
, EVT VT
,
738 /// getTargetInsertSubreg - A convenience function for creating
739 /// TargetInstrInfo::INSERT_SUBREG nodes.
740 SDValue
getTargetInsertSubreg(int SRIdx
, DebugLoc DL
, EVT VT
,
741 SDValue Operand
, SDValue Subreg
);
743 /// getNodeIfExists - Get the specified node if it's already available, or
744 /// else return NULL.
745 SDNode
*getNodeIfExists(unsigned Opcode
, SDVTList VTs
,
746 const SDValue
*Ops
, unsigned NumOps
);
748 /// DAGUpdateListener - Clients of various APIs that cause global effects on
749 /// the DAG can optionally implement this interface. This allows the clients
750 /// to handle the various sorts of updates that happen.
751 class DAGUpdateListener
{
753 virtual ~DAGUpdateListener();
755 /// NodeDeleted - The node N that was deleted and, if E is not null, an
756 /// equivalent node E that replaced it.
757 virtual void NodeDeleted(SDNode
*N
, SDNode
*E
) = 0;
759 /// NodeUpdated - The node N that was updated.
760 virtual void NodeUpdated(SDNode
*N
) = 0;
763 /// RemoveDeadNode - Remove the specified node from the system. If any of its
764 /// operands then becomes dead, remove them as well. Inform UpdateListener
765 /// for each node deleted.
766 void RemoveDeadNode(SDNode
*N
, DAGUpdateListener
*UpdateListener
= 0);
768 /// RemoveDeadNodes - This method deletes the unreachable nodes in the
769 /// given list, and any nodes that become unreachable as a result.
770 void RemoveDeadNodes(SmallVectorImpl
<SDNode
*> &DeadNodes
,
771 DAGUpdateListener
*UpdateListener
= 0);
773 /// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead.
774 /// This can cause recursive merging of nodes in the DAG. Use the first
775 /// version if 'From' is known to have a single result, use the second
776 /// if you have two nodes with identical results (or if 'To' has a superset
777 /// of the results of 'From'), use the third otherwise.
779 /// These methods all take an optional UpdateListener, which (if not null) is
780 /// informed about nodes that are deleted and modified due to recursive
781 /// changes in the dag.
783 /// These functions only replace all existing uses. It's possible that as
784 /// these replacements are being performed, CSE may cause the From node
785 /// to be given new uses. These new uses of From are left in place, and
786 /// not automatically transfered to To.
788 void ReplaceAllUsesWith(SDValue From
, SDValue Op
,
789 DAGUpdateListener
*UpdateListener
= 0);
790 void ReplaceAllUsesWith(SDNode
*From
, SDNode
*To
,
791 DAGUpdateListener
*UpdateListener
= 0);
792 void ReplaceAllUsesWith(SDNode
*From
, const SDValue
*To
,
793 DAGUpdateListener
*UpdateListener
= 0);
795 /// ReplaceAllUsesOfValueWith - Replace any uses of From with To, leaving
796 /// uses of other values produced by From.Val alone.
797 void ReplaceAllUsesOfValueWith(SDValue From
, SDValue To
,
798 DAGUpdateListener
*UpdateListener
= 0);
800 /// ReplaceAllUsesOfValuesWith - Like ReplaceAllUsesOfValueWith, but
801 /// for multiple values at once. This correctly handles the case where
802 /// there is an overlap between the From values and the To values.
803 void ReplaceAllUsesOfValuesWith(const SDValue
*From
, const SDValue
*To
,
805 DAGUpdateListener
*UpdateListener
= 0);
807 /// AssignTopologicalOrder - Topological-sort the AllNodes list and a
808 /// assign a unique node id for each node in the DAG based on their
809 /// topological order. Returns the number of nodes.
810 unsigned AssignTopologicalOrder();
812 /// RepositionNode - Move node N in the AllNodes list to be immediately
813 /// before the given iterator Position. This may be used to update the
814 /// topological ordering when the list of nodes is modified.
815 void RepositionNode(allnodes_iterator Position
, SDNode
*N
) {
816 AllNodes
.insert(Position
, AllNodes
.remove(N
));
819 /// isCommutativeBinOp - Returns true if the opcode is a commutative binary
821 static bool isCommutativeBinOp(unsigned Opcode
) {
822 // FIXME: This should get its info from the td file, so that we can include
839 case ISD::ADDE
: return true;
840 default: return false;
844 /// AssignOrdering - Assign an order to the SDNode.
845 void AssignOrdering(const SDNode
*SD
, unsigned Order
);
847 /// GetOrdering - Get the order for the SDNode.
848 unsigned GetOrdering(const SDNode
*SD
) const;
852 /// CreateStackTemporary - Create a stack temporary, suitable for holding the
853 /// specified value type. If minAlign is specified, the slot size will have
854 /// at least that alignment.
855 SDValue
CreateStackTemporary(EVT VT
, unsigned minAlign
= 1);
857 /// CreateStackTemporary - Create a stack temporary suitable for holding
858 /// either of the specified value types.
859 SDValue
CreateStackTemporary(EVT VT1
, EVT VT2
);
861 /// FoldConstantArithmetic -
862 SDValue
FoldConstantArithmetic(unsigned Opcode
,
864 ConstantSDNode
*Cst1
,
865 ConstantSDNode
*Cst2
);
867 /// FoldSetCC - Constant fold a setcc to true or false.
868 SDValue
FoldSetCC(EVT VT
, SDValue N1
,
869 SDValue N2
, ISD::CondCode Cond
, DebugLoc dl
);
871 /// SignBitIsZero - Return true if the sign bit of Op is known to be zero. We
872 /// use this predicate to simplify operations downstream.
873 bool SignBitIsZero(SDValue Op
, unsigned Depth
= 0) const;
875 /// MaskedValueIsZero - Return true if 'Op & Mask' is known to be zero. We
876 /// use this predicate to simplify operations downstream. Op and Mask are
877 /// known to be the same type.
878 bool MaskedValueIsZero(SDValue Op
, const APInt
&Mask
, unsigned Depth
= 0)
881 /// ComputeMaskedBits - Determine which of the bits specified in Mask are
882 /// known to be either zero or one and return them in the KnownZero/KnownOne
883 /// bitsets. This code only analyzes bits in Mask, in order to short-circuit
884 /// processing. Targets can implement the computeMaskedBitsForTargetNode
885 /// method in the TargetLowering class to allow target nodes to be understood.
886 void ComputeMaskedBits(SDValue Op
, const APInt
&Mask
, APInt
&KnownZero
,
887 APInt
&KnownOne
, unsigned Depth
= 0) const;
889 /// ComputeNumSignBits - Return the number of times the sign bit of the
890 /// register is replicated into the other bits. We know that at least 1 bit
891 /// is always equal to the sign bit (itself), but other cases can give us
892 /// information. For example, immediately after an "SRA X, 2", we know that
893 /// the top 3 bits are all equal to each other, so we return 3. Targets can
894 /// implement the ComputeNumSignBitsForTarget method in the TargetLowering
895 /// class to allow target nodes to be understood.
896 unsigned ComputeNumSignBits(SDValue Op
, unsigned Depth
= 0) const;
898 /// isKnownNeverNan - Test whether the given SDValue is known to never be NaN.
899 bool isKnownNeverNaN(SDValue Op
) const;
901 /// isVerifiedDebugInfoDesc - Returns true if the specified SDValue has
902 /// been verified as a debug information descriptor.
903 bool isVerifiedDebugInfoDesc(SDValue Op
) const;
905 /// getShuffleScalarElt - Returns the scalar element that will make up the ith
906 /// element of the result of the vector shuffle.
907 SDValue
getShuffleScalarElt(const ShuffleVectorSDNode
*N
, unsigned Idx
);
909 /// UnrollVectorOp - Utility function used by legalize and lowering to
910 /// "unroll" a vector operation by splitting out the scalars and operating
911 /// on each element individually. If the ResNE is 0, fully unroll the vector
912 /// op. If ResNE is less than the width of the vector op, unroll up to ResNE.
913 /// If the ResNE is greater than the width of the vector op, unroll the
914 /// vector op and fill the end of the resulting vector with UNDEFS.
915 SDValue
UnrollVectorOp(SDNode
*N
, unsigned ResNE
= 0);
917 /// isConsecutiveLoad - Return true if LD is loading 'Bytes' bytes from a
918 /// location that is 'Dist' units away from the location that the 'Base' load
920 bool isConsecutiveLoad(LoadSDNode
*LD
, LoadSDNode
*Base
,
921 unsigned Bytes
, int Dist
) const;
923 /// InferPtrAlignment - Infer alignment of a load / store address. Return 0 if
924 /// it cannot be inferred.
925 unsigned InferPtrAlignment(SDValue Ptr
) const;
928 bool RemoveNodeFromCSEMaps(SDNode
*N
);
929 void AddModifiedNodeToCSEMaps(SDNode
*N
, DAGUpdateListener
*UpdateListener
);
930 SDNode
*FindModifiedNodeSlot(SDNode
*N
, SDValue Op
, void *&InsertPos
);
931 SDNode
*FindModifiedNodeSlot(SDNode
*N
, SDValue Op1
, SDValue Op2
,
933 SDNode
*FindModifiedNodeSlot(SDNode
*N
, const SDValue
*Ops
, unsigned NumOps
,
936 void DeleteNodeNotInCSEMaps(SDNode
*N
);
937 void DeallocateNode(SDNode
*N
);
939 unsigned getEVTAlignment(EVT MemoryVT
) const;
941 void allnodes_clear();
943 /// VTList - List of non-single value types.
944 std::vector
<SDVTList
> VTList
;
946 /// CondCodeNodes - Maps to auto-CSE operations.
947 std::vector
<CondCodeSDNode
*> CondCodeNodes
;
949 std::vector
<SDNode
*> ValueTypeNodes
;
950 std::map
<EVT
, SDNode
*, EVT::compareRawBits
> ExtendedValueTypeNodes
;
951 StringMap
<SDNode
*> ExternalSymbols
;
953 std::map
<std::pair
<std::string
, unsigned char>,SDNode
*> TargetExternalSymbols
;
956 template <> struct GraphTraits
<SelectionDAG
*> : public GraphTraits
<SDNode
*> {
957 typedef SelectionDAG::allnodes_iterator nodes_iterator
;
958 static nodes_iterator
nodes_begin(SelectionDAG
*G
) {
959 return G
->allnodes_begin();
961 static nodes_iterator
nodes_end(SelectionDAG
*G
) {
962 return G
->allnodes_end();
966 } // end namespace llvm