From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32726 invoked by alias); 9 Jul 2004 08:44:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 32713 invoked from network); 9 Jul 2004 08:44:11 -0000 Received: from unknown (HELO mail.polimi.it) (131.175.12.67) by sourceware.org with SMTP; 9 Jul 2004 08:44:11 -0000 Received: from polimi.it (paride.rett.polimi.it [131.175.65.135]) (authenticated bits=0) by mail.polimi.it (Switch-3.0.5/Switch-3.0.0) with ESMTP id i698i2pT016714; Fri, 9 Jul 2004 10:44:03 +0200 (MEST) Message-ID: <40EE5BA6.8080209@polimi.it> Date: Fri, 09 Jul 2004 09:38:00 -0000 From: Paolo Bonzini User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207) MIME-Version: 1.0 To: Paolo Bonzini CC: Richard Henderson , Paolo Bonzini , gcc-patches@gcc.gnu.org Subject: gimplify mn10300 va_arg References: <20040708195110.GC20150@redhat.com> <40EE4596.1090008@polimi.it> In-Reply-To: <40EE4596.1090008@polimi.it> Content-Type: multipart/mixed; boundary="------------090005000805080200090206" X-PMX-Version: 4.6.0.99824, Antispam-Core: 4.6.1.104326, Antispam-Data: 2004.7.8.106480 X-PerlMx-Spam: Gauge=%%XPROB%%IIIIIII, Probability=7%, Report='__MOZILLA_MSGID 0, __HAS_MSGID 0, __SANE_MSGID 0, __USER_AGENT 0, X_ACCEPT_LANG 0, __MIME_VERSION 0, __TO_MALFORMED_2 0, __REFERENCES 0, __IN_REP_TO 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __BAT_BOUNDARY 0, __UNUSABLE_MSGID 0, __MIME_TEXT_ONLY 0, REFERENCES 0.000, IN_REP_TO 0, USER_AGENT 0.000' X-SW-Source: 2004-07/txt/msg00907.txt.bz2 This is a multi-part message in MIME format. --------------090005000805080200090206 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 194 Here is the first bit. Tested on a mn10300-elf cross the same as rth did; the code looks better except that it uses memmove instead of memcpy to move the big struct. Ok for mainline? Paolo --------------090005000805080200090206 Content-Type: text/plain; name="gimplify-va-arg-mn10300.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gimplify-va-arg-mn10300.patch" Content-length: 2881 Index: mn10300.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/mn10300/mn10300.c,v retrieving revision 1.69 diff -u -r1.69 mn10300.c --- mn10300.c 4 Jul 2004 08:07:09 -0000 1.69 +++ mn10300.c 9 Jul 2004 08:42:29 -0000 @@ -43,6 +43,7 @@ #include "tm_p.h" #include "target.h" #include "target-def.h" +#include "tree-gimple.h" /* This is used by GOTaddr2picreg to uniquely identify UNSPEC_INT_LABELs. */ @@ -71,6 +72,7 @@ static void mn10300_file_start (void); static bool mn10300_return_in_memory (tree, tree); static rtx mn10300_builtin_saveregs (void); +static tree mn10300_gimplify_va_arg_expr (tree, tree, tree *, tree *); /* Initialize the GCC target structure. */ @@ -99,6 +101,9 @@ #undef TARGET_EXPAND_BUILTIN_SAVEREGS #define TARGET_EXPAND_BUILTIN_SAVEREGS mn10300_builtin_saveregs +#undef TARGET_GIMPLIFY_VA_ARG_EXPR +#define TARGET_GIMPLIFY_VA_ARG_EXPR mn10300_gimplify_va_arg_expr + static void mn10300_encode_section_info (tree, rtx, int); struct gcc_target targetm = TARGET_INITIALIZER; @@ -1457,40 +1462,34 @@ std_expand_builtin_va_start (valist, nextarg); } -rtx -mn10300_va_arg (tree valist, tree type) +static tree +mn10300_gimplify_va_arg_expr (tree valist, tree type, + tree *pre_p ATTRIBUTE_UNUSED, + tree *post_p ATTRIBUTE_UNUSED) { - HOST_WIDE_INT align, rsize; + HOST_WIDE_INT align, rsize, adjust; tree t, ptr, pptr; /* Compute the rounded size of the type. */ align = PARM_BOUNDARY / BITS_PER_UNIT; rsize = (((int_size_in_bytes (type) + align - 1) / align) * align); + adjust = rsize > 8 ? 4 : rsize; - t = build (POSTINCREMENT_EXPR, TREE_TYPE (valist), valist, - build_int_2 ((rsize > 8 ? 4 : rsize), 0)); - TREE_SIDE_EFFECTS (t) = 1; - + t = build2 (POSTINCREMENT_EXPR, TREE_TYPE (valist), + valist, build_int_2 (adjust, 0)); ptr = build_pointer_type (type); /* "Large" types are passed by reference. */ if (rsize > 8) { pptr = build_pointer_type (ptr); - t = build1 (NOP_EXPR, pptr, t); - TREE_SIDE_EFFECTS (t) = 1; - - t = build1 (INDIRECT_REF, ptr, t); - TREE_SIDE_EFFECTS (t) = 1; + t = fold_convert (pptr, t); + t = build_fold_indirect_ref (t); } else - { - t = build1 (NOP_EXPR, ptr, t); - TREE_SIDE_EFFECTS (t) = 1; - } + t = fold_convert (ptr, t); - /* Calculate! */ - return expand_expr (t, NULL_RTX, Pmode, EXPAND_NORMAL); + return build_fold_indirect_ref (t); } /* Return an RTX to represent where a value with mode MODE will be returned @@ -1843,9 +1842,6 @@ || XINT (x, 1) == UNSPEC_PLT)) return 1; - if (GET_CODE (x) == QUEUED) - return legitimate_pic_operand_p (QUEUED_VAR (x)); - fmt = GET_RTX_FORMAT (GET_CODE (x)); for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) { --------------090005000805080200090206--