[LLVMdev] [PATCH] Replacing EVT:s with MVT:s (when possible)
Patrik Hägglund H
patrik.h.hagglund at ericsson.com
Thu Dec 6 02:04:27 PST 2012
Here is a series of patches replacing EVT with MVT at a number of places in TargetLowering. The last two patches are related cleanups in SelectionDAGBuilder.
/Patrik Hägglund
> git log --stat --reverse origin/master..
commit 8dabe3eb005360347eabb86a2e88c3b6e9098ed5
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 10:37:37 2012 +0100
Change TargetLowering::getRegClassFor to take an MVT, instead of EVT.
Accordingly, added helper funtions getSimpleValueType (in parallel
to getValueType) in SDValue, SDNode, and TargetLowering.
include/llvm/CodeGen/FunctionLoweringInfo.h | 2 +-
include/llvm/CodeGen/SelectionDAGNodes.h | 11 ++++
include/llvm/Target/TargetLowering.h | 11 ++--
lib/CodeGen/SelectionDAG/FastISel.cpp | 11 ++--
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 4 +-
lib/CodeGen/SelectionDAG/InstrEmitter.cpp | 14 ++--
lib/CodeGen/SelectionDAG/InstrEmitter.h | 2 +-
lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp | 16 ++---
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 +--
lib/Target/ARM/ARMFastISel.cpp | 76 ++++++++++------------
lib/Target/ARM/ARMISelLowering.cpp | 2 +-
lib/Target/ARM/ARMISelLowering.h | 2 +-
lib/Target/Mips/MipsISelLowering.cpp | 6 +-
13 files changed, 87 insertions(+), 78 deletions(-)
commit 9add28389f360a0aa3f21b282a025c957309093f
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 10:59:05 2012 +0100
Change TargetLowering::getRepRegClassFor to take an MVT, instead of EVT.
Accordingly, change RegDefIter to contain MVTs instead of EVTs.
include/llvm/Target/TargetLowering.h | 5 ++---
lib/CodeGen/MachineLICM.cpp | 2 +-
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp | 16 ++++++++--------
lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp | 2 +-
lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h | 4 ++--
5 files changed, 14 insertions(+), 15 deletions(-)
commit 267ded9a2357edbee4947b91e4abc54ef6d185e6
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 11:11:43 2012 +0100
Change TargetLowering::setTypeAction to take an MVT, instead fo EVT.
include/llvm/Target/TargetLowering.h | 4 ++--
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
commit 968d4fc892e13c7a4b37f3e083a91fbf457be746
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 16:06:57 2012 +0100
Change TargetLowering::getLoadExtAction to take and MVT, instead of
EVT.
include/llvm/Target/TargetLowering.h | 10 +++++-----
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 2 +-
lib/Transforms/Scalar/CodeGenPrepare.cpp | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
commit 1a8efcc09d412fd08766044489216391cfdd3afb
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 16:15:55 2012 +0100
Change TargetLowering::getTruncStoreAction to take MVTs, instead of
EVTs.
include/llvm/Target/TargetLowering.h | 11 +++++------
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 3 ++-
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
commit 6e468d9ec25353935c96c78a717e48cb6ace6206
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 16:28:34 2012 +0100
Change TargetLowering::getCondCodeAction to take an MVT, instead of
EVT.
include/llvm/Target/TargetLowering.h | 12 ++++++------
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 4 ++--
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
commit 0a642d363069fb95a4bdaec598a1d7ba9c3d9f16
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 16:33:04 2012 +0100
Change TargetLowering::isCondCodeLegal to take an MVT, instead of EVT.
include/llvm/Target/TargetLowering.h | 6 +++---
lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 9 ++++++---
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 18 +++++++++---------
3 files changed, 18 insertions(+), 15 deletions(-)
commit 8c6d6ee1bb0c0898dec2c6c5cdeb4c200fb80d1c
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 16:42:53 2012 +0100
Change TargetLowering::getTypeToPromoteTo to take and return MVTs,
instead of EVTs.
include/llvm/Target/TargetLowering.h | 8 ++++----
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 12 ++++++------
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
commit d3e652d037e3a49598c871912b0ee68acef2d02e
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Wed Dec 5 11:47:50 2012 +0100
Change TargetLowering::findRepresentativeClass to take an MVT, instead
of EVT.
include/llvm/Target/TargetLowering.h | 2 +-
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 4 ++--
lib/Target/ARM/ARMISelLowering.cpp | 4 ++--
lib/Target/ARM/ARMISelLowering.h | 2 +-
lib/Target/X86/X86ISelLowering.cpp | 4 ++--
lib/Target/X86/X86ISelLowering.h | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
commit bd7d8621c38ddca079b8820dd532fd5b616f25da
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Tue Dec 4 11:02:16 2012 +0100
Change TargetLowering::getRepRegClassCostFor, getIndexedLoadAction,
getIndexedStoreAction, and addRegisterClass to take and MVT, instead
of EVT.
include/llvm/Target/TargetLowering.h | 33 +++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)
commit 1c1a80ce4db07988a839af7aa7a58acd6164364f
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Wed Dec 5 12:55:45 2012 +0100
Change TargetLowering::TransformToType to contain MVTs, instead of
EVTs.
include/llvm/Target/TargetLowering.h | 18 +++++++++---------
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 8 ++++----
2 files changed, 13 insertions(+), 13 deletions(-)
commit c53e2efbd52ac2a4690fe69c8ea4acad113956e0
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Wed Dec 5 13:03:33 2012 +0100
Change TargetLowering::RegisterTypeForVT to store MVTs, instead of
EVTs.
include/llvm/Target/TargetLowering.h | 8 ++++----
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 2 +-
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 4 ++--
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 2 +-
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 20 ++++++++++----------
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 8 ++++----
lib/Target/X86/X86FastISel.cpp | 4 ++--
7 files changed, 24 insertions(+), 24 deletions(-)
commit 9f0cb7ed22f2791a7f315d44827a64de2503e145
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Wed Dec 5 14:04:17 2012 +0100
Change a parameter of TargetLowering::getVectorTypeBreakdown to MVT,
from EVT.
include/llvm/Target/TargetLowering.h | 10 ++++++----
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 14 +++++++++-----
lib/CodeGen/SelectionDAG/TargetLowering.cpp | 19 ++++++++++---------
3 files changed, 25 insertions(+), 18 deletions(-)
commit b2e1d4b185bdaf4ddd6b40d00a48b964cd06cf94
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Wed Dec 5 14:28:34 2012 +0100
Change TargetLowering::getTypeForExtArgOrReturn to take and return
MVTs, instead of EVTs.
Accordingly, add bitsLT (and similar) to MVT.
include/llvm/CodeGen/ValueTypes.h | 21 +++++++++++++++++++++
include/llvm/Target/TargetLowering.h | 4 ++--
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 3 ++-
lib/Target/X86/X86ISelLowering.cpp | 6 +++---
lib/Target/X86/X86ISelLowering.h | 4 ++--
5 files changed, 30 insertions(+), 8 deletions(-)
commit c2b741acf39b269946a85d7676045fe59e29b290
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Thu Dec 6 10:25:43 2012 +0100
Change RegVT in BitTestBlock and RegsForValue, in SelectionDAGBuilder,
to contain MVTs, instead of EVTs.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 21 ++++++++++-----------
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | 4 ++--
2 files changed, 12 insertions(+), 13 deletions(-)
commit 2f58c92a7734f827bf57d8e920afd55a9e56f1d7
Author: Patrik Hägglund <patrik.h.hagglund at ericsson.com>
Date: Thu Dec 6 10:30:11 2012 +0100
In SelectionDAGBuilder, split the usage of 'EVT PartVT' into 'MVT
PartVT' and 'EVT PartEVT'.
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 75 ++++++++++++------------
1 file changed, 38 insertions(+), 37 deletions(-)
From: Chris Lattner [mailto:clattner at apple.com]
Sent: den 4 december 2012 00:46
To: Patrik Hägglund H
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] [RFC] Replacing EVT:s with MVT:s (when possible)
On Dec 3, 2012, at 1:14 PM, Patrik Hägglund H <patrik.h.hagglund at ericsson.com<mailto:patrik.h.hagglund at ericsson.com>> wrote:
There seems to be quite a few places where the EVT type is used, but the code asserts if the variable/parameter is assigned something else than an MVT. Are there any general objections to replace EVT with MVT in these cases?
For example, a quick look at TargetLowering.h give me this list of (member) functions, taking an EVT parameter, that asserts if the argument is not an MVT:
getRegClassFor, getRepRegClassFor, getRepRegClassCostFor, setTypeAction, getLoadExtAction, isLoadExtLegal, getTruncStoreAction, isTruncStoreLegal, getIndexedLoadAction, getIndexedStoreAction, getCondCodeAction, getTypeToPromoteTo, addRegisterClass
Please do. MVT is cheaper than EVT and conceptually cleaner when dealing with physical machine types. EVT should only be used in parts of the code generator that are "pre-legalization" because they can represent arbitrary IR types. Anything that takes a legal machine type should take an MVT.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Change-TargetLowering-getRegClassFor-to-take-an-MVT-.patch
Type: application/octet-stream
Size: 29032 bytes
Desc: 0001-Change-TargetLowering-getRegClassFor-to-take-an-MVT-.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Change-TargetLowering-getRepRegClassFor-to-take-an-M.patch
Type: application/octet-stream
Size: 6984 bytes
Desc: 0002-Change-TargetLowering-getRepRegClassFor-to-take-an-M.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Change-TargetLowering-setTypeAction-to-take-an-MVT-i.patch
Type: application/octet-stream
Size: 1609 bytes
Desc: 0003-Change-TargetLowering-setTypeAction-to-take-an-MVT-i.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Change-TargetLowering-getLoadExtAction-to-take-and-M.patch
Type: application/octet-stream
Size: 3091 bytes
Desc: 0004-Change-TargetLowering-getLoadExtAction-to-take-and-M.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Change-TargetLowering-getTruncStoreAction-to-take-MV.patch
Type: application/octet-stream
Size: 3783 bytes
Desc: 0005-Change-TargetLowering-getTruncStoreAction-to-take-MV.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Change-TargetLowering-getCondCodeAction-to-take-an-M.patch
Type: application/octet-stream
Size: 4649 bytes
Desc: 0006-Change-TargetLowering-getCondCodeAction-to-take-an-M.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Change-TargetLowering-isCondCodeLegal-to-take-an-MVT.patch
Type: application/octet-stream
Size: 5750 bytes
Desc: 0007-Change-TargetLowering-isCondCodeLegal-to-take-an-MVT.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Change-TargetLowering-getTypeToPromoteTo-to-take-and.patch
Type: application/octet-stream
Size: 4999 bytes
Desc: 0008-Change-TargetLowering-getTypeToPromoteTo-to-take-and.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0007.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Change-TargetLowering-getTypeToPromoteTo-to-take-and.patch
Type: application/octet-stream
Size: 4999 bytes
Desc: 0008-Change-TargetLowering-getTypeToPromoteTo-to-take-and.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-Change-TargetLowering-findRepresentativeClass-to-tak.patch
Type: application/octet-stream
Size: 4851 bytes
Desc: 0009-Change-TargetLowering-findRepresentativeClass-to-tak.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0009.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0010-Change-TargetLowering-getRepRegClassCostFor-getIndex.patch
Type: application/octet-stream
Size: 4253 bytes
Desc: 0010-Change-TargetLowering-getRepRegClassCostFor-getIndex.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0011-Change-TargetLowering-TransformToType-to-contain-MVT.patch
Type: application/octet-stream
Size: 4452 bytes
Desc: 0011-Change-TargetLowering-TransformToType-to-contain-MVT.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0011.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0012-Change-TargetLowering-RegisterTypeForVT-to-store-MVT.patch
Type: application/octet-stream
Size: 12750 bytes
Desc: 0012-Change-TargetLowering-RegisterTypeForVT-to-store-MVT.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0012.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0013-Change-a-parameter-of-TargetLowering-getVectorTypeBr.patch
Type: application/octet-stream
Size: 7423 bytes
Desc: 0013-Change-a-parameter-of-TargetLowering-getVectorTypeBr.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0013.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0014-Change-TargetLowering-getTypeForExtArgOrReturn-to-ta.patch
Type: application/octet-stream
Size: 4744 bytes
Desc: 0014-Change-TargetLowering-getTypeForExtArgOrReturn-to-ta.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0014.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0015-Change-RegVT-in-BitTestBlock-and-RegsForValue-in-Sel.patch
Type: application/octet-stream
Size: 6048 bytes
Desc: 0015-Change-RegVT-in-BitTestBlock-and-RegsForValue-in-Sel.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0015.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0016-In-SelectionDAGBuilder-split-the-usage-of-EVT-PartVT.patch
Type: application/octet-stream
Size: 12562 bytes
Desc: 0016-In-SelectionDAGBuilder-split-the-usage-of-EVT-PartVT.patch
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121206/cdbccc79/attachment-0016.obj>
More information about the llvm-dev
mailing list