diff options
author | Nate Begeman <natebegeman@mac.com> | 2009-09-15 00:13:12 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2009-09-15 00:13:12 +0000 |
commit | e6798372ea38e5ea24c26282a0d69aa6e3829854 (patch) | |
tree | 6804a507d42394c643182543005d5ad548d4faaf /include/llvm/CodeGen/SelectionDAGNodes.h | |
parent | 264d245851173bbace9281a2378a6cc51162b030 (diff) |
Add an "original alignment" field to load and store nodes. This enables the
DAG Combiner to disambiguate chains for loads and stores of types which are
broken up by the Legalizer into smaller pieces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81813 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SelectionDAGNodes.h')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index c42ff38505..a3ce5d432d 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -1519,17 +1519,22 @@ private: //! SVOffset - Memory location offset. Note that base is defined in MemSDNode int SVOffset; + //! OrigAlign - The original alignment of this MemSDNode in the case where + // this node was created by legalize from a MemSDNode with known alignment. + unsigned OrigAlign; + public: MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, EVT MemoryVT, const Value *srcValue, int SVOff, - unsigned alignment, bool isvolatile); + unsigned alignment, bool isvolatile, unsigned oalign); MemSDNode(unsigned Opc, DebugLoc dl, SDVTList VTs, const SDValue *Ops, unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVOff, - unsigned alignment, bool isvolatile); + unsigned alignment, bool isvolatile, unsigned oalign); /// Returns alignment and volatility of the memory access unsigned getAlignment() const { return (1u << (SubclassData >> 6)) >> 1; } + unsigned getOriginalAlignment() const { return OrigAlign; } bool isVolatile() const { return (SubclassData >> 5) & 1; } /// getRawSubclassData - Return the SubclassData value, which contains an @@ -1600,14 +1605,14 @@ public: SDValue Cmp, SDValue Swp, const Value* SrcVal, unsigned Align=0) : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true) { + Align, /*isVolatile=*/true, /* OrigAlign=*/0) { InitOperands(Ops, Chain, Ptr, Cmp, Swp); } AtomicSDNode(unsigned Opc, DebugLoc dl, SDVTList VTL, EVT MemVT, SDValue Chain, SDValue Ptr, SDValue Val, const Value* SrcVal, unsigned Align=0) : MemSDNode(Opc, dl, VTL, MemVT, SrcVal, /*SVOffset=*/0, - Align, /*isVolatile=*/true) { + Align, /*isVolatile=*/true, /* OrigAlign=*/0) { InitOperands(Ops, Chain, Ptr, Val); } @@ -1648,7 +1653,8 @@ public: const SDValue *Ops, unsigned NumOps, EVT MemoryVT, const Value *srcValue, int SVO, unsigned Align, bool Vol, bool ReadMem, bool WriteMem) - : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol), + : MemSDNode(Opc, dl, VTs, Ops, NumOps, MemoryVT, srcValue, SVO, Align, Vol, + /* OrigAlign=*/0), ReadMem(ReadMem), WriteMem(WriteMem) { } @@ -2263,8 +2269,9 @@ class LSBaseSDNode : public MemSDNode { public: LSBaseSDNode(ISD::NodeType NodeTy, DebugLoc dl, SDValue *Operands, unsigned numOperands, SDVTList VTs, ISD::MemIndexedMode AM, - EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol) - : MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol) { + EVT VT, const Value *SV, int SVO, unsigned Align, bool Vol, + unsigned OAlign) + : MemSDNode(NodeTy, dl, VTs, VT, SV, SVO, Align, Vol, OAlign) { assert(Align != 0 && "Loads and stores should have non-zero aligment"); SubclassData |= AM << 2; assert(getAddressingMode() == AM && "MemIndexedMode encoding error!"); @@ -2302,9 +2309,10 @@ class LoadSDNode : public LSBaseSDNode { friend class SelectionDAG; LoadSDNode(SDValue *ChainPtrOff, DebugLoc dl, SDVTList VTs, ISD::MemIndexedMode AM, ISD::LoadExtType ETy, EVT LVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false) + const Value *SV, int O=0, unsigned Align=0, bool Vol=false, + unsigned OAlign=0) : LSBaseSDNode(ISD::LOAD, dl, ChainPtrOff, 3, - VTs, AM, LVT, SV, O, Align, Vol) { + VTs, AM, LVT, SV, O, Align, Vol, OAlign) { SubclassData |= (unsigned short)ETy; assert(getExtensionType() == ETy && "LoadExtType encoding error!"); } @@ -2331,9 +2339,10 @@ class StoreSDNode : public LSBaseSDNode { friend class SelectionDAG; StoreSDNode(SDValue *ChainValuePtrOff, DebugLoc dl, SDVTList VTs, ISD::MemIndexedMode AM, bool isTrunc, EVT SVT, - const Value *SV, int O=0, unsigned Align=0, bool Vol=false) + const Value *SV, int O=0, unsigned Align=0, bool Vol=false, + unsigned OAlign=0) : LSBaseSDNode(ISD::STORE, dl, ChainValuePtrOff, 4, - VTs, AM, SVT, SV, O, Align, Vol) { + VTs, AM, SVT, SV, O, Align, Vol, OAlign) { SubclassData |= (unsigned short)isTrunc; assert(isTruncatingStore() == isTrunc && "isTrunc encoding error!"); } |