diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-17 19:59:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-17 19:59:44 +0000 |
commit | 3bc0850bd4beeec5b464fce8513d3c749ee413eb (patch) | |
tree | ccfaeb8139d4ccbaee5c9bb214958ba9b805dc56 /include | |
parent | 38aa47580ab5d7bfd05fb08be9f284a63bbbd571 (diff) | |
download | external_llvm-3bc0850bd4beeec5b464fce8513d3c749ee413eb.zip external_llvm-3bc0850bd4beeec5b464fce8513d3c749ee413eb.tar.gz external_llvm-3bc0850bd4beeec5b464fce8513d3c749ee413eb.tar.bz2 |
This commit changes:
1. Legalize now always promotes truncstore of i1 to i8.
2. Remove patterns and gunk related to truncstore i1 from targets.
3. Rename the StoreXAction stuff to TruncStoreAction in TLI.
4. Make the TLI TruncStoreAction table a 2d table to handle from/to conversions.
5. Mark a wide variety of invalid truncstores as such in various targets, e.g.
X86 currently doesn't support truncstore of any of its integer types.
6. Add legalize support for truncstores with invalid value input types.
7. Add a dag combine transform to turn store(truncate) into truncstore when
safe.
The later allows us to compile CodeGen/X86/storetrunc-fp.ll to:
_foo:
fldt 20(%esp)
fldt 4(%esp)
faddp %st(1)
movl 36(%esp), %eax
fstps (%eax)
ret
instead of:
_foo:
subl $4, %esp
fldt 24(%esp)
fldt 8(%esp)
faddp %st(1)
fstps (%esp)
movl 40(%esp), %eax
movss (%esp), %xmm0
movss %xmm0, (%eax)
addl $4, %esp
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46140 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 06c160b..25456d7 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -301,19 +301,22 @@ public: getLoadXAction(LType, VT) == Custom; } - /// getStoreXAction - Return how this store with truncation should be treated: - /// either it is legal, needs to be promoted to a larger size, needs to be - /// expanded to some other code sequence, or the target has a custom expander - /// for it. - LegalizeAction getStoreXAction(MVT::ValueType VT) const { - if (MVT::isExtendedVT(VT)) return getTypeAction(VT); - return (LegalizeAction)((StoreXActions >> (2*VT)) & 3); + /// getTruncStoreAction - Return how this store with truncation should be + /// treated: either it is legal, needs to be promoted to a larger size, needs + /// to be expanded to some other code sequence, or the target has a custom + /// expander for it. + LegalizeAction getTruncStoreAction(MVT::ValueType ValVT, + MVT::ValueType MemVT) const { + assert(ValVT < MVT::LAST_VALUETYPE && MemVT < 32 && + "Table isn't big enough!"); + return (LegalizeAction)((TruncStoreActions[ValVT] >> (2*MemVT)) & 3); } - /// isStoreXLegal - Return true if the specified store with truncation is + /// isTruncStoreLegal - Return true if the specified store with truncation is /// legal on this target. - bool isStoreXLegal(MVT::ValueType VT) const { - return getStoreXAction(VT) == Legal || getStoreXAction(VT) == Custom; + bool isTruncStoreLegal(MVT::ValueType ValVT, MVT::ValueType MemVT) const { + return getTruncStoreAction(ValVT, MemVT) == Legal || + getTruncStoreAction(ValVT, MemVT) == Custom; } /// getIndexedLoadAction - Return how the indexed load should be treated: @@ -760,12 +763,14 @@ protected: LoadXActions[ExtType] |= (uint64_t)Action << VT*2; } - /// setStoreXAction - Indicate that the specified store with truncation does + /// setTruncStoreAction - Indicate that the specified truncating store does /// not work with the with specified type and indicate what to do about it. - void setStoreXAction(MVT::ValueType VT, LegalizeAction Action) { - assert(VT < 32 && "Table isn't big enough!"); - StoreXActions &= ~(uint64_t(3UL) << VT*2); - StoreXActions |= (uint64_t)Action << VT*2; + void setTruncStoreAction(MVT::ValueType ValVT, MVT::ValueType MemVT, + LegalizeAction Action) { + assert(ValVT < MVT::LAST_VALUETYPE && MemVT < 32 && + "Table isn't big enough!"); + TruncStoreActions[ValVT] &= ~(uint64_t(3UL) << MemVT*2); + TruncStoreActions[ValVT] |= (uint64_t)Action << MemVT*2; } /// setIndexedLoadAction - Indicate that the specified indexed load does or @@ -1183,10 +1188,9 @@ private: /// with the load. uint64_t LoadXActions[ISD::LAST_LOADX_TYPE]; - /// StoreXActions - For each store with truncation of each value type, keep a - /// LegalizeAction that indicates how instruction selection should deal with - /// the store. - uint64_t StoreXActions; + /// TruncStoreActions - For each truncating store, keep a LegalizeAction that + /// indicates how instruction selection should deal with the store. + uint64_t TruncStoreActions[MVT::LAST_VALUETYPE]; /// IndexedModeActions - For each indexed mode and each value type, keep a /// pair of LegalizeAction that indicates how instruction selection should |