Revert Christopher Lamb's load/store alignment changes.
[oota-llvm.git] / include / llvm / CodeGen / SelectionDAGNodes.h
index dd7aee353524153819acab24dcc8f082d21fd0d2..77d607a2cb6d0d02a8fa5d64b42551ae4aaf5e02 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef LLVM_CODEGEN_SELECTIONDAGNODES_H
 #define LLVM_CODEGEN_SELECTIONDAGNODES_H
 
+#include "llvm/GlobalVariable.h"
 #include "llvm/Value.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/GraphTraits.h"
@@ -48,11 +49,26 @@ struct SDVTList {
   unsigned short NumVTs;
 };
 
-
 /// ISD namespace - This namespace contains an enum which represents all of the
 /// SelectionDAG node types and value types.
 ///
 namespace ISD {
+  namespace ParamFlags {    
+  enum Flags {
+    NoFlagSet         = 0,
+    ZExt              = 1<<0,  ///< Parameter should be zero extended
+    ZExtOffs          = 0,
+    SExt              = 1<<1,  ///< Parameter should be sign extended
+    SExtOffs          = 1,
+    InReg             = 1<<2,  ///< Parameter should be passed in register
+    InRegOffs         = 2,
+    StructReturn      = 1<<3,  ///< Hidden struct-return pointer
+    StructReturnOffs  = 3,
+    OrigAlignment     = 0x1F<<27,
+    OrigAlignmentOffs = 27
+  };
+  }
+
   //===--------------------------------------------------------------------===//
   /// ISD::NodeType enum - This enum defines all of the operators valid in a
   /// SelectionDAG.
@@ -80,7 +96,8 @@ namespace ISD {
     // Various leaf nodes.
     STRING, BasicBlock, VALUETYPE, CONDCODE, Register,
     Constant, ConstantFP,
-    GlobalAddress, FrameIndex, JumpTable, ConstantPool, ExternalSymbol,
+    GlobalAddress, GlobalTLSAddress, FrameIndex,
+    JumpTable, ConstantPool, ExternalSymbol,
 
     // The address of the GOT
     GLOBAL_OFFSET_TABLE,
@@ -91,6 +108,14 @@ namespace ISD {
     // to the current function's frame or return address, an index of one to the
     // parent's frame or return address, and so on.
     FRAMEADDR, RETURNADDR,
+    
+    // RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the
+    // address of the exception block on entry to an landing pad block.
+    EXCEPTIONADDR,
+    
+    // RESULT, OUTCHAIN = EHSELECTION(INCHAIN, EXCEPTION) - This node represents
+    // the selection index of the exception thrown.
+    EHSELECTION,
 
     // TargetConstant* - Like Constant*, but the DAG does not do any folding or
     // simplification of the constant.
@@ -101,6 +126,7 @@ namespace ISD {
     // anything else with this node, and this is valid in the target-specific
     // dag, turning into a GlobalAddress operand.
     TargetGlobalAddress,
+    TargetGlobalTLSAddress,
     TargetFrameIndex,
     TargetJumpTable,
     TargetConstantPool,
@@ -184,6 +210,10 @@ namespace ISD {
     // Simple integer binary arithmetic operators.
     ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
     
+    // CARRY_FALSE - This node is used when folding other nodes,
+    // like ADDC/SUBC, which indicate the carry result is always false.
+    CARRY_FALSE,
+    
     // Carry-setting nodes for multiple precision addition and subtraction.
     // These nodes take two operands of the same value type, and produce two
     // results.  The first result is the normal add or sub result, the second
@@ -234,7 +264,7 @@ namespace ISD {
     VEXTRACT_VECTOR_ELT,
     
     /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR
-    /// (a legal packed type vector) identified by the (potentially variable)
+    /// (a legal vector type vector) identified by the (potentially variable)
     /// element number IDX.
     EXTRACT_VECTOR_ELT,
     
@@ -403,10 +433,11 @@ namespace ISD {
     TRUNCSTORE,
 
     // DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned
-    // to a specified boundary.  The first operand is the token chain, the
-    // second is the number of bytes to allocate, and the third is the alignment
-    // boundary.  The size is guaranteed to be a multiple of the stack 
-    // alignment, and the alignment is guaranteed to be bigger than the stack 
+    // to a specified boundary.  This node always has two return values: a new
+    // stack pointer value and a chain. The first operand is the token chain,
+    // the second is the number of bytes to allocate, and the third is the
+    // alignment boundary.  The size is guaranteed to be a multiple of the stack
+    // alignment, and the alignment is guaranteed to be bigger than the stack
     // alignment (if required) or 0 to get standard stack alignment.
     DYNAMIC_STACKALLOC,
 
@@ -457,7 +488,7 @@ namespace ISD {
     //   Operand #0 : input chain.
     //   Operand #1 : module unique number use to identify the label.
     LABEL,
-
+    
     // STACKSAVE - STACKSAVE has one operand, an input chain.  It produces a
     // value, the same type as the pointer type for the system, and an output
     // chain.
@@ -884,7 +915,7 @@ public:
 
   /// getOperationName - Return the opcode of this operation for printing.
   ///
-  const char* getOperationName(const SelectionDAG *G = 0) const;
+  std::string getOperationName(const SelectionDAG *G = 0) const;
   static const char* getIndexedModeName(ISD::MemIndexedMode AM);
   void dump() const;
   void dump(const SelectionDAG *G) const;
@@ -1048,7 +1079,7 @@ class HandleSDNode : public SDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
   SDOperand Op;
 public:
-  HandleSDNode(SDOperand X)
+  explicit HandleSDNode(SDOperand X)
     : SDNode(ISD::HANDLENODE, getSDVTList(MVT::Other)), Op(X) {
     InitOperands(&Op, 1);
   }
@@ -1061,7 +1092,7 @@ class StringSDNode : public SDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
 protected:
   friend class SelectionDAG;
-  StringSDNode(const std::string &val)
+  explicit StringSDNode(const std::string &val)
     : SDNode(ISD::STRING, getSDVTList(MVT::Other)), Value(val) {
   }
 public:
@@ -1136,7 +1167,12 @@ protected:
   friend class SelectionDAG;
   GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT::ValueType VT,
                       int o = 0)
-    : SDNode(isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress,
+    : SDNode(dyn_cast<GlobalVariable>(GA) &&
+             dyn_cast<GlobalVariable>(GA)->isThreadLocal() ?
+             // Thread Local
+             (isTarget ? ISD::TargetGlobalTLSAddress : ISD::GlobalTLSAddress) :
+             // Non Thread Local
+             (isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress),
              getSDVTList(VT)), Offset(o) {
     TheGlobal = const_cast<GlobalValue*>(GA);
   }
@@ -1148,11 +1184,12 @@ public:
   static bool classof(const GlobalAddressSDNode *) { return true; }
   static bool classof(const SDNode *N) {
     return N->getOpcode() == ISD::GlobalAddress ||
-           N->getOpcode() == ISD::TargetGlobalAddress;
+           N->getOpcode() == ISD::TargetGlobalAddress ||
+           N->getOpcode() == ISD::GlobalTLSAddress ||
+           N->getOpcode() == ISD::TargetGlobalTLSAddress;
   }
 };
 
-
 class FrameIndexSDNode : public SDNode {
   int FI;
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
@@ -1271,7 +1308,7 @@ class BasicBlockSDNode : public SDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
 protected:
   friend class SelectionDAG;
-  BasicBlockSDNode(MachineBasicBlock *mbb)
+  explicit BasicBlockSDNode(MachineBasicBlock *mbb)
     : SDNode(ISD::BasicBlock, getSDVTList(MVT::Other)), MBB(mbb) {
   }
 public:
@@ -1348,7 +1385,7 @@ class CondCodeSDNode : public SDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
 protected:
   friend class SelectionDAG;
-  CondCodeSDNode(ISD::CondCode Cond)
+  explicit CondCodeSDNode(ISD::CondCode Cond)
     : SDNode(ISD::CONDCODE, getSDVTList(MVT::Other)), Condition(Cond) {
   }
 public:
@@ -1368,7 +1405,7 @@ class VTSDNode : public SDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
 protected:
   friend class SelectionDAG;
-  VTSDNode(MVT::ValueType VT)
+  explicit VTSDNode(MVT::ValueType VT)
     : SDNode(ISD::VALUETYPE, getSDVTList(MVT::Other)), ValueType(VT) {
   }
 public:
@@ -1608,6 +1645,13 @@ namespace ISD {
       cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD;
   }
 
+  /// isUNINDEXEDLoad - Returns true if the specified node is a unindexed load.
+  ///
+  inline bool isUNINDEXEDLoad(const SDNode *N) {
+    return N->getOpcode() == ISD::LOAD &&
+      cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED;
+  }
+
   /// isNON_TRUNCStore - Returns true if the specified node is a non-truncating
   /// store.
   inline bool isNON_TRUNCStore(const SDNode *N) {