add stacksave/stackrestore nodes
[oota-llvm.git] / include / llvm / CodeGen / SelectionDAGNodes.h
1 //===-- llvm/CodeGen/SelectionDAGNodes.h - SelectionDAG Nodes ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the SDNode class and derived classes, which are used to
11 // represent the nodes and operations present in a SelectionDAG.  These nodes
12 // and operations are machine code level operations, with some similarities to
13 // the GCC RTL representation.
14 //
15 // Clients should include the SelectionDAG.h file instead of this file directly.
16 //
17 //===----------------------------------------------------------------------===//
18
19 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H
20 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
21
22 #include "llvm/CodeGen/ValueTypes.h"
23 #include "llvm/Value.h"
24 #include "llvm/ADT/GraphTraits.h"
25 #include "llvm/ADT/iterator"
26 #include "llvm/Support/DataTypes.h"
27 #include <cassert>
28 #include <vector>
29
30 namespace llvm {
31
32 class SelectionDAG;
33 class GlobalValue;
34 class MachineBasicBlock;
35 class SDNode;
36 template <typename T> struct simplify_type;
37 template <typename T> struct ilist_traits;
38 template<typename NodeTy, typename Traits> class iplist;
39 template<typename NodeTy> class ilist_iterator;
40
41 /// ISD namespace - This namespace contains an enum which represents all of the
42 /// SelectionDAG node types and value types.
43 ///
44 namespace ISD {
45   //===--------------------------------------------------------------------===//
46   /// ISD::NodeType enum - This enum defines all of the operators valid in a
47   /// SelectionDAG.
48   ///
49   enum NodeType {
50     // EntryToken - This is the marker used to indicate the start of the region.
51     EntryToken,
52
53     // Token factor - This node takes multiple tokens as input and produces a
54     // single token result.  This is used to represent the fact that the operand
55     // operators are independent of each other.
56     TokenFactor,
57     
58     // AssertSext, AssertZext - These nodes record if a register contains a 
59     // value that has already been zero or sign extended from a narrower type.  
60     // These nodes take two operands.  The first is the node that has already 
61     // been extended, and the second is a value type node indicating the width
62     // of the extension
63     AssertSext, AssertZext,
64
65     // Various leaf nodes.
66     Constant, ConstantFP, STRING,
67     GlobalAddress, FrameIndex, ConstantPool,
68     BasicBlock, ExternalSymbol, VALUETYPE, CONDCODE, Register,
69     
70     // ConstantVec works like Constant or ConstantFP, except that it is not a
71     // leaf node.  All operands are either Constant or ConstantFP nodes.
72     ConstantVec,
73     
74     // TargetConstant - Like Constant, but the DAG does not do any folding or
75     // simplification of the constant.  This is used by the DAG->DAG selector.
76     TargetConstant,
77     
78     // TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or
79     // anything else with this node, and this is valid in the target-specific
80     // dag, turning into a GlobalAddress operand.
81     TargetGlobalAddress,
82     TargetFrameIndex,
83     TargetConstantPool,
84     TargetExternalSymbol,
85
86     // CopyToReg - This node has three operands: a chain, a register number to
87     // set to this value, and a value.  
88     CopyToReg,
89
90     // CopyFromReg - This node indicates that the input value is a virtual or
91     // physical register that is defined outside of the scope of this
92     // SelectionDAG.  The register is available from the RegSDNode object.
93     CopyFromReg,
94
95     // UNDEF - An undefined node
96     UNDEF,
97
98     // EXTRACT_ELEMENT - This is used to get the first or second (determined by
99     // a Constant, which is required to be operand #1), element of the aggregate
100     // value specified as operand #0.  This is only for use before legalization,
101     // for values that will be broken into multiple registers.
102     EXTRACT_ELEMENT,
103
104     // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.  Given
105     // two values of the same integer value type, this produces a value twice as
106     // big.  Like EXTRACT_ELEMENT, this can only be used before legalization.
107     BUILD_PAIR,
108     
109     // MERGE_VALUES - This node takes multiple discrete operands and returns
110     // them all as its individual results.  This nodes has exactly the same
111     // number of inputs and outputs, and is only valid before legalization.
112     // This node is useful for some pieces of the code generator that want to
113     // think about a single node with multiple results, not multiple nodes.
114     MERGE_VALUES,
115
116     // Simple integer binary arithmetic operators.
117     ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
118     
119     // Simple binary floating point operators.
120     FADD, FSUB, FMUL, FDIV, FREM,
121     
122     // Simple abstract vector operators.  Unlike the integer and floating point
123     // binary operators, these nodes also take two additional operands:
124     // a constant element count, and a value type node indicating the type of
125     // the elements.  The order is op0, op1, count, type.  All vector opcodes,
126     // including VLOAD, must currently have count and type as their 3rd and 4th
127     // arguments.
128     VADD, VSUB, VMUL,
129
130     // MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing
131     // an unsigned/signed value of type i[2*n], then return the top part.
132     MULHU, MULHS,
133
134     // Bitwise operators - logical and, logical or, logical xor, shift left,
135     // shift right algebraic (shift in sign bits), shift right logical (shift in
136     // zeroes), rotate left, rotate right, and byteswap.
137     AND, OR, XOR, SHL, SRA, SRL, ROTL, ROTR, BSWAP,
138
139     // Counting operators
140     CTTZ, CTLZ, CTPOP,
141
142     // Select
143     SELECT, 
144     
145     // Select with condition operator - This selects between a true value and 
146     // a false value (ops #2 and #3) based on the boolean result of comparing
147     // the lhs and rhs (ops #0 and #1) of a conditional expression with the 
148     // condition code in op #4, a CondCodeSDNode.
149     SELECT_CC,
150
151     // SetCC operator - This evaluates to a boolean (i1) true value if the
152     // condition is true.  The operands to this are the left and right operands
153     // to compare (ops #0, and #1) and the condition code to compare them with
154     // (op #2) as a CondCodeSDNode.
155     SETCC,
156
157     // ADD_PARTS/SUB_PARTS - These operators take two logical operands which are
158     // broken into a multiple pieces each, and return the resulting pieces of
159     // doing an atomic add/sub operation.  This is used to handle add/sub of
160     // expanded types.  The operation ordering is:
161     //       [Lo,Hi] = op [LoLHS,HiLHS], [LoRHS,HiRHS]
162     ADD_PARTS, SUB_PARTS,
163
164     // SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded
165     // integer shift operations, just like ADD/SUB_PARTS.  The operation
166     // ordering is:
167     //       [Lo,Hi] = op [LoLHS,HiLHS], Amt
168     SHL_PARTS, SRA_PARTS, SRL_PARTS,
169
170     // Conversion operators.  These are all single input single output
171     // operations.  For all of these, the result type must be strictly
172     // wider or narrower (depending on the operation) than the source
173     // type.
174
175     // SIGN_EXTEND - Used for integer types, replicating the sign bit
176     // into new bits.
177     SIGN_EXTEND,
178
179     // ZERO_EXTEND - Used for integer types, zeroing the new bits.
180     ZERO_EXTEND,
181
182     // ANY_EXTEND - Used for integer types.  The high bits are undefined.
183     ANY_EXTEND,
184     
185     // TRUNCATE - Completely drop the high bits.
186     TRUNCATE,
187
188     // [SU]INT_TO_FP - These operators convert integers (whose interpreted sign
189     // depends on the first letter) to floating point.
190     SINT_TO_FP,
191     UINT_TO_FP,
192
193     // SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to
194     // sign extend a small value in a large integer register (e.g. sign
195     // extending the low 8 bits of a 32-bit register to fill the top 24 bits
196     // with the 7th bit).  The size of the smaller type is indicated by the 1th
197     // operand, a ValueType node.
198     SIGN_EXTEND_INREG,
199
200     // FP_TO_[US]INT - Convert a floating point value to a signed or unsigned
201     // integer.
202     FP_TO_SINT,
203     FP_TO_UINT,
204
205     // FP_ROUND - Perform a rounding operation from the current
206     // precision down to the specified precision (currently always 64->32).
207     FP_ROUND,
208
209     // FP_ROUND_INREG - This operator takes a floating point register, and
210     // rounds it to a floating point value.  It then promotes it and returns it
211     // in a register of the same size.  This operation effectively just discards
212     // excess precision.  The type to round down to is specified by the 1th
213     // operation, a VTSDNode (currently always 64->32->64).
214     FP_ROUND_INREG,
215
216     // FP_EXTEND - Extend a smaller FP type into a larger FP type.
217     FP_EXTEND,
218
219     // BIT_CONVERT - Theis operator converts between integer and FP values, as
220     // if one was stored to memory as integer and the other was loaded from the
221     // same address (or equivalently for vector format conversions, etc).  The 
222     // source and result are required to have the same bit size (e.g. 
223     // f32 <-> i32).  This can also be used for int-to-int or fp-to-fp 
224     // conversions, but that is a noop, deleted by getNode().
225     BIT_CONVERT,
226     
227     // FNEG, FABS, FSQRT, FSIN, FCOS - Perform unary floating point negation,
228     // absolute value, square root, sine and cosine operations.
229     FNEG, FABS, FSQRT, FSIN, FCOS,
230
231     // Other operators.  LOAD and STORE have token chains as their first
232     // operand, then the same operands as an LLVM load/store instruction, then a
233     // SRCVALUE node that provides alias analysis information.
234     LOAD, STORE,
235     
236     // Abstract vector version of LOAD.  VLOAD has a token chain as the first
237     // operand, followed by a pointer operand, a constant element count, a value
238     // type node indicating the type of the elements, and a SRCVALUE node.
239     VLOAD,
240
241     // EXTLOAD, SEXTLOAD, ZEXTLOAD - These three operators all load a value from
242     // memory and extend them to a larger value (e.g. load a byte into a word
243     // register).  All three of these have four operands, a token chain, a
244     // pointer to load from, a SRCVALUE for alias analysis, and a VALUETYPE node
245     // indicating the type to load.
246     //
247     // SEXTLOAD loads the integer operand and sign extends it to a larger
248     //          integer result type.
249     // ZEXTLOAD loads the integer operand and zero extends it to a larger
250     //          integer result type.
251     // EXTLOAD  is used for two things: floating point extending loads, and
252     //          integer extending loads where it doesn't matter what the high
253     //          bits are set to.  The code generator is allowed to codegen this
254     //          into whichever operation is more efficient.
255     EXTLOAD, SEXTLOAD, ZEXTLOAD,
256
257     // TRUNCSTORE - This operators truncates (for integer) or rounds (for FP) a
258     // value and stores it to memory in one operation.  This can be used for
259     // either integer or floating point operands.  The first four operands of
260     // this are the same as a standard store.  The fifth is the ValueType to
261     // store it as (which will be smaller than the source value).
262     TRUNCSTORE,
263
264     // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned
265     // to a specified boundary.  The first operand is the token chain, the
266     // second is the number of bytes to allocate, and the third is the alignment
267     // boundary.  The size is guaranteed to be a multiple of the stack 
268     // alignment, and the alignment is guaranteed to be bigger than the stack 
269     // alignment (if required) or 0 to get standard stack alignment.
270     DYNAMIC_STACKALLOC,
271
272     // Control flow instructions.  These all have token chains.
273
274     // BR - Unconditional branch.  The first operand is the chain
275     // operand, the second is the MBB to branch to.
276     BR,
277
278     // BRCOND - Conditional branch.  The first operand is the chain,
279     // the second is the condition, the third is the block to branch
280     // to if the condition is true.
281     BRCOND,
282
283     // BRCONDTWOWAY - Two-way conditional branch.  The first operand is the
284     // chain, the second is the condition, the third is the block to branch to
285     // if true, and the forth is the block to branch to if false.  Targets
286     // usually do not implement this, preferring to have legalize demote the
287     // operation to BRCOND/BR pairs when necessary.
288     BRCONDTWOWAY,
289
290     // BR_CC - Conditional branch.  The behavior is like that of SELECT_CC, in
291     // that the condition is represented as condition code, and two nodes to
292     // compare, rather than as a combined SetCC node.  The operands in order are
293     // chain, cc, lhs, rhs, block to branch to if condition is true.
294     BR_CC,
295     
296     // BRTWOWAY_CC - Two-way conditional branch.  The operands in order are
297     // chain, cc, lhs, rhs, block to branch to if condition is true, block to
298     // branch to if condition is false.  Targets usually do not implement this,
299     // preferring to have legalize demote the operation to BRCOND/BR pairs.
300     BRTWOWAY_CC,
301     
302     // RET - Return from function.  The first operand is the chain,
303     // and any subsequent operands are the return values for the
304     // function.  This operation can have variable number of operands.
305     RET,
306
307     // CALL - Call to a function pointer.  The first operand is the chain, the
308     // second is the destination function pointer (a GlobalAddress for a direct
309     // call).  Arguments have already been lowered to explicit DAGs according to
310     // the calling convention in effect here.  TAILCALL is the same as CALL, but
311     // the callee is known not to access the stack of the caller.
312     CALL,
313     TAILCALL,
314
315     // STACKSAVE - STACKSAVE has one operand, an input chain.  It produces a
316     // value, the same type as the pointer type for the system, and an output
317     // chain.
318     STACKSAVE,
319     
320     // STACKRESTORE has two operands, an input chain and a pointer to restore to
321     // it returns an output chain.
322     STACKRESTORE,
323     
324     // MEMSET/MEMCPY/MEMMOVE - The first operand is the chain, and the rest
325     // correspond to the operands of the LLVM intrinsic functions.  The only
326     // result is a token chain.  The alignment argument is guaranteed to be a
327     // Constant node.
328     MEMSET,
329     MEMMOVE,
330     MEMCPY,
331
332     // CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end of
333     // a call sequence, and carry arbitrary information that target might want
334     // to know.  The first operand is a chain, the rest are specified by the
335     // target and not touched by the DAG optimizers.
336     CALLSEQ_START,  // Beginning of a call sequence
337     CALLSEQ_END,    // End of a call sequence
338
339     // SRCVALUE - This corresponds to a Value*, and is used to associate memory
340     // locations with their value.  This allows one use alias analysis
341     // information in the backend.
342     SRCVALUE,
343
344     // PCMARKER - This corresponds to the pcmarker intrinsic.
345     PCMARKER,
346
347     // READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
348     // The only operand is a chain and a value and a chain are produced.  The
349     // value is the contents of the architecture specific cycle counter like 
350     // register (or other high accuracy low latency clock source)
351     READCYCLECOUNTER,
352
353     // READPORT, WRITEPORT, READIO, WRITEIO - These correspond to the LLVM
354     // intrinsics of the same name.  The first operand is a token chain, the
355     // other operands match the intrinsic.  These produce a token chain in
356     // addition to a value (if any).
357     READPORT, WRITEPORT, READIO, WRITEIO,
358     
359     // HANDLENODE node - Used as a handle for various purposes.
360     HANDLENODE,
361
362     // LOCATION - This node is used to represent a source location for debug
363     // info.  It takes token chain as input, then a line number, then a column
364     // number, then a filename, then a working dir.  It produces a token chain
365     // as output.
366     LOCATION,
367     
368     // DEBUG_LOC - This node is used to represent source line information
369     // embedded in the code.  It takes a token chain as input, then a line
370     // number, then a column then a file id (provided by MachineDebugInfo.) It
371     // produces a token chain as output.
372     DEBUG_LOC,
373     
374     // DEBUG_LABEL - This node is used to mark a location in the code where a
375     // label should be generated for use by the debug information.  It takes a
376     // token chain as input and then a unique id (provided by MachineDebugInfo.)
377     // It produces a token chain as output.
378     DEBUG_LABEL,
379     
380     // BUILTIN_OP_END - This must be the last enum value in this list.
381     BUILTIN_OP_END,
382   };
383
384   //===--------------------------------------------------------------------===//
385   /// ISD::CondCode enum - These are ordered carefully to make the bitfields
386   /// below work out, when considering SETFALSE (something that never exists
387   /// dynamically) as 0.  "U" -> Unsigned (for integer operands) or Unordered
388   /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal
389   /// to.  If the "N" column is 1, the result of the comparison is undefined if
390   /// the input is a NAN.
391   ///
392   /// All of these (except for the 'always folded ops') should be handled for
393   /// floating point.  For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT,
394   /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used.
395   ///
396   /// Note that these are laid out in a specific order to allow bit-twiddling
397   /// to transform conditions.
398   enum CondCode {
399     // Opcode          N U L G E       Intuitive operation
400     SETFALSE,      //    0 0 0 0       Always false (always folded)
401     SETOEQ,        //    0 0 0 1       True if ordered and equal
402     SETOGT,        //    0 0 1 0       True if ordered and greater than
403     SETOGE,        //    0 0 1 1       True if ordered and greater than or equal
404     SETOLT,        //    0 1 0 0       True if ordered and less than
405     SETOLE,        //    0 1 0 1       True if ordered and less than or equal
406     SETONE,        //    0 1 1 0       True if ordered and operands are unequal
407     SETO,          //    0 1 1 1       True if ordered (no nans)
408     SETUO,         //    1 0 0 0       True if unordered: isnan(X) | isnan(Y)
409     SETUEQ,        //    1 0 0 1       True if unordered or equal
410     SETUGT,        //    1 0 1 0       True if unordered or greater than
411     SETUGE,        //    1 0 1 1       True if unordered, greater than, or equal
412     SETULT,        //    1 1 0 0       True if unordered or less than
413     SETULE,        //    1 1 0 1       True if unordered, less than, or equal
414     SETUNE,        //    1 1 1 0       True if unordered or not equal
415     SETTRUE,       //    1 1 1 1       Always true (always folded)
416     // Don't care operations: undefined if the input is a nan.
417     SETFALSE2,     //  1 X 0 0 0       Always false (always folded)
418     SETEQ,         //  1 X 0 0 1       True if equal
419     SETGT,         //  1 X 0 1 0       True if greater than
420     SETGE,         //  1 X 0 1 1       True if greater than or equal
421     SETLT,         //  1 X 1 0 0       True if less than
422     SETLE,         //  1 X 1 0 1       True if less than or equal
423     SETNE,         //  1 X 1 1 0       True if not equal
424     SETTRUE2,      //  1 X 1 1 1       Always true (always folded)
425
426     SETCC_INVALID,      // Marker value.
427   };
428
429   /// isSignedIntSetCC - Return true if this is a setcc instruction that
430   /// performs a signed comparison when used with integer operands.
431   inline bool isSignedIntSetCC(CondCode Code) {
432     return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE;
433   }
434
435   /// isUnsignedIntSetCC - Return true if this is a setcc instruction that
436   /// performs an unsigned comparison when used with integer operands.
437   inline bool isUnsignedIntSetCC(CondCode Code) {
438     return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE;
439   }
440
441   /// isTrueWhenEqual - Return true if the specified condition returns true if
442   /// the two operands to the condition are equal.  Note that if one of the two
443   /// operands is a NaN, this value is meaningless.
444   inline bool isTrueWhenEqual(CondCode Cond) {
445     return ((int)Cond & 1) != 0;
446   }
447
448   /// getUnorderedFlavor - This function returns 0 if the condition is always
449   /// false if an operand is a NaN, 1 if the condition is always true if the
450   /// operand is a NaN, and 2 if the condition is undefined if the operand is a
451   /// NaN.
452   inline unsigned getUnorderedFlavor(CondCode Cond) {
453     return ((int)Cond >> 3) & 3;
454   }
455
456   /// getSetCCInverse - Return the operation corresponding to !(X op Y), where
457   /// 'op' is a valid SetCC operation.
458   CondCode getSetCCInverse(CondCode Operation, bool isInteger);
459
460   /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X)
461   /// when given the operation for (X op Y).
462   CondCode getSetCCSwappedOperands(CondCode Operation);
463
464   /// getSetCCOrOperation - Return the result of a logical OR between different
465   /// comparisons of identical values: ((X op1 Y) | (X op2 Y)).  This
466   /// function returns SETCC_INVALID if it is not possible to represent the
467   /// resultant comparison.
468   CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger);
469
470   /// getSetCCAndOperation - Return the result of a logical AND between
471   /// different comparisons of identical values: ((X op1 Y) & (X op2 Y)).  This
472   /// function returns SETCC_INVALID if it is not possible to represent the
473   /// resultant comparison.
474   CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger);
475 }  // end llvm::ISD namespace
476
477
478 //===----------------------------------------------------------------------===//
479 /// SDOperand - Unlike LLVM values, Selection DAG nodes may return multiple
480 /// values as the result of a computation.  Many nodes return multiple values,
481 /// from loads (which define a token and a return value) to ADDC (which returns
482 /// a result and a carry value), to calls (which may return an arbitrary number
483 /// of values).
484 ///
485 /// As such, each use of a SelectionDAG computation must indicate the node that
486 /// computes it as well as which return value to use from that node.  This pair
487 /// of information is represented with the SDOperand value type.
488 ///
489 class SDOperand {
490 public:
491   SDNode *Val;        // The node defining the value we are using.
492   unsigned ResNo;     // Which return value of the node we are using.
493
494   SDOperand() : Val(0) {}
495   SDOperand(SDNode *val, unsigned resno) : Val(val), ResNo(resno) {}
496
497   bool operator==(const SDOperand &O) const {
498     return Val == O.Val && ResNo == O.ResNo;
499   }
500   bool operator!=(const SDOperand &O) const {
501     return !operator==(O);
502   }
503   bool operator<(const SDOperand &O) const {
504     return Val < O.Val || (Val == O.Val && ResNo < O.ResNo);
505   }
506
507   SDOperand getValue(unsigned R) const {
508     return SDOperand(Val, R);
509   }
510
511   /// getValueType - Return the ValueType of the referenced return value.
512   ///
513   inline MVT::ValueType getValueType() const;
514
515   // Forwarding methods - These forward to the corresponding methods in SDNode.
516   inline unsigned getOpcode() const;
517   inline unsigned getNodeDepth() const;
518   inline unsigned getNumOperands() const;
519   inline const SDOperand &getOperand(unsigned i) const;
520   inline bool isTargetOpcode() const;
521   inline unsigned getTargetOpcode() const;
522
523   /// hasOneUse - Return true if there is exactly one operation using this
524   /// result value of the defining operator.
525   inline bool hasOneUse() const;
526 };
527
528
529 /// simplify_type specializations - Allow casting operators to work directly on
530 /// SDOperands as if they were SDNode*'s.
531 template<> struct simplify_type<SDOperand> {
532   typedef SDNode* SimpleType;
533   static SimpleType getSimplifiedValue(const SDOperand &Val) {
534     return static_cast<SimpleType>(Val.Val);
535   }
536 };
537 template<> struct simplify_type<const SDOperand> {
538   typedef SDNode* SimpleType;
539   static SimpleType getSimplifiedValue(const SDOperand &Val) {
540     return static_cast<SimpleType>(Val.Val);
541   }
542 };
543
544
545 /// SDNode - Represents one node in the SelectionDAG.
546 ///
547 class SDNode {
548   /// NodeType - The operation that this node performs.
549   ///
550   unsigned short NodeType;
551
552   /// NodeDepth - Node depth is defined as MAX(Node depth of children)+1.  This
553   /// means that leaves have a depth of 1, things that use only leaves have a
554   /// depth of 2, etc.
555   unsigned short NodeDepth;
556
557   /// OperandList - The values that are used by this operation.
558   ///
559   SDOperand *OperandList;
560   
561   /// ValueList - The types of the values this node defines.  SDNode's may
562   /// define multiple values simultaneously.
563   MVT::ValueType *ValueList;
564
565   /// NumOperands/NumValues - The number of entries in the Operand/Value list.
566   unsigned short NumOperands, NumValues;
567   
568   /// Prev/Next pointers - These pointers form the linked list of of the
569   /// AllNodes list in the current DAG.
570   SDNode *Prev, *Next;
571   friend struct ilist_traits<SDNode>;
572
573   /// Uses - These are all of the SDNode's that use a value produced by this
574   /// node.
575   std::vector<SDNode*> Uses;
576 public:
577   virtual ~SDNode() {
578     assert(NumOperands == 0 && "Operand list not cleared before deletion");
579   }
580   
581   //===--------------------------------------------------------------------===//
582   //  Accessors
583   //
584   unsigned getOpcode()  const { return NodeType; }
585   bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; }
586   unsigned getTargetOpcode() const {
587     assert(isTargetOpcode() && "Not a target opcode!");
588     return NodeType - ISD::BUILTIN_OP_END;
589   }
590
591   size_t use_size() const { return Uses.size(); }
592   bool use_empty() const { return Uses.empty(); }
593   bool hasOneUse() const { return Uses.size() == 1; }
594
595   /// getNodeDepth - Return the distance from this node to the leaves in the
596   /// graph.  The leaves have a depth of 1.
597   unsigned getNodeDepth() const { return NodeDepth; }
598
599   typedef std::vector<SDNode*>::const_iterator use_iterator;
600   use_iterator use_begin() const { return Uses.begin(); }
601   use_iterator use_end() const { return Uses.end(); }
602
603   /// hasNUsesOfValue - Return true if there are exactly NUSES uses of the
604   /// indicated value.  This method ignores uses of other values defined by this
605   /// operation.
606   bool hasNUsesOfValue(unsigned NUses, unsigned Value);
607
608   /// getNumOperands - Return the number of values used by this operation.
609   ///
610   unsigned getNumOperands() const { return NumOperands; }
611
612   const SDOperand &getOperand(unsigned Num) const {
613     assert(Num < NumOperands && "Invalid child # of SDNode!");
614     return OperandList[Num];
615   }
616   typedef const SDOperand* op_iterator;
617   op_iterator op_begin() const { return OperandList; }
618   op_iterator op_end() const { return OperandList+NumOperands; }
619
620
621   /// getNumValues - Return the number of values defined/returned by this
622   /// operator.
623   ///
624   unsigned getNumValues() const { return NumValues; }
625
626   /// getValueType - Return the type of a specified result.
627   ///
628   MVT::ValueType getValueType(unsigned ResNo) const {
629     assert(ResNo < NumValues && "Illegal result number!");
630     return ValueList[ResNo];
631   }
632
633   typedef const MVT::ValueType* value_iterator;
634   value_iterator value_begin() const { return ValueList; }
635   value_iterator value_end() const { return ValueList+NumValues; }
636
637   /// getOperationName - Return the opcode of this operation for printing.
638   ///
639   const char* getOperationName(const SelectionDAG *G = 0) const;
640   void dump() const;
641   void dump(const SelectionDAG *G) const;
642
643   static bool classof(const SDNode *) { return true; }
644
645
646   /// setAdjCallChain - This method should only be used by the legalizer.
647   void setAdjCallChain(SDOperand N);
648
649 protected:
650   friend class SelectionDAG;
651   
652   /// getValueTypeList - Return a pointer to the specified value type.
653   ///
654   static MVT::ValueType *getValueTypeList(MVT::ValueType VT);
655
656   SDNode(unsigned NT, MVT::ValueType VT) : NodeType(NT), NodeDepth(1) {
657     OperandList = 0; NumOperands = 0;
658     ValueList = getValueTypeList(VT);
659     NumValues = 1;
660     Prev = 0; Next = 0;
661   }
662   SDNode(unsigned NT, SDOperand Op)
663     : NodeType(NT), NodeDepth(Op.Val->getNodeDepth()+1) {
664     OperandList = new SDOperand[1];
665     OperandList[0] = Op;
666     NumOperands = 1;
667     Op.Val->Uses.push_back(this);
668     ValueList = 0;
669     NumValues = 0;
670     Prev = 0; Next = 0;
671   }
672   SDNode(unsigned NT, SDOperand N1, SDOperand N2)
673     : NodeType(NT) {
674     if (N1.Val->getNodeDepth() > N2.Val->getNodeDepth())
675       NodeDepth = N1.Val->getNodeDepth()+1;
676     else
677       NodeDepth = N2.Val->getNodeDepth()+1;
678     OperandList = new SDOperand[2];
679     OperandList[0] = N1;
680     OperandList[1] = N2;
681     NumOperands = 2;
682     N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this);
683     ValueList = 0;
684     NumValues = 0;
685     Prev = 0; Next = 0;
686   }
687   SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3)
688     : NodeType(NT) {
689     unsigned ND = N1.Val->getNodeDepth();
690     if (ND < N2.Val->getNodeDepth())
691       ND = N2.Val->getNodeDepth();
692     if (ND < N3.Val->getNodeDepth())
693       ND = N3.Val->getNodeDepth();
694     NodeDepth = ND+1;
695
696     OperandList = new SDOperand[3];
697     OperandList[0] = N1;
698     OperandList[1] = N2;
699     OperandList[2] = N3;
700     NumOperands = 3;
701     
702     N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this);
703     N3.Val->Uses.push_back(this);
704     ValueList = 0;
705     NumValues = 0;
706     Prev = 0; Next = 0;
707   }
708   SDNode(unsigned NT, SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4)
709     : NodeType(NT) {
710     unsigned ND = N1.Val->getNodeDepth();
711     if (ND < N2.Val->getNodeDepth())
712       ND = N2.Val->getNodeDepth();
713     if (ND < N3.Val->getNodeDepth())
714       ND = N3.Val->getNodeDepth();
715     if (ND < N4.Val->getNodeDepth())
716       ND = N4.Val->getNodeDepth();
717     NodeDepth = ND+1;
718
719     OperandList = new SDOperand[4];
720     OperandList[0] = N1;
721     OperandList[1] = N2;
722     OperandList[2] = N3;
723     OperandList[3] = N4;
724     NumOperands = 4;
725     
726     N1.Val->Uses.push_back(this); N2.Val->Uses.push_back(this);
727     N3.Val->Uses.push_back(this); N4.Val->Uses.push_back(this);
728     ValueList = 0;
729     NumValues = 0;
730     Prev = 0; Next = 0;
731   }
732   SDNode(unsigned Opc, const std::vector<SDOperand> &Nodes) : NodeType(Opc) {
733     NumOperands = Nodes.size();
734     OperandList = new SDOperand[NumOperands];
735     
736     unsigned ND = 0;
737     for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
738       OperandList[i] = Nodes[i];
739       SDNode *N = OperandList[i].Val;
740       N->Uses.push_back(this);
741       if (ND < N->getNodeDepth()) ND = N->getNodeDepth();
742     }
743     NodeDepth = ND+1;
744     ValueList = 0;
745     NumValues = 0;
746     Prev = 0; Next = 0;
747   }
748
749   /// MorphNodeTo - This clears the return value and operands list, and sets the
750   /// opcode of the node to the specified value.  This should only be used by
751   /// the SelectionDAG class.
752   void MorphNodeTo(unsigned Opc) {
753     NodeType = Opc;
754     ValueList = 0;
755     NumValues = 0;
756     
757     // Clear the operands list, updating used nodes to remove this from their
758     // use list.
759     for (op_iterator I = op_begin(), E = op_end(); I != E; ++I)
760       I->Val->removeUser(this);
761     delete [] OperandList;
762     OperandList = 0;
763     NumOperands = 0;
764   }
765   
766   void setValueTypes(MVT::ValueType VT) {
767     assert(NumValues == 0 && "Should not have values yet!");
768     ValueList = getValueTypeList(VT);
769     NumValues = 1;
770   }
771   void setValueTypes(MVT::ValueType *List, unsigned NumVal) {
772     assert(NumValues == 0 && "Should not have values yet!");
773     ValueList = List;
774     NumValues = NumVal;
775   }
776   
777   void setOperands(SDOperand Op0) {
778     assert(NumOperands == 0 && "Should not have operands yet!");
779     OperandList = new SDOperand[1];
780     OperandList[0] = Op0;
781     NumOperands = 1;
782     Op0.Val->Uses.push_back(this);
783   }
784   void setOperands(SDOperand Op0, SDOperand Op1) {
785     assert(NumOperands == 0 && "Should not have operands yet!");
786     OperandList = new SDOperand[2];
787     OperandList[0] = Op0;
788     OperandList[1] = Op1;
789     NumOperands = 2;
790     Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
791   }
792   void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2) {
793     assert(NumOperands == 0 && "Should not have operands yet!");
794     OperandList = new SDOperand[3];
795     OperandList[0] = Op0;
796     OperandList[1] = Op1;
797     OperandList[2] = Op2;
798     NumOperands = 3;
799     Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
800     Op2.Val->Uses.push_back(this);
801   }
802   void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3) {
803     assert(NumOperands == 0 && "Should not have operands yet!");
804     OperandList = new SDOperand[4];
805     OperandList[0] = Op0;
806     OperandList[1] = Op1;
807     OperandList[2] = Op2;
808     OperandList[3] = Op3;
809     NumOperands = 4;
810     Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
811     Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
812   }
813   void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3,
814                    SDOperand Op4) {
815     assert(NumOperands == 0 && "Should not have operands yet!");
816     OperandList = new SDOperand[5];
817     OperandList[0] = Op0;
818     OperandList[1] = Op1;
819     OperandList[2] = Op2;
820     OperandList[3] = Op3;
821     OperandList[4] = Op4;
822     NumOperands = 5;
823     Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
824     Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
825     Op4.Val->Uses.push_back(this);
826   }
827   void setOperands(SDOperand Op0, SDOperand Op1, SDOperand Op2, SDOperand Op3,
828                    SDOperand Op4, SDOperand Op5) {
829     assert(NumOperands == 0 && "Should not have operands yet!");
830     OperandList = new SDOperand[6];
831     OperandList[0] = Op0;
832     OperandList[1] = Op1;
833     OperandList[2] = Op2;
834     OperandList[3] = Op3;
835     OperandList[4] = Op4;
836     OperandList[5] = Op5;
837     NumOperands = 6;
838     Op0.Val->Uses.push_back(this); Op1.Val->Uses.push_back(this);
839     Op2.Val->Uses.push_back(this); Op3.Val->Uses.push_back(this);
840     Op4.Val->Uses.push_back(this); Op5.Val->Uses.push_back(this);
841   }
842   void addUser(SDNode *User) {
843     Uses.push_back(User);
844   }
845   void removeUser(SDNode *User) {
846     // Remove this user from the operand's use list.
847     for (unsigned i = Uses.size(); ; --i) {
848       assert(i != 0 && "Didn't find user!");
849       if (Uses[i-1] == User) {
850         Uses[i-1] = Uses.back();
851         Uses.pop_back();
852         return;
853       }
854     }
855   }
856 };
857
858
859 // Define inline functions from the SDOperand class.
860
861 inline unsigned SDOperand::getOpcode() const {
862   return Val->getOpcode();
863 }
864 inline unsigned SDOperand::getNodeDepth() const {
865   return Val->getNodeDepth();
866 }
867 inline MVT::ValueType SDOperand::getValueType() const {
868   return Val->getValueType(ResNo);
869 }
870 inline unsigned SDOperand::getNumOperands() const {
871   return Val->getNumOperands();
872 }
873 inline const SDOperand &SDOperand::getOperand(unsigned i) const {
874   return Val->getOperand(i);
875 }
876 inline bool SDOperand::isTargetOpcode() const {
877   return Val->isTargetOpcode();
878 }
879 inline unsigned SDOperand::getTargetOpcode() const {
880   return Val->getTargetOpcode();
881 }
882 inline bool SDOperand::hasOneUse() const {
883   return Val->hasNUsesOfValue(1, ResNo);
884 }
885
886 /// HandleSDNode - This class is used to form a handle around another node that
887 /// is persistant and is updated across invocations of replaceAllUsesWith on its
888 /// operand.  This node should be directly created by end-users and not added to
889 /// the AllNodes list.
890 class HandleSDNode : public SDNode {
891 public:
892   HandleSDNode(SDOperand X) : SDNode(ISD::HANDLENODE, X) {}
893   ~HandleSDNode() {
894     MorphNodeTo(ISD::HANDLENODE);  // Drops operand uses.
895   }
896   
897   SDOperand getValue() const { return getOperand(0); }
898 };
899
900 class StringSDNode : public SDNode {
901   std::string Value;
902 protected:
903   friend class SelectionDAG;
904   StringSDNode(const std::string &val)
905     : SDNode(ISD::STRING, MVT::Other), Value(val) {
906   }
907 public:
908   const std::string &getValue() const { return Value; }
909   static bool classof(const StringSDNode *) { return true; }
910   static bool classof(const SDNode *N) {
911     return N->getOpcode() == ISD::STRING;
912   }
913 };  
914
915 class ConstantSDNode : public SDNode {
916   uint64_t Value;
917 protected:
918   friend class SelectionDAG;
919   ConstantSDNode(bool isTarget, uint64_t val, MVT::ValueType VT)
920     : SDNode(isTarget ? ISD::TargetConstant : ISD::Constant, VT), Value(val) {
921   }
922 public:
923
924   uint64_t getValue() const { return Value; }
925
926   int64_t getSignExtended() const {
927     unsigned Bits = MVT::getSizeInBits(getValueType(0));
928     return ((int64_t)Value << (64-Bits)) >> (64-Bits);
929   }
930
931   bool isNullValue() const { return Value == 0; }
932   bool isAllOnesValue() const {
933     int NumBits = MVT::getSizeInBits(getValueType(0));
934     if (NumBits == 64) return Value+1 == 0;
935     return Value == (1ULL << NumBits)-1;
936   }
937
938   static bool classof(const ConstantSDNode *) { return true; }
939   static bool classof(const SDNode *N) {
940     return N->getOpcode() == ISD::Constant ||
941            N->getOpcode() == ISD::TargetConstant;
942   }
943 };
944
945 class ConstantFPSDNode : public SDNode {
946   double Value;
947 protected:
948   friend class SelectionDAG;
949   ConstantFPSDNode(double val, MVT::ValueType VT)
950     : SDNode(ISD::ConstantFP, VT), Value(val) {
951   }
952 public:
953
954   double getValue() const { return Value; }
955
956   /// isExactlyValue - We don't rely on operator== working on double values, as
957   /// it returns true for things that are clearly not equal, like -0.0 and 0.0.
958   /// As such, this method can be used to do an exact bit-for-bit comparison of
959   /// two floating point values.
960   bool isExactlyValue(double V) const;
961
962   static bool classof(const ConstantFPSDNode *) { return true; }
963   static bool classof(const SDNode *N) {
964     return N->getOpcode() == ISD::ConstantFP;
965   }
966 };
967
968 class GlobalAddressSDNode : public SDNode {
969   GlobalValue *TheGlobal;
970   int offset;
971 protected:
972   friend class SelectionDAG;
973   GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT::ValueType VT,
974                       int o=0)
975     : SDNode(isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress, VT) {
976     TheGlobal = const_cast<GlobalValue*>(GA);
977     offset = o;
978   }
979 public:
980
981   GlobalValue *getGlobal() const { return TheGlobal; }
982   int getOffset() const { return offset; }
983
984   static bool classof(const GlobalAddressSDNode *) { return true; }
985   static bool classof(const SDNode *N) {
986     return N->getOpcode() == ISD::GlobalAddress ||
987            N->getOpcode() == ISD::TargetGlobalAddress;
988   }
989 };
990
991
992 class FrameIndexSDNode : public SDNode {
993   int FI;
994 protected:
995   friend class SelectionDAG;
996   FrameIndexSDNode(int fi, MVT::ValueType VT, bool isTarg)
997     : SDNode(isTarg ? ISD::TargetFrameIndex : ISD::FrameIndex, VT), FI(fi) {}
998 public:
999
1000   int getIndex() const { return FI; }
1001
1002   static bool classof(const FrameIndexSDNode *) { return true; }
1003   static bool classof(const SDNode *N) {
1004     return N->getOpcode() == ISD::FrameIndex ||
1005            N->getOpcode() == ISD::TargetFrameIndex;
1006   }
1007 };
1008
1009 class ConstantPoolSDNode : public SDNode {
1010   Constant *C;
1011 protected:
1012   friend class SelectionDAG;
1013   ConstantPoolSDNode(Constant *c, MVT::ValueType VT, bool isTarget)
1014     : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, VT),
1015     C(c) {}
1016 public:
1017
1018   Constant *get() const { return C; }
1019
1020   static bool classof(const ConstantPoolSDNode *) { return true; }
1021   static bool classof(const SDNode *N) {
1022     return N->getOpcode() == ISD::ConstantPool ||
1023            N->getOpcode() == ISD::TargetConstantPool;
1024   }
1025 };
1026
1027 class BasicBlockSDNode : public SDNode {
1028   MachineBasicBlock *MBB;
1029 protected:
1030   friend class SelectionDAG;
1031   BasicBlockSDNode(MachineBasicBlock *mbb)
1032     : SDNode(ISD::BasicBlock, MVT::Other), MBB(mbb) {}
1033 public:
1034
1035   MachineBasicBlock *getBasicBlock() const { return MBB; }
1036
1037   static bool classof(const BasicBlockSDNode *) { return true; }
1038   static bool classof(const SDNode *N) {
1039     return N->getOpcode() == ISD::BasicBlock;
1040   }
1041 };
1042
1043 class SrcValueSDNode : public SDNode {
1044   const Value *V;
1045   int offset;
1046 protected:
1047   friend class SelectionDAG;
1048   SrcValueSDNode(const Value* v, int o)
1049     : SDNode(ISD::SRCVALUE, MVT::Other), V(v), offset(o) {}
1050
1051 public:
1052   const Value *getValue() const { return V; }
1053   int getOffset() const { return offset; }
1054
1055   static bool classof(const SrcValueSDNode *) { return true; }
1056   static bool classof(const SDNode *N) {
1057     return N->getOpcode() == ISD::SRCVALUE;
1058   }
1059 };
1060
1061
1062 class RegisterSDNode : public SDNode {
1063   unsigned Reg;
1064 protected:
1065   friend class SelectionDAG;
1066   RegisterSDNode(unsigned reg, MVT::ValueType VT)
1067     : SDNode(ISD::Register, VT), Reg(reg) {}
1068 public:
1069
1070   unsigned getReg() const { return Reg; }
1071
1072   static bool classof(const RegisterSDNode *) { return true; }
1073   static bool classof(const SDNode *N) {
1074     return N->getOpcode() == ISD::Register;
1075   }
1076 };
1077
1078 class ExternalSymbolSDNode : public SDNode {
1079   const char *Symbol;
1080 protected:
1081   friend class SelectionDAG;
1082   ExternalSymbolSDNode(bool isTarget, const char *Sym, MVT::ValueType VT)
1083     : SDNode(isTarget ? ISD::TargetExternalSymbol : ISD::ExternalSymbol, VT),
1084       Symbol(Sym) {
1085     }
1086 public:
1087
1088   const char *getSymbol() const { return Symbol; }
1089
1090   static bool classof(const ExternalSymbolSDNode *) { return true; }
1091   static bool classof(const SDNode *N) {
1092     return N->getOpcode() == ISD::ExternalSymbol ||
1093            N->getOpcode() == ISD::TargetExternalSymbol;
1094   }
1095 };
1096
1097 class CondCodeSDNode : public SDNode {
1098   ISD::CondCode Condition;
1099 protected:
1100   friend class SelectionDAG;
1101   CondCodeSDNode(ISD::CondCode Cond)
1102     : SDNode(ISD::CONDCODE, MVT::Other), Condition(Cond) {
1103   }
1104 public:
1105
1106   ISD::CondCode get() const { return Condition; }
1107
1108   static bool classof(const CondCodeSDNode *) { return true; }
1109   static bool classof(const SDNode *N) {
1110     return N->getOpcode() == ISD::CONDCODE;
1111   }
1112 };
1113
1114 /// VTSDNode - This class is used to represent MVT::ValueType's, which are used
1115 /// to parameterize some operations.
1116 class VTSDNode : public SDNode {
1117   MVT::ValueType ValueType;
1118 protected:
1119   friend class SelectionDAG;
1120   VTSDNode(MVT::ValueType VT)
1121     : SDNode(ISD::VALUETYPE, MVT::Other), ValueType(VT) {}
1122 public:
1123
1124   MVT::ValueType getVT() const { return ValueType; }
1125
1126   static bool classof(const VTSDNode *) { return true; }
1127   static bool classof(const SDNode *N) {
1128     return N->getOpcode() == ISD::VALUETYPE;
1129   }
1130 };
1131
1132
1133 class SDNodeIterator : public forward_iterator<SDNode, ptrdiff_t> {
1134   SDNode *Node;
1135   unsigned Operand;
1136
1137   SDNodeIterator(SDNode *N, unsigned Op) : Node(N), Operand(Op) {}
1138 public:
1139   bool operator==(const SDNodeIterator& x) const {
1140     return Operand == x.Operand;
1141   }
1142   bool operator!=(const SDNodeIterator& x) const { return !operator==(x); }
1143
1144   const SDNodeIterator &operator=(const SDNodeIterator &I) {
1145     assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
1146     Operand = I.Operand;
1147     return *this;
1148   }
1149
1150   pointer operator*() const {
1151     return Node->getOperand(Operand).Val;
1152   }
1153   pointer operator->() const { return operator*(); }
1154
1155   SDNodeIterator& operator++() {                // Preincrement
1156     ++Operand;
1157     return *this;
1158   }
1159   SDNodeIterator operator++(int) { // Postincrement
1160     SDNodeIterator tmp = *this; ++*this; return tmp;
1161   }
1162
1163   static SDNodeIterator begin(SDNode *N) { return SDNodeIterator(N, 0); }
1164   static SDNodeIterator end  (SDNode *N) {
1165     return SDNodeIterator(N, N->getNumOperands());
1166   }
1167
1168   unsigned getOperand() const { return Operand; }
1169   const SDNode *getNode() const { return Node; }
1170 };
1171
1172 template <> struct GraphTraits<SDNode*> {
1173   typedef SDNode NodeType;
1174   typedef SDNodeIterator ChildIteratorType;
1175   static inline NodeType *getEntryNode(SDNode *N) { return N; }
1176   static inline ChildIteratorType child_begin(NodeType *N) {
1177     return SDNodeIterator::begin(N);
1178   }
1179   static inline ChildIteratorType child_end(NodeType *N) {
1180     return SDNodeIterator::end(N);
1181   }
1182 };
1183
1184 template<>
1185 struct ilist_traits<SDNode> {
1186   static SDNode *getPrev(const SDNode *N) { return N->Prev; }
1187   static SDNode *getNext(const SDNode *N) { return N->Next; }
1188   
1189   static void setPrev(SDNode *N, SDNode *Prev) { N->Prev = Prev; }
1190   static void setNext(SDNode *N, SDNode *Next) { N->Next = Next; }
1191   
1192   static SDNode *createSentinel() {
1193     return new SDNode(ISD::EntryToken, MVT::Other);
1194   }
1195   static void destroySentinel(SDNode *N) { delete N; }
1196   //static SDNode *createNode(const SDNode &V) { return new SDNode(V); }
1197   
1198   
1199   void addNodeToList(SDNode *NTy) {}
1200   void removeNodeFromList(SDNode *NTy) {}
1201   void transferNodesFromList(iplist<SDNode, ilist_traits> &L2,
1202                              const ilist_iterator<SDNode> &X,
1203                              const ilist_iterator<SDNode> &Y) {}
1204 };
1205
1206 } // end llvm namespace
1207
1208 #endif