From patchwork Wed Oct 23 23:57:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 285753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7D6412C009E for ; Thu, 24 Oct 2013 10:57:46 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=iyITFLQwd5cHu3VW1d19QoVCkaJf4ZJ1oMDO/EarDsV2Pvl6O1pCh 1VFQjF6gNIYQuwV1iKdeu9SJg83ndfycBbbYwCoYgSLBGCF77ds2+7olBZRdzbee 0aVX9ndjsDuRZY4t+nGQamgIMHN1awcse8FHwC1Gu9z07ZJCioV0JI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=KPItSrs2/lVllLHN1AZxBZ+JrX0=; b=A/3FtDzh7BesfcDuseub PGytNCDdJ1TtKu5UQRIOdFCbar7mbahhOWHqFSLq9uNKsOTxR5YQTdAOgm/1hlnA piNaAiRSc7ZfvPE3z1aKqFyhnLWOa21LBzA2cCFelTZ5Q4BjfnLlJ4zco7hkNou0 5q2xNhw9adElIqjW6RJlg+E= Received: (qmail 30244 invoked by alias); 23 Oct 2013 23:57:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 30228 invoked by uid 89); 23 Oct 2013 23:57:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS, T_TVD_MIME_NO_HEADERS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f48.google.com Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 23 Oct 2013 23:57:39 +0000 Received: by mail-pa0-f48.google.com with SMTP id bj1so2063978pad.35 for ; Wed, 23 Oct 2013 16:57:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :mime-version:content-type; bh=sXdd22po9O5KpXJkbNI0yIOHmilJyOXZ7h4PMOZRB/w=; b=Sd1zjDeJ270geP84RgQIALuvsTVm6pfll27akqzxo/qVAEcCc7/c3vT2kJLNSFuuRa RrdCuGeacBm5klvkOfaqgB78vj3wRjskf7AZiBDY3pumuIWQSvuzr1EmGCCi20TbaQOO 32voHxXKcVr1DaLHz82OtHdU+7gklwWUBinLxYJL+ySDf2tkkxqCqYVXoGXZOc31xZQc JA9LzFbyUMwEdTbktozit7I5mDirmzpczkg6gKAjEf6vjBiU/XRKoDTo9vfYZY4BLFVt 1btJlkr4O7IpQmoHxBLO33ovg0MSBZnfI8k5SLzCdYmQPxVKf7LcF1OuHhoeO23hRxek y7XA== X-Gm-Message-State: ALoCoQnlZJmvV77A8VhBjmIO+Pr0OZ0cXlyXbcwdl7+rGH148dvHSw5gdNJpKwit9HUYuLQbbalUmItW8GvdKJuMY8qFaJWJzM1YBWReQz62YpRaDYhecGfQhu4Z1ayqE3WIMI4HXtxjei2hDq8CWF3XSZqbjOtyWTxxhb2h7IqqyniBH2Vr1YvAwsi21hilG0pNtVKhzTuNgbUaEypznGjtL1iY1/ofDA== X-Received: by 10.68.185.68 with SMTP id fa4mr4286271pbc.136.1382572657637; Wed, 23 Oct 2013 16:57:37 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([207.198.105.20]) by mx.google.com with ESMTPSA id yg3sm559460pab.16.2013.10.23.16.57.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 23 Oct 2013 16:57:37 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Use backend interface for some runtime calls Date: Wed, 23 Oct 2013 16:57:34 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes 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)