+ MemSDNode(unsigned Opc, SDVTList VTs, MVT MemoryVT,
+ const Value *srcValue, int SVOff,
+ unsigned alignment, bool isvolatile);
+
+ /// Returns alignment and volatility of the memory access
+ unsigned getAlignment() const { return (1u << (Flags >> 1)) >> 1; }
+ bool isVolatile() const { return Flags & 1; }
+
+ /// Returns the SrcValue and offset that describes the location of the access
+ const Value *getSrcValue() const { return SrcValue; }
+ int getSrcValueOffset() const { return SVOffset; }
+
+ /// getMemoryVT - Return the type of the in-memory value.
+ MVT getMemoryVT() const { return MemoryVT; }
+
+ /// getMemOperand - Return a MachineMemOperand object describing the memory
+ /// reference performed by operation.
+ MachineMemOperand getMemOperand() const;
+
+ const SDValue &getChain() const { return getOperand(0); }
+ const SDValue &getBasePtr() const {
+ return getOperand(getOpcode() == ISD::STORE ? 2 : 1);
+ }
+
+ // Methods to support isa and dyn_cast
+ static bool classof(const MemSDNode *) { return true; }
+ static bool classof(const SDNode *N) {
+ return N->getOpcode() == ISD::LOAD ||
+ N->getOpcode() == ISD::STORE ||
+ N->getOpcode() == ISD::ATOMIC_CMP_SWAP ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_ADD ||
+ N->getOpcode() == ISD::ATOMIC_SWAP ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_SUB ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_AND ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_OR ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_XOR ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_NAND ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_MIN ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_MAX ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_UMIN ||
+ N->getOpcode() == ISD::ATOMIC_LOAD_UMAX;
+ }
+};
+
+/// Atomic operations node
+class AtomicSDNode : public MemSDNode {
+ virtual void ANCHOR(); // Out-of-line virtual method to give class a home.
+ SDUse Ops[4];
+
+ public:
+ // Opc: opcode for atomic
+ // VTL: value type list
+ // Chain: memory chain for operaand
+ // Ptr: address to update as a SDValue
+ // Cmp: compare value
+ // Swp: swap value
+ // SrcVal: address to update as a Value (used for MemOperand)
+ // Align: alignment of memory
+ AtomicSDNode(unsigned Opc, SDVTList VTL, SDValue Chain, SDValue Ptr,
+ SDValue Cmp, SDValue Swp, const Value* SrcVal,
+ unsigned Align=0)
+ : MemSDNode(Opc, VTL, Cmp.getValueType(), SrcVal, /*SVOffset=*/0,
+ Align, /*isVolatile=*/true) {