OSDN Git Service

2009-04-08 Thomas Quinot <quinot@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / tree-nested.c
index 8f4ab04..8f9fec5 100644 (file)
@@ -363,8 +363,7 @@ init_tmp_var_with_call (struct nesting_info *info, gimple_stmt_iterator *gsi,
 {
   tree t;
 
-  t = create_tmp_var_for (info, TREE_TYPE (TREE_TYPE (gimple_call_fn (call))),
-                          NULL);
+  t = create_tmp_var_for (info, gimple_call_return_type (call), NULL);
   gimple_call_set_lhs (call, t);
   if (! gsi_end_p (*gsi))
     gimple_set_location (call, gimple_location (gsi_stmt (*gsi)));
@@ -1851,8 +1850,8 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
   switch (gimple_code (stmt))
     {
     case GIMPLE_CALL:
-      decl = gimple_call_fn (stmt);
-      if (TREE_CODE (decl) != FUNCTION_DECL)
+      decl = gimple_call_fndecl (stmt);
+      if (!decl)
        break;
       target_context = decl_function_context (decl);
       if (target_context && !DECL_NO_STATIC_CHAIN (decl))
@@ -1996,6 +1995,15 @@ finalize_nesting_tree_1 (struct nesting_info *root)
                      root->frame_decl, field, NULL_TREE);
          stmt = gimple_build_assign (y, x);
          gimple_seq_add_stmt (&stmt_list, stmt);
+         /* If the assignment is from a non-register the stmt is
+            not valid gimple.  Make it so by using a temporary instead.  */
+         if (!is_gimple_reg (x)
+             && is_gimple_reg_type (TREE_TYPE (x)))
+           {
+             gimple_stmt_iterator gsi = gsi_last (stmt_list);
+             x = init_tmp_var (root, x, &gsi);
+             gimple_assign_set_rhs1 (stmt, x);
+           }
        }
     }