[llvm-commits] [llvm] r52722 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/TargetSelectionDAG.td lib/Target/X86/X86ISelLowering.cpp

Dan Gohman gohman at apple.com
Wed Jun 25 09:07:49 PDT 2008


Author: djg
Date: Wed Jun 25 11:07:49 2008
New Revision: 52722

URL: http://llvm.org/viewvc/llvm-project?rev=52722&view=rev
Log:
Remove the OrigVT member from AtomicSDNode, as it is redundant with
the base SDNode's VTList.

Modified:
    llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
    llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    llvm/trunk/lib/Target/TargetSelectionDAG.td
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=52722&r1=52721&r2=52722&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jun 25 11:07:49 2008
@@ -370,13 +370,13 @@
   /// getAtomic - Gets a node for an atomic op, produces result and chain, takes
   /// 3 operands
   SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, 
-                      SDOperand Cmp, SDOperand Swp, MVT VT, const Value* PtrVal,
+                      SDOperand Cmp, SDOperand Swp, const Value* PtrVal,
                       unsigned Alignment=0);
 
   /// getAtomic - Gets a node for an atomic op, produces result and chain, takes
   /// 2 operands
   SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, 
-                      SDOperand Val, MVT VT, const Value* PtrVal,
+                      SDOperand Val, const Value* PtrVal,
                       unsigned Alignment = 0);
 
   /// getLoad - Loads are not normal binary operators: their result type is not

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=52722&r1=52721&r2=52722&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Wed Jun 25 11:07:49 2008
@@ -1491,7 +1491,6 @@
 class AtomicSDNode : public MemSDNode {
   virtual void ANCHOR();  // Out-of-line virtual method to give class a home.
   SDUse Ops[4];
-  MVT OrigVT;
   
  public:
   // Opc:   opcode for atomic
@@ -1500,13 +1499,12 @@
   // Ptr:    address to update as a SDOperand
   // Cmp:    compare value
   // Swp:    swap value
-  // VT:     resulting value type
   // SrcVal: address to update as a Value (used for MemOperand)
   // Align:  alignment of memory
   AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, 
-               SDOperand Cmp, SDOperand Swp, MVT VT, const Value* SrcVal,
+               SDOperand Cmp, SDOperand Swp, const Value* SrcVal,
                unsigned Align=0)
-    : MemSDNode(Opc, VTL, SrcVal, Align), OrigVT(VT) {
+    : MemSDNode(Opc, VTL, SrcVal, Align) {
     Ops[0] = Chain;
     Ops[1] = Ptr;
     Ops[2] = Swp;
@@ -1514,15 +1512,14 @@
     InitOperands(Ops, 4);
   }
   AtomicSDNode(unsigned Opc, SDVTList VTL, SDOperand Chain, SDOperand Ptr, 
-               SDOperand Val, MVT VT, const Value* SrcVal, unsigned Align=0)
-    : MemSDNode(Opc, VTL, SrcVal, Align), OrigVT(VT) {
+               SDOperand Val, const Value* SrcVal, unsigned Align=0)
+    : MemSDNode(Opc, VTL, SrcVal, Align) {
     Ops[0] = Chain;
     Ops[1] = Ptr;
     Ops[2] = Val;
     InitOperands(Ops, 3);
   }
   
-  MVT getVT() const { return OrigVT; }
   const SDOperand &getChain() const { return getOperand(0); }
   const SDOperand &getBasePtr() const { return getOperand(1); }
   const SDOperand &getVal() const { return getOperand(2); }

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=52722&r1=52721&r2=52722&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jun 25 11:07:49 2008
@@ -4276,7 +4276,7 @@
     Tmp3 = PromoteOp(Node->getOperand(3));
     Result = DAG.getAtomic(Node->getOpcode(), AtomNode->getChain(), 
                            AtomNode->getBasePtr(), Tmp2, Tmp3,
-                           AtomNode->getVT(), AtomNode->getSrcValue(),
+                           AtomNode->getSrcValue(),
                            AtomNode->getAlignment());
     // Remember that we legalized the chain.
     AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1)));
@@ -4297,7 +4297,7 @@
     Tmp2 = PromoteOp(Node->getOperand(2));
     Result = DAG.getAtomic(Node->getOpcode(), AtomNode->getChain(), 
                            AtomNode->getBasePtr(), Tmp2,
-                           AtomNode->getVT(), AtomNode->getSrcValue(),
+                           AtomNode->getSrcValue(),
                            AtomNode->getAlignment());
     // Remember that we legalized the chain.
     AddLegalizedOperand(Op.getValue(1), LegalizeOp(Result.getValue(1)));

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52722&r1=52721&r2=52722&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jun 25 11:07:49 2008
@@ -2989,7 +2989,7 @@
 
 SDOperand SelectionDAG::getAtomic(unsigned Opcode, SDOperand Chain, 
                                   SDOperand Ptr, SDOperand Cmp, 
-                                  SDOperand Swp, MVT VT, const Value* PtrVal,
+                                  SDOperand Swp, const Value* PtrVal,
                                   unsigned Alignment) {
   assert(Opcode == ISD::ATOMIC_CMP_SWAP && "Invalid Atomic Op");
   assert(Cmp.getValueType() == Swp.getValueType() && "Invalid Atomic Op Types");
@@ -2997,11 +2997,10 @@
   FoldingSetNodeID ID;
   SDOperand Ops[] = {Chain, Ptr, Cmp, Swp};
   AddNodeIDNode(ID, Opcode, VTs, Ops, 4);
-  ID.AddInteger(VT.getRawBits());
   void* IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
     return SDOperand(E, 0);
-  SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Cmp, Swp, VT,
+  SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Cmp, Swp,
                                PtrVal, Alignment);
   CSEMap.InsertNode(N, IP);
   AllNodes.push_back(N);
@@ -3010,7 +3009,7 @@
 
 SDOperand SelectionDAG::getAtomic(unsigned Opcode, SDOperand Chain, 
                                   SDOperand Ptr, SDOperand Val, 
-                                  MVT VT, const Value* PtrVal,
+                                  const Value* PtrVal,
                                   unsigned Alignment) {
   assert((   Opcode == ISD::ATOMIC_LOAD_ADD || Opcode == ISD::ATOMIC_LOAD_SUB
           || Opcode == ISD::ATOMIC_SWAP || Opcode == ISD::ATOMIC_LOAD_AND
@@ -3023,11 +3022,10 @@
   FoldingSetNodeID ID;
   SDOperand Ops[] = {Chain, Ptr, Val};
   AddNodeIDNode(ID, Opcode, VTs, Ops, 3);
-  ID.AddInteger(VT.getRawBits());
   void* IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
     return SDOperand(E, 0);
-  SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Val, VT,
+  SDNode* N = new AtomicSDNode(Opcode, VTs, Chain, Ptr, Val,
                                PtrVal, Alignment);
   CSEMap.InsertNode(N, IP);
   AllNodes.push_back(N);
@@ -4217,7 +4215,7 @@
 /// getMemOperand - Return a MachineMemOperand object describing the memory
 /// reference performed by this atomic.
 MachineMemOperand AtomicSDNode::getMemOperand() const {
-  int Size = (getVT().getSizeInBits() + 7) >> 3;
+  int Size = (getValueType(0).getSizeInBits() + 7) >> 3;
   int Flags = MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
   if (isVolatile()) Flags |= MachineMemOperand::MOVolatile;
   

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52722&r1=52721&r2=52722&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jun 25 11:07:49 2008
@@ -3085,10 +3085,9 @@
 const char *
 SelectionDAGLowering::implVisitBinaryAtomic(CallInst& I, ISD::NodeType Op) {
   SDOperand Root = getRoot();   
-  SDOperand O2 = getValue(I.getOperand(2));
   SDOperand L = DAG.getAtomic(Op, Root, 
                               getValue(I.getOperand(1)), 
-                              O2, O2.getValueType(),
+                              getValue(I.getOperand(2)),
                               I.getOperand(1));
   setValue(&I, L);
   DAG.setRoot(L.getValue(1));
@@ -3521,11 +3520,10 @@
   }
   case Intrinsic::atomic_cmp_swap: {
     SDOperand Root = getRoot();   
-    SDOperand O3 = getValue(I.getOperand(3));
     SDOperand L = DAG.getAtomic(ISD::ATOMIC_CMP_SWAP, Root, 
                                 getValue(I.getOperand(1)), 
                                 getValue(I.getOperand(2)),
-                                O3, O3.getValueType(),
+                                getValue(I.getOperand(3)),
                                 I.getOperand(1));
     setValue(&I, L);
     DAG.setRoot(L.getValue(1));

Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetSelectionDAG.td?rev=52722&r1=52721&r2=52722&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetSelectionDAG.td (original)
+++ llvm/trunk/lib/Target/TargetSelectionDAG.td Wed Jun 25 11:07:49 2008
@@ -768,75 +768,75 @@
 def atomic_cmp_swap_8 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp),
                     (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i8;
+        return V->getValueType(0) == MVT::i8;
   return false;
 }]>;
 def atomic_cmp_swap_16 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), 
                     (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i16;
+        return V->getValueType(0) == MVT::i16;
   return false;
 }]>;
 def atomic_cmp_swap_32 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), 
                     (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i32;
+        return V->getValueType(0) == MVT::i32;
   return false;
 }]>;
 def atomic_cmp_swap_64 : PatFrag<(ops node:$ptr, node:$cmp, node:$swp), 
                     (atomic_cmp_swap node:$ptr, node:$cmp, node:$swp), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i64;
+        return V->getValueType(0) == MVT::i64;
   return false;
 }]>;
 
 def atomic_load_add_8 : PatFrag<(ops node:$ptr, node:$inc),
                     (atomic_load_add node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i8;
+        return V->getValueType(0) == MVT::i8;
   return false;
 }]>;
 def atomic_load_add_16 : PatFrag<(ops node:$ptr, node:$inc), 
                     (atomic_load_add node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i16;
+        return V->getValueType(0) == MVT::i16;
   return false;
 }]>;
 def atomic_load_add_32 : PatFrag<(ops node:$ptr, node:$inc), 
                     (atomic_load_add node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i32;
+        return V->getValueType(0) == MVT::i32;
   return false;
 }]>;
 def atomic_load_add_64 : PatFrag<(ops node:$ptr, node:$inc), 
                     (atomic_load_add node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i64;
+        return V->getValueType(0) == MVT::i64;
   return false;
 }]>;
 
 def atomic_swap_8 : PatFrag<(ops node:$ptr, node:$inc),
                     (atomic_swap node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i8;
+        return V->getValueType(0) == MVT::i8;
   return false;
 }]>;
 def atomic_swap_16 : PatFrag<(ops node:$ptr, node:$inc), 
                     (atomic_swap node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i16;
+        return V->getValueType(0) == MVT::i16;
   return false;
 }]>;
 def atomic_swap_32 : PatFrag<(ops node:$ptr, node:$inc), 
                     (atomic_swap node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i32;
+        return V->getValueType(0) == MVT::i32;
   return false;
 }]>;
 def atomic_swap_64 : PatFrag<(ops node:$ptr, node:$inc), 
                     (atomic_swap node:$ptr, node:$inc), [{
   if (AtomicSDNode* V = dyn_cast<AtomicSDNode>(N))
-        return V->getVT() == MVT::i64;
+        return V->getValueType(0) == MVT::i64;
   return false;
 }]>;
 

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52722&r1=52721&r2=52722&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jun 25 11:07:49 2008
@@ -5656,7 +5656,7 @@
 }
 
 SDOperand X86TargetLowering::LowerCMP_SWAP(SDOperand Op, SelectionDAG &DAG) {
-  MVT T = cast<AtomicSDNode>(Op.Val)->getVT();
+  MVT T = Op.getValueType();
   unsigned Reg = 0;
   unsigned size = 0;
   switch(T.getSimpleVT()) {
@@ -5687,7 +5687,7 @@
 }
 
 SDNode* X86TargetLowering::ExpandATOMIC_CMP_SWAP(SDNode* Op, SelectionDAG &DAG) {
-  MVT T = cast<AtomicSDNode>(Op)->getVT();
+  MVT T = Op->getValueType(0);
   assert (T == MVT::i64 && "Only know how to expand i64 Cmp and Swap");
   SDOperand cpInL, cpInH;
   cpInL = DAG.getNode(ISD::EXTRACT_ELEMENT, MVT::i32, Op->getOperand(3),
@@ -5723,12 +5723,12 @@
 }
 
 SDNode* X86TargetLowering::ExpandATOMIC_LOAD_SUB(SDNode* Op, SelectionDAG &DAG) {
-  MVT T = cast<AtomicSDNode>(Op)->getVT();
+  MVT T = Op->getValueType(0);
   assert (T == MVT::i32 && "Only know how to expand i32 Atomic Load Sub");
   SDOperand negOp = DAG.getNode(ISD::SUB, T,
                                 DAG.getConstant(0, T), Op->getOperand(2));
   return DAG.getAtomic(ISD::ATOMIC_LOAD_ADD, Op->getOperand(0),
-                       Op->getOperand(1), negOp, T,
+                       Op->getOperand(1), negOp,
                        cast<AtomicSDNode>(Op)->getSrcValue(),
                        cast<AtomicSDNode>(Op)->getAlignment()).Val;
 }





More information about the llvm-commits mailing list