diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-10-23 23:57:32 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-10-23 23:57:32 +0000 |
commit | a81eaeed82d82e06d8d7b2a8f11fd0a27b1d049d (patch) | |
tree | eb9cab3db8708b452891ba35b8f370be8c515ba6 /gcc/go | |
parent | c2240038a67c0e5887c0d9aef55a8b3497751b71 (diff) | |
download | gcc-a81eaeed82d82e06d8d7b2a8f11fd0a27b1d049d.zip gcc-a81eaeed82d82e06d8d7b2a8f11fd0a27b1d049d.tar.gz gcc-a81eaeed82d82e06d8d7b2a8f11fd0a27b1d049d.tar.bz2 |
compiler: use builtin runtime calls for integer to string and string to array conversions.
From-SVN: r203996
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index f46c37f..8d23e1d 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -3351,14 +3351,10 @@ Type_conversion_expression::do_get_tree(Translate_context* context) 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_conversion_expression::do_get_tree(Translate_context* context) { 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) |