diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index d78482673b0..83f819a2d5f 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(N); - return Ld->getExtensionType() == ISD::NON_EXTLOAD && + const LoadSDNode *Ld = dyn_cast(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(N) && cast(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(N) && cast(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(N) && cast(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(N) && cast(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(N) && cast(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(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(N)->isTruncatingStore(); + return isa(N) && !cast(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(N)->isTruncatingStore(); + return isa(N) && cast(N)->isTruncatingStore(); + } + + /// isUNINDEXEDStore - Returns true if the specified node is an + /// unindexed store. + inline bool isUNINDEXEDStore(const SDNode *N) { + return isa(N) && + cast(N)->getAddressingMode() == ISD::UNINDEXED; } }