If queried as to whether an operation is legal

for a particular MVT, return false if the type
is illegal rather than barfing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52229 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands 2008-06-12 09:01:30 +00:00
parent ca9bcb0fda
commit 4c54067f67

View File

@ -295,8 +295,9 @@ public:
/// isOperationLegal - Return true if the specified operation is legal on this /// isOperationLegal - Return true if the specified operation is legal on this
/// target. /// target.
bool isOperationLegal(unsigned Op, MVT VT) const { bool isOperationLegal(unsigned Op, MVT VT) const {
return getOperationAction(Op, VT) == Legal || return VT.isSimple() &&
getOperationAction(Op, VT) == Custom; (getOperationAction(Op, VT) == Legal ||
getOperationAction(Op, VT) == Custom);
} }
/// getLoadXAction - Return how this load with extension should be treated: /// getLoadXAction - Return how this load with extension should be treated:
@ -355,8 +356,9 @@ public:
/// isIndexedLoadLegal - Return true if the specified indexed load is legal /// isIndexedLoadLegal - Return true if the specified indexed load is legal
/// on this target. /// on this target.
bool isIndexedLoadLegal(unsigned IdxMode, MVT VT) const { bool isIndexedLoadLegal(unsigned IdxMode, MVT VT) const {
return getIndexedLoadAction(IdxMode, VT) == Legal || return VT.isSimple() &&
getIndexedLoadAction(IdxMode, VT) == Custom; (getIndexedLoadAction(IdxMode, VT) == Legal ||
getIndexedLoadAction(IdxMode, VT) == Custom);
} }
/// getIndexedStoreAction - Return how the indexed store should be treated: /// getIndexedStoreAction - Return how the indexed store should be treated:
@ -375,8 +377,9 @@ public:
/// isIndexedStoreLegal - Return true if the specified indexed load is legal /// isIndexedStoreLegal - Return true if the specified indexed load is legal
/// on this target. /// on this target.
bool isIndexedStoreLegal(unsigned IdxMode, MVT VT) const { bool isIndexedStoreLegal(unsigned IdxMode, MVT VT) const {
return getIndexedStoreAction(IdxMode, VT) == Legal || return VT.isSimple() &&
getIndexedStoreAction(IdxMode, VT) == Custom; (getIndexedStoreAction(IdxMode, VT) == Legal ||
getIndexedStoreAction(IdxMode, VT) == Custom);
} }
/// getConvertAction - Return how the conversion should be treated: /// getConvertAction - Return how the conversion should be treated:
@ -395,8 +398,9 @@ public:
/// isConvertLegal - Return true if the specified conversion is legal /// isConvertLegal - Return true if the specified conversion is legal
/// on this target. /// on this target.
bool isConvertLegal(MVT FromVT, MVT ToVT) const { bool isConvertLegal(MVT FromVT, MVT ToVT) const {
return getConvertAction(FromVT, ToVT) == Legal || return FromVT.isSimple() && ToVT.isSimple() &&
getConvertAction(FromVT, ToVT) == Custom; (getConvertAction(FromVT, ToVT) == Legal ||
getConvertAction(FromVT, ToVT) == Custom);
} }
/// getTypeToPromoteTo - If the action for this operation is to promote, this /// getTypeToPromoteTo - If the action for this operation is to promote, this