diff options
author | Duncan Sands <baldrick@free.fr> | 2008-06-20 18:34:30 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-06-20 18:34:30 +0000 |
commit | c8f88cc8c0b4ce1664520d5390c623f2c44e4555 (patch) | |
tree | 57dd99f58e259e21c40f9624b3c135045aca5807 /include/llvm/CodeGen/SelectionDAGNodes.h | |
parent | 4fc4fd657d4266059dac3849133a3a351b03d99d (diff) |
Add some methods for querying the nature of a
store, like the methods for loads (and neaten
those up a bit while there).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/SelectionDAGNodes.h')
-rw-r--r-- | include/llvm/CodeGen/SelectionDAGNodes.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index d78482673b..83f819a2d5 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -2143,60 +2143,71 @@ namespace ISD { /// isNormalLoad - Returns true if the specified node is a non-extending /// and unindexed load. inline bool isNormalLoad(const SDNode *N) { - if (N->getOpcode() != ISD::LOAD) - return false; - const LoadSDNode *Ld = cast<LoadSDNode>(N); - return Ld->getExtensionType() == ISD::NON_EXTLOAD && + const LoadSDNode *Ld = dyn_cast<LoadSDNode>(N); + return Ld && Ld->getExtensionType() == ISD::NON_EXTLOAD && Ld->getAddressingMode() == ISD::UNINDEXED; } /// isNON_EXTLoad - Returns true if the specified node is a non-extending /// load. inline bool isNON_EXTLoad(const SDNode *N) { - return N->getOpcode() == ISD::LOAD && + return isa<LoadSDNode>(N) && cast<LoadSDNode>(N)->getExtensionType() == ISD::NON_EXTLOAD; } /// isEXTLoad - Returns true if the specified node is a EXTLOAD. /// inline bool isEXTLoad(const SDNode *N) { - return N->getOpcode() == ISD::LOAD && + return isa<LoadSDNode>(N) && cast<LoadSDNode>(N)->getExtensionType() == ISD::EXTLOAD; } /// isSEXTLoad - Returns true if the specified node is a SEXTLOAD. /// inline bool isSEXTLoad(const SDNode *N) { - return N->getOpcode() == ISD::LOAD && + return isa<LoadSDNode>(N) && cast<LoadSDNode>(N)->getExtensionType() == ISD::SEXTLOAD; } /// isZEXTLoad - Returns true if the specified node is a ZEXTLOAD. /// inline bool isZEXTLoad(const SDNode *N) { - return N->getOpcode() == ISD::LOAD && + return isa<LoadSDNode>(N) && cast<LoadSDNode>(N)->getExtensionType() == ISD::ZEXTLOAD; } - /// isUNINDEXEDLoad - Returns true if the specified node is a unindexed load. + /// isUNINDEXEDLoad - Returns true if the specified node is an unindexed load. /// inline bool isUNINDEXEDLoad(const SDNode *N) { - return N->getOpcode() == ISD::LOAD && + return isa<LoadSDNode>(N) && cast<LoadSDNode>(N)->getAddressingMode() == ISD::UNINDEXED; } + /// isNormalStore - Returns true if the specified node is a non-truncating + /// and unindexed store. + inline bool isNormalStore(const SDNode *N) { + const StoreSDNode *St = dyn_cast<StoreSDNode>(N); + return St && !St->isTruncatingStore() && + St->getAddressingMode() == ISD::UNINDEXED; + } + /// isNON_TRUNCStore - Returns true if the specified node is a non-truncating /// store. inline bool isNON_TRUNCStore(const SDNode *N) { - return N->getOpcode() == ISD::STORE && - !cast<StoreSDNode>(N)->isTruncatingStore(); + return isa<StoreSDNode>(N) && !cast<StoreSDNode>(N)->isTruncatingStore(); } /// isTRUNCStore - Returns true if the specified node is a truncating /// store. inline bool isTRUNCStore(const SDNode *N) { - return N->getOpcode() == ISD::STORE && - cast<StoreSDNode>(N)->isTruncatingStore(); + return isa<StoreSDNode>(N) && cast<StoreSDNode>(N)->isTruncatingStore(); + } + + /// isUNINDEXEDStore - Returns true if the specified node is an + /// unindexed store. + inline bool isUNINDEXEDStore(const SDNode *N) { + return isa<StoreSDNode>(N) && + cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED; } } |