This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Use backend interface for some runtime calls


This patch from Chris Manghane changes the Go frontend to use the
backend interface for a couple of runtime calls.  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

diff -r 46c1804a8e17 go/expressions.cc
--- a/go/expressions.cc	Fri Oct 18 06:25:23 2013 -0700
+++ b/go/expressions.cc	Wed Oct 23 16:46:57 2013 -0700
@@ -3351,14 +3351,10 @@
 	  return se->get_tree(context);
 	}
 
-      static tree int_to_string_fndecl;
-      ret = Gogo::call_builtin(&int_to_string_fndecl,
-			       this->location(),
-			       "__go_int_to_string",
-			       1,
-			       type_tree,
-			       int_type_tree,
-			       expr_tree);
+      Call_expression* i2s_expr =
+          Runtime::make_call(Runtime::INT_TO_STRING, this->location(), 1,
+                             this->expr_);
+      ret = i2s_expr->get_tree(context);
     }
   else if (type->is_string_type() && expr_type->is_slice_type())
     {
@@ -3408,29 +3404,18 @@
     {
       Type* e = type->array_type()->element_type()->forwarded();
       go_assert(e->integer_type() != NULL);
+
+      Call_expression* s2a_expr;
       if (e->integer_type()->is_byte())
-	{
-	  tree string_to_byte_array_fndecl = NULL_TREE;
-	  ret = Gogo::call_builtin(&string_to_byte_array_fndecl,
-				   this->location(),
-				   "__go_string_to_byte_array",
-				   1,
-				   type_tree,
-				   TREE_TYPE(expr_tree),
-				   expr_tree);
-	}
+        s2a_expr = Runtime::make_call(Runtime::STRING_TO_BYTE_ARRAY,
+                                      this->location(), 1, this->expr_);
       else
 	{
 	  go_assert(e->integer_type()->is_rune());
-	  tree string_to_int_array_fndecl = NULL_TREE;
-	  ret = Gogo::call_builtin(&string_to_int_array_fndecl,
-				   this->location(),
-				   "__go_string_to_int_array",
-				   1,
-				   type_tree,
-				   TREE_TYPE(expr_tree),
-				   expr_tree);
-	}
+          s2a_expr = Runtime::make_call(Runtime::STRING_TO_INT_ARRAY,
+                                        this->location(), 1, this->expr_);
+	}
+      ret = s2a_expr->get_tree(context);
     }
   else if ((type->is_unsafe_pointer_type()
 	    && expr_type->points_to() != NULL)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]