[llvm-commits] [llvm] r40955 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Scott Michel scottm at aero.org
Wed Aug 8 16:23:31 PDT 2007


Author: pingbak
Date: Wed Aug  8 18:23:31 2007
New Revision: 40955

URL: http://llvm.org/viewvc/llvm-project?rev=40955&view=rev
Log:
If a target really needs to custom lower constants, it should be allowed
to do so.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=40955&r1=40954&r2=40955&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Aug  8 18:23:31 2007
@@ -965,13 +965,21 @@
     }
     break;
 
-  case ISD::Constant:
+  case ISD::Constant: {
+    ConstantSDNode *CN = cast<ConstantSDNode>(Node);
+    unsigned opAction =
+      TLI.getOperationAction(ISD::Constant, CN->getValueType(0));
+
     // We know we don't need to expand constants here, constants only have one
     // value and we check that it is fine above.
 
-    // FIXME: Maybe we should handle things like targets that don't support full
-    // 32-bit immediates?
+    if (opAction == TargetLowering::Custom) {
+      Tmp1 = TLI.LowerOperation(Result, DAG);
+      if (Tmp1.Val)
+        Result = Tmp1;
+    }
     break;
+  }
   case ISD::ConstantFP: {
     // Spill FP immediates to the constant pool if the target cannot directly
     // codegen them.  Targets often have some immediate values that can be





More information about the llvm-commits mailing list