[llvm-commits] [llvm-gcc-4.2] r40576 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h

Anton Korobeynikov asl at math.spbu.ru
Sat Jul 28 13:17:34 PDT 2007


Author: asl
Date: Sat Jul 28 15:17:33 2007
New Revision: 40576

URL: http://llvm.org/viewvc/llvm-project?rev=40576&view=rev
Log:
Add dummy placeholders for some EH GIMPLE trees

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-internal.h

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=40576&r1=40575&r2=40576&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat Jul 28 15:17:33 2007
@@ -800,10 +800,21 @@
   
   switch (TREE_CODE(exp)) {
   default:
-    std::cerr << "Unhandled expression!\n";
+    std::cerr << "Unhandled expression!\n"
+              << "TREE_CODE: " << TREE_CODE(exp) << "\n";
     debug_tree(exp);
     abort();
-    
+
+  // FIXME: EH handling trees. Blank right now
+  case FILTER_EXPR:
+  case RESX_EXPR:
+    {
+      const Type *Ty = ConvertType(TREE_TYPE(exp));
+      if (Ty != Type::VoidTy)
+        Result = Constant::getNullValue(Ty);
+    }
+    break;
+        
   // Basic lists and binding scopes
   case BIND_EXPR:      Result = EmitBIND_EXPR(exp, DestLoc); break;
   case STATEMENT_LIST: Result = EmitSTATEMENT_LIST(exp, DestLoc); break;
@@ -1002,6 +1013,10 @@
   case INDIRECT_REF:
     // The lvalue is just the address.
     return Emit(TREE_OPERAND(exp, 0), 0);
+
+  // EH stuff
+  case EXC_PTR_EXPR: return EmitLV_EXC_PTR_EXPR(exp);
+  case FILTER_EXPR: return EmitLV_FILTER_EXPR(exp);
   }
 }
 
@@ -5406,6 +5421,44 @@
   return LV;
 }
 
+/// EmitLV_EXC_PTR_EXPR - Handle EXC_PTR_EXPR as lvalue.
+///
+LValue TreeToLLVM::EmitLV_EXC_PTR_EXPR(tree exp) {
+  const Type *Ty = ConvertType(TREE_TYPE(exp));
+
+#ifdef ITANIUM_STYLE_EXCEPTIONS
+  // Create exception values.
+  CreateExceptionValues();
+  LValue LV = ExceptionValue;
+#else
+  Value* Tmp = CreateTemporary(PointerType::get(Ty));
+  Tmp->setName("dummy");
+  LValue LV = Tmp;
+#endif
+
+  LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(Ty));
+  return LV;  
+}
+
+/// EmitLV_FILTER_EXPR - Handle FILTER_EXPR as lvalue.
+///
+LValue TreeToLLVM::EmitLV_FILTER_EXPR(tree exp) {
+  const Type *Ty = ConvertType(TREE_TYPE(exp));
+
+#ifdef ITANIUM_STYLE_EXCEPTIONS
+  // Create exception values.
+  CreateExceptionValues();
+  LValue LV = ExceptionSelectorValue;
+#else
+  Value* Tmp = CreateTemporary(PointerType::get(Ty));
+  Tmp->setName("dummy");
+  LValue LV = Tmp;
+#endif
+
+  LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(Ty));
+  return LV;  
+}
+
 //===----------------------------------------------------------------------===//
 //                       ... Constant Expressions ...
 //===----------------------------------------------------------------------===//

Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=40576&r1=40575&r2=40576&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Sat Jul 28 15:17:33 2007
@@ -620,6 +620,8 @@
   LValue EmitLV_BIT_FIELD_REF(tree_node *exp);
   LValue EmitLV_XXXXPART_EXPR(tree_node *exp, unsigned Idx);
   LValue EmitLV_VIEW_CONVERT_EXPR(tree_node *exp);
+  LValue EmitLV_EXC_PTR_EXPR(tree_node *exp);
+  LValue EmitLV_FILTER_EXPR(tree_node *exp);
 
   // Constant Expressions.
   Value *EmitINTEGER_CST(tree_node *exp);





More information about the llvm-commits mailing list