[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Jim Laskey jlaskey at apple.com
Thu Feb 22 07:37:37 PST 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.477 -> 1.478
---
Log message:

Simplify lowering and selection of exception ops.

---
Diffs of the changes:  (+26 -2)

 LegalizeDAG.cpp |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.477 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.478
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.477	Wed Feb 21 16:53:45 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Thu Feb 22 09:37:19 2007
@@ -668,8 +668,6 @@
     break;
   case ISD::FRAMEADDR:
   case ISD::RETURNADDR:
-  case ISD::EXCEPTIONADDR:
-  case ISD::EHSELECTION:
     // The only option for these nodes is to custom lower them.  If the target
     // does not custom lower them, then return zero.
     Tmp1 = TLI.LowerOperation(Op, DAG);
@@ -678,6 +676,32 @@
     else
       Result = DAG.getConstant(0, TLI.getPointerTy());
     break;
+  case ISD::EHSELECTION:
+    LegalizeOp(Node->getOperand(1));
+    // Fall Thru
+  case ISD::EXCEPTIONADDR: {
+    Tmp1 = LegalizeOp(Node->getOperand(0));
+    MVT::ValueType VT = Node->getValueType(0);
+    switch (TLI.getOperationAction(Node->getOpcode(), VT)) {
+    default: assert(0 && "This action is not supported yet!");
+    case TargetLowering::Expand: {
+        unsigned Reg = Node->getOpcode() == ISD::EXCEPTIONADDR ?
+                          TLI.getExceptionAddressRegister() :
+                          TLI.getExceptionSelectorRegister();
+        Result = DAG.getCopyFromReg(Tmp1, Reg, VT).getValue(Op.ResNo);
+      }
+      break;
+    case TargetLowering::Custom:
+      Result = TLI.LowerOperation(Op, DAG);
+      if (Result.Val) break;
+      // Fall Thru
+    case TargetLowering::Legal:
+      Result = DAG.getNode(ISD::MERGE_VALUES, VT, DAG.getConstant(0, VT), Tmp1).
+                  getValue(Op.ResNo);
+      break;
+    }
+    }
+    break;
   case ISD::AssertSext:
   case ISD::AssertZext:
     Tmp1 = LegalizeOp(Node->getOperand(0));






More information about the llvm-commits mailing list