[llvm-commits] [llvm] r43169 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
Chris Lattner
sabre at nondot.org
Thu Oct 18 21:14:36 PDT 2007
Author: lattner
Date: Thu Oct 18 23:14:36 2007
New Revision: 43169
URL: http://llvm.org/viewvc/llvm-project?rev=43169&view=rev
Log:
implement support for custom expansion of any node type, in one place.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp?rev=43169&r1=43168&r2=43169&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAGTypes.cpp Thu Oct 18 23:14:36 2007
@@ -603,6 +603,22 @@
DEBUG(cerr << "Expand node result: "; N->dump(&DAG); cerr << "\n");
SDOperand Lo, Hi;
Lo = Hi = SDOperand();
+
+ // If this is a single-result node, see if the target wants to custom expand
+ // it.
+ if (N->getNumValues() == 1 &&
+ TLI.getOperationAction(N->getOpcode(),
+ N->getValueType(0)) == TargetLowering::Custom) {
+ // If the target wants to, allow it to lower this itself.
+ std::pair<SDOperand,SDOperand> P =
+ TLI.ExpandOperation(SDOperand(N, 0), DAG);
+ if (P.first.Val) {
+ Lo = P.first;
+ Hi = P.second;
+ return;
+ }
+ }
+
switch (N->getOpcode()) {
default:
#ifndef NDEBUG
@@ -694,20 +710,8 @@
void DAGTypeLegalizer::ExpandResult_BIT_CONVERT(SDNode *N,
SDOperand &Lo, SDOperand &Hi) {
- MVT::ValueType VT = N->getValueType(0);
- if (TLI.getOperationAction(ISD::BIT_CONVERT, VT) == TargetLowering::Custom){
- // If the target wants to, allow it to lower this itself.
- std::pair<SDOperand,SDOperand> P =
- TLI.ExpandOperation(SDOperand(N, 0), DAG);
- if (P.first.Val) {
- Lo = P.first;
- Hi = P.second;
- return;
- }
- }
-
// Lower the bit-convert to a store/load from the stack, then expand the load.
- SDOperand Op = CreateStackStoreLoad(N->getOperand(0), VT);
+ SDOperand Op = CreateStackStoreLoad(N->getOperand(0), N->getValueType(0));
ExpandResult_LOAD(cast<LoadSDNode>(Op.Val), Lo, Hi);
}
@@ -875,17 +879,6 @@
MVT::ValueType VT = N->getValueType(0);
MVT::ValueType NVT = TLI.getTypeToTransformTo(VT);
- // If the target wants to custom expand this, let them.
- if (TLI.getOperationAction(ISD::MUL, VT) == TargetLowering::Custom) {
- std::pair<SDOperand,SDOperand> Ret =
- TLI.ExpandOperation(SDOperand(N, 0), DAG);
- if (Ret.first.Val) {
- Lo = Ret.first;
- Hi = Ret.second;
- return;
- }
- }
-
bool HasMULHS = TLI.isOperationLegal(ISD::MULHS, NVT);
bool HasMULHU = TLI.isOperationLegal(ISD::MULHU, NVT);
bool HasSMUL_LOHI = TLI.isOperationLegal(ISD::SMUL_LOHI, NVT);
@@ -958,17 +951,6 @@
SDOperand &Lo, SDOperand &Hi) {
MVT::ValueType VT = N->getValueType(0);
- // If the target wants custom lowering, do so.
- if (TLI.getOperationAction(N->getOpcode(), VT) == TargetLowering::Custom) {
- std::pair<SDOperand,SDOperand> Ret =
- TLI.ExpandOperation(SDOperand(N, 0), DAG);
- if (Ret.first.Val) {
- Lo = Ret.first;
- Hi = Ret.second;
- return;
- }
- }
-
// If we can emit an efficient shift operation, do so now. Check to see if
// the RHS is a constant.
if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N->getOperand(1)))
More information about the llvm-commits
mailing list