[llvm-commits] [llvm] r62680 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.cpp lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.h
Duncan Sands
baldrick at free.fr
Wed Jan 21 01:00:30 PST 2009
Author: baldrick
Date: Wed Jan 21 03:00:29 2009
New Revision: 62680
URL: http://llvm.org/viewvc/llvm-project?rev=62680&view=rev
Log:
Cleanup whitespace and comments, and tweak some
prototypes, in operand type legalization. No
functionality change.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Wed Jan 21 03:00:29 2009
@@ -1131,23 +1131,22 @@
return SDValue();
}
- /// LowerOperationWrapper - This callback is invoked by the type legalizer
- /// to legalize operation with illegal operand types but legal result types;
+ /// LowerOperationWrapper - This callback is invoked by the type legalizer
+ /// to legalize nodes with an illegal operand type but legal result types.
/// It replaces the LowerOperation callback in the type Legalizer.
- /// The reason we can not do away with LowerOperation entirely is that
+ /// The reason we can not do away with LowerOperation entirely is that
/// LegalizeDAG isn't yet ready to use this callback.
-
- /// The target places new result values for the node in Results (their number
- /// and types must exactly match those of the original return values of
- /// the node), or leaves Results empty, which indicates that the node is not
- /// to be custom lowered after all.
- /// In its default implementation it calls the LowerOperation.
+ /// TODO: Consider merging with ReplaceNodeResults.
- virtual void LowerOperationWrapper(SDValue Op,
+ /// The target places new result values for the node in Results (their number
+ /// and types must exactly match those of the original return values of
+ /// the node), or leaves Results empty, which indicates that the node is not
+ /// to be custom lowered after all.
+ /// The default implementation calls LowerOperation.
+ virtual void LowerOperationWrapper(SDNode *N,
SmallVectorImpl<SDValue> &Results,
SelectionDAG &DAG);
-
/// LowerOperation - This callback is invoked for operations that are
/// unsupported by the target, which are registered to use 'custom' lowering,
/// and whose defined values are all legal.
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Jan 21 03:00:29 2009
@@ -722,7 +722,7 @@
Lo = Hi = SDValue();
// See if the target wants to custom expand this node.
- if (CustomLowerResults(N, ResNo, true))
+ if (CustomLowerResults(N, N->getValueType(ResNo), true))
return;
switch (N->getOpcode()) {
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Wed Jan 21 03:00:29 2009
@@ -31,10 +31,10 @@
/// expansion, we just know that (at least) one result needs promotion.
void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
DEBUG(cerr << "Promote integer result: "; N->dump(&DAG); cerr << "\n");
- SDValue Result = SDValue();
+ SDValue Res = SDValue();
// See if the target wants to custom expand this node.
- if (CustomLowerResults(N, ResNo, true))
+ if (CustomLowerResults(N, N->getValueType(ResNo), true))
return;
switch (N->getOpcode()) {
@@ -45,58 +45,58 @@
#endif
assert(0 && "Do not know how to promote this operator!");
abort();
- case ISD::AssertSext: Result = PromoteIntRes_AssertSext(N); break;
- case ISD::AssertZext: Result = PromoteIntRes_AssertZext(N); break;
- case ISD::BIT_CONVERT: Result = PromoteIntRes_BIT_CONVERT(N); break;
- case ISD::BSWAP: Result = PromoteIntRes_BSWAP(N); break;
- case ISD::BUILD_PAIR: Result = PromoteIntRes_BUILD_PAIR(N); break;
- case ISD::Constant: Result = PromoteIntRes_Constant(N); break;
+ case ISD::AssertSext: Res = PromoteIntRes_AssertSext(N); break;
+ case ISD::AssertZext: Res = PromoteIntRes_AssertZext(N); break;
+ case ISD::BIT_CONVERT: Res = PromoteIntRes_BIT_CONVERT(N); break;
+ case ISD::BSWAP: Res = PromoteIntRes_BSWAP(N); break;
+ case ISD::BUILD_PAIR: Res = PromoteIntRes_BUILD_PAIR(N); break;
+ case ISD::Constant: Res = PromoteIntRes_Constant(N); break;
case ISD::CONVERT_RNDSAT:
- Result = PromoteIntRes_CONVERT_RNDSAT(N); break;
- case ISD::CTLZ: Result = PromoteIntRes_CTLZ(N); break;
- case ISD::CTPOP: Result = PromoteIntRes_CTPOP(N); break;
- case ISD::CTTZ: Result = PromoteIntRes_CTTZ(N); break;
+ Res = PromoteIntRes_CONVERT_RNDSAT(N); break;
+ case ISD::CTLZ: Res = PromoteIntRes_CTLZ(N); break;
+ case ISD::CTPOP: Res = PromoteIntRes_CTPOP(N); break;
+ case ISD::CTTZ: Res = PromoteIntRes_CTTZ(N); break;
case ISD::EXTRACT_VECTOR_ELT:
- Result = PromoteIntRes_EXTRACT_VECTOR_ELT(N); break;
- case ISD::LOAD: Result = PromoteIntRes_LOAD(cast<LoadSDNode>(N));break;
- case ISD::SELECT: Result = PromoteIntRes_SELECT(N); break;
- case ISD::SELECT_CC: Result = PromoteIntRes_SELECT_CC(N); break;
- case ISD::SETCC: Result = PromoteIntRes_SETCC(N); break;
- case ISD::SHL: Result = PromoteIntRes_SHL(N); break;
+ Res = PromoteIntRes_EXTRACT_VECTOR_ELT(N); break;
+ case ISD::LOAD: Res = PromoteIntRes_LOAD(cast<LoadSDNode>(N));break;
+ case ISD::SELECT: Res = PromoteIntRes_SELECT(N); break;
+ case ISD::SELECT_CC: Res = PromoteIntRes_SELECT_CC(N); break;
+ case ISD::SETCC: Res = PromoteIntRes_SETCC(N); break;
+ case ISD::SHL: Res = PromoteIntRes_SHL(N); break;
case ISD::SIGN_EXTEND_INREG:
- Result = PromoteIntRes_SIGN_EXTEND_INREG(N); break;
- case ISD::SRA: Result = PromoteIntRes_SRA(N); break;
- case ISD::SRL: Result = PromoteIntRes_SRL(N); break;
- case ISD::TRUNCATE: Result = PromoteIntRes_TRUNCATE(N); break;
- case ISD::UNDEF: Result = PromoteIntRes_UNDEF(N); break;
- case ISD::VAARG: Result = PromoteIntRes_VAARG(N); break;
+ Res = PromoteIntRes_SIGN_EXTEND_INREG(N); break;
+ case ISD::SRA: Res = PromoteIntRes_SRA(N); break;
+ case ISD::SRL: Res = PromoteIntRes_SRL(N); break;
+ case ISD::TRUNCATE: Res = PromoteIntRes_TRUNCATE(N); break;
+ case ISD::UNDEF: Res = PromoteIntRes_UNDEF(N); break;
+ case ISD::VAARG: Res = PromoteIntRes_VAARG(N); break;
case ISD::SIGN_EXTEND:
case ISD::ZERO_EXTEND:
- case ISD::ANY_EXTEND: Result = PromoteIntRes_INT_EXTEND(N); break;
+ case ISD::ANY_EXTEND: Res = PromoteIntRes_INT_EXTEND(N); break;
case ISD::FP_TO_SINT:
- case ISD::FP_TO_UINT: Result = PromoteIntRes_FP_TO_XINT(N); break;
+ case ISD::FP_TO_UINT: Res = PromoteIntRes_FP_TO_XINT(N); break;
case ISD::AND:
case ISD::OR:
case ISD::XOR:
case ISD::ADD:
case ISD::SUB:
- case ISD::MUL: Result = PromoteIntRes_SimpleIntBinOp(N); break;
+ case ISD::MUL: Res = PromoteIntRes_SimpleIntBinOp(N); break;
case ISD::SDIV:
- case ISD::SREM: Result = PromoteIntRes_SDIV(N); break;
+ case ISD::SREM: Res = PromoteIntRes_SDIV(N); break;
case ISD::UDIV:
- case ISD::UREM: Result = PromoteIntRes_UDIV(N); break;
+ case ISD::UREM: Res = PromoteIntRes_UDIV(N); break;
case ISD::SADDO:
- case ISD::SSUBO: Result = PromoteIntRes_SADDSUBO(N, ResNo); break;
+ case ISD::SSUBO: Res = PromoteIntRes_SADDSUBO(N, ResNo); break;
case ISD::UADDO:
- case ISD::USUBO: Result = PromoteIntRes_UADDSUBO(N, ResNo); break;
+ case ISD::USUBO: Res = PromoteIntRes_UADDSUBO(N, ResNo); break;
case ISD::SMULO:
- case ISD::UMULO: Result = PromoteIntRes_XMULO(N, ResNo); break;
+ case ISD::UMULO: Res = PromoteIntRes_XMULO(N, ResNo); break;
case ISD::ATOMIC_LOAD_ADD:
case ISD::ATOMIC_LOAD_SUB:
@@ -109,15 +109,15 @@
case ISD::ATOMIC_LOAD_UMIN:
case ISD::ATOMIC_LOAD_UMAX:
case ISD::ATOMIC_SWAP:
- Result = PromoteIntRes_Atomic1(cast<AtomicSDNode>(N)); break;
+ Res = PromoteIntRes_Atomic1(cast<AtomicSDNode>(N)); break;
case ISD::ATOMIC_CMP_SWAP:
- Result = PromoteIntRes_Atomic2(cast<AtomicSDNode>(N)); break;
+ Res = PromoteIntRes_Atomic2(cast<AtomicSDNode>(N)); break;
}
- // If Result is null, the sub-method took care of registering the result.
- if (Result.getNode())
- SetPromotedInteger(SDValue(N, ResNo), Result);
+ // If the result is null then the sub-method took care of registering it.
+ if (Res.getNode())
+ SetPromotedInteger(SDValue(N, ResNo), Res);
}
SDValue DAGTypeLegalizer::PromoteIntRes_AssertSext(SDNode *N) {
@@ -623,7 +623,7 @@
DEBUG(cerr << "Promote integer operand: "; N->dump(&DAG); cerr << "\n");
SDValue Res = SDValue();
- if (CustomLowerResults(N, OpNo, false))
+ if (CustomLowerResults(N, N->getOperand(OpNo).getValueType(), false))
return false;
switch (N->getOpcode()) {
@@ -656,9 +656,9 @@
case ISD::UINT_TO_FP: Res = PromoteIntOp_UINT_TO_FP(N); break;
case ISD::ZERO_EXTEND: Res = PromoteIntOp_ZERO_EXTEND(N); break;
}
-
+
// If the result is null, the sub-method took care of registering results etc.
- if (! Res.getNode()) return false;
+ if (!Res.getNode()) return false;
// If the result is N, the sub-method updated N in place. Tell the legalizer
// core about this.
@@ -918,7 +918,7 @@
Lo = Hi = SDValue();
// See if the target wants to custom expand this node.
- if (CustomLowerResults(N, ResNo, true))
+ if (CustomLowerResults(N, N->getValueType(ResNo), true))
return;
switch (N->getOpcode()) {
@@ -1848,7 +1848,7 @@
DEBUG(cerr << "Expand integer operand: "; N->dump(&DAG); cerr << "\n");
SDValue Res = SDValue();
- if (CustomLowerResults(N, OpNo, false))
+ if (CustomLowerResults(N, N->getOperand(OpNo).getValueType(), false))
return false;
switch (N->getOpcode()) {
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Wed Jan 21 03:00:29 2009
@@ -848,27 +848,23 @@
/// CustomLowerResults - Replace the node's results with custom code provided
/// by the target and return "true", or do nothing and return "false".
-/// The last parameter is FALSE if we are dealing with a node with legal
+/// The last parameter is FALSE if we are dealing with a node with legal
/// result types and illegal operand. The second parameter denotes the illegal
/// OperandNo in that case.
/// The last parameter being TRUE means we are dealing with a
-/// node with illegal result types. The second parameter denotes the illegal
+/// node with illegal result types. The second parameter denotes the illegal
/// ResNo in that case.
-bool DAGTypeLegalizer::CustomLowerResults(SDNode *N, unsigned Num,
+bool DAGTypeLegalizer::CustomLowerResults(SDNode *N, MVT VT,
bool LegalizeResult) {
- // Get the type of illegal Result or Operand.
- MVT ValueTy = (LegalizeResult) ? N->getValueType(Num)
- : N->getOperand(Num).getValueType();
-
// See if the target wants to custom lower this node.
- if (TLI.getOperationAction(N->getOpcode(), ValueTy) != TargetLowering::Custom)
+ if (TLI.getOperationAction(N->getOpcode(), VT) != TargetLowering::Custom)
return false;
SmallVector<SDValue, 8> Results;
if (LegalizeResult)
TLI.ReplaceNodeResults(N, Results, DAG);
else
- TLI.LowerOperationWrapper(SDValue(N, 0), Results, DAG);
+ TLI.LowerOperationWrapper(N, Results, DAG);
if (Results.empty())
// The target didn't want to custom lower it after all.
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Jan 21 03:00:29 2009
@@ -191,7 +191,7 @@
// Common routines.
SDValue BitConvertToInteger(SDValue Op);
SDValue CreateStackStoreLoad(SDValue Op, MVT DestVT);
- bool CustomLowerResults(SDNode *N, unsigned ResNo, bool LegalizeResult);
+ bool CustomLowerResults(SDNode *N, MVT VT, bool LegalizeResult);
SDValue GetVectorElementPointer(SDValue VecPtr, MVT EltVT, SDValue Index);
SDValue JoinIntegers(SDValue Lo, SDValue Hi);
SDValue LibCallify(RTLIB::Libcall LC, SDNode *N, bool isSigned);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Wed Jan 21 03:00:29 2009
@@ -5568,11 +5568,10 @@
return std::make_pair(Res, Chain);
}
-void TargetLowering::LowerOperationWrapper(SDValue Op,
- SmallVectorImpl<SDValue> &Results,
- SelectionDAG &DAG) {
- SDValue Res;
- Res = LowerOperation(Op, DAG);
+void TargetLowering::LowerOperationWrapper(SDNode *N,
+ SmallVectorImpl<SDValue> &Results,
+ SelectionDAG &DAG) {
+ SDValue Res = LowerOperation(SDValue(N, 0), DAG);
if (Res.getNode())
Results.push_back(Res);
}
Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Wed Jan 21 03:00:29 2009
@@ -762,9 +762,11 @@
return Call;
}
-void PIC16TargetLowering::LowerOperationWrapper(SDValue Op,
- SmallVectorImpl<SDValue>&Results,
- SelectionDAG &DAG) {
+void
+PIC16TargetLowering::LowerOperationWrapper(SDNode *N,
+ SmallVectorImpl<SDValue>&Results,
+ SelectionDAG &DAG) {
+ SDValue Op = SDValue(N, 0);
SDValue Res;
unsigned i;
switch (Op.getOpcode()) {
@@ -783,12 +785,12 @@
return;
}
}
- SDNode *N = Res.getNode();
+
+ N = Res.getNode();
unsigned NumValues = N->getNumValues();
- for (i=0; i< NumValues ; i++) {
+ for (i = 0; i < NumValues ; i++) {
Results.push_back(SDValue(N, i));
}
-
}
SDValue PIC16TargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) {
Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h?rev=62680&r1=62679&r2=62680&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.h Wed Jan 21 03:00:29 2009
@@ -97,9 +97,9 @@
virtual void ReplaceNodeResults(SDNode *N,
SmallVectorImpl<SDValue> &Results,
SelectionDAG &DAG);
- virtual void LowerOperationWrapper(SDValue Op,
- SmallVectorImpl<SDValue> &Results,
- SelectionDAG &DAG);
+ virtual void LowerOperationWrapper(SDNode *N,
+ SmallVectorImpl<SDValue> &Results,
+ SelectionDAG &DAG);
SDValue ExpandStore(SDNode *N, SelectionDAG &DAG);
SDValue ExpandLoad(SDNode *N, SelectionDAG &DAG);
More information about the llvm-commits
mailing list