[llvm-commits] [llvm] r52151 - in /llvm/trunk: include/llvm/CodeGen/ValueTypes.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp
Duncan Sands
baldrick at free.fr
Mon Jun 9 08:48:26 PDT 2008
Author: baldrick
Date: Mon Jun 9 10:48:25 2008
New Revision: 52151
URL: http://llvm.org/viewvc/llvm-project?rev=52151&view=rev
Log:
Various tweaks related to apint codegen. No functionality
change for non-funky-sized integers.
Modified:
llvm/trunk/include/llvm/CodeGen/ValueTypes.h
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=52151&r1=52150&r2=52151&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Mon Jun 9 10:48:25 2008
@@ -261,6 +261,10 @@
(isExtended() && isVector() && getSizeInBits()==128));
}
+ /// isByteSized - Return true if the bit size is a multiple of 8.
+ inline bool isByteSized() const {
+ return (getSizeInBits() & 7) == 0;
+ }
/// bitsGT - Return true if this has more bits than VT.
inline bool bitsGT(MVT VT) const {
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=52151&r1=52150&r2=52151&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jun 9 10:48:25 2008
@@ -1785,7 +1785,7 @@
// Loading a non-byte sized integer is only valid if the extra bits
// in memory that complete the byte are zero, which is not known here.
// TODO: remove isSimple check when apint codegen support lands.
- EVT.isSimple() && EVT.getSizeInBits() == EVT.getStoreSizeInBits() &&
+ EVT.isSimple() && EVT.isByteSized() &&
(!AfterLegalize || TLI.isLoadXLegal(ISD::ZEXTLOAD, EVT))) {
MVT PtrType = N0.getOperand(1).getValueType();
// For big endian targets, we need to add an offset to the pointer to
@@ -3181,7 +3181,7 @@
// Do not allow folding to a non-byte-sized integer here. These only
// load correctly if the extra bits in memory that complete the byte
// are zero, which is not known here.
- VT.getSizeInBits() == VT.getStoreSizeInBits()) {
+ VT.isByteSized()) {
assert(N0.getValueType().getSizeInBits() > EVTBits &&
"Cannot truncate to larger type!");
LoadSDNode *LN0 = cast<LoadSDNode>(N0);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp?rev=52151&r1=52150&r2=52151&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp Mon Jun 9 10:48:25 2008
@@ -94,7 +94,7 @@
MVT VT = N->getValueType(0);
// Zero extend things like i1, sign extend everything else. It shouldn't
// matter in theory which one we pick, but this tends to give better code?
- unsigned Opc = VT != MVT::i1 ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
+ unsigned Opc = VT.isByteSized() ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND;
SDOperand Result = DAG.getNode(Opc, TLI.getTypeToTransformTo(VT),
SDOperand(N, 0));
assert(isa<ConstantSDNode>(Result) && "Didn't constant fold ext?");
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=52151&r1=52150&r2=52151&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Mon Jun 9 10:48:25 2008
@@ -250,7 +250,7 @@
NumRegistersForVT[MVT::isVoid] = 0;
// Find the largest integer register class.
- unsigned LargestIntReg = MVT::i128;
+ unsigned LargestIntReg = MVT::LAST_INTEGER_VALUETYPE;
for (; RegClassForVT[LargestIntReg] == 0; --LargestIntReg)
assert(LargestIntReg != MVT::i1 && "No integer registers defined!");
More information about the llvm-commits
mailing list