From: Richard Biener <richard.guenther@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Eric Botcazou <ebotcazou@adacore.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: Add VIEW_CONVERT_EXPR to operand_equal_p
Date: Fri, 30 Oct 2015 08:57:00 -0000 [thread overview]
Message-ID: <CAFiYyc0WZ_Cxxxw4FvRZZVJDp_Epa1Lc8W6P+xJe6DBik4Z5Xw@mail.gmail.com> (raw)
In-Reply-To: <20151029155210.GQ5527@kam.mff.cuni.cz>
On Thu, Oct 29, 2015 at 4:52 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> On Thu, Oct 29, 2015 at 4:02 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> >>
>> >> IMHO it was always wrong/fragile for backends to look at the actual arguments to
>> >> decide on the calling convention. The backends should _solely_ rely on
>> >> gimple_call_fntype and its TYPE_ARG_TYPES here.
>> >>
>> >> Of course then there are varargs ... (not sure if we hit this here).
>> >
>> > Yep, you have varargs and K&R prototypes, so it can't work this way.
>>
>> Well, then I suppose we need to compute the ABI upfront when we gimplify
>> from the orginal args (like we preserve fntype). Having a separate fntype
>> was really meant to make us preserve the ABI throughout the GIMPLE phase...
>
> Hmm, the idea of doing some part of ABI explicitly is definitly nice (at least
> the implicit promotions and pass by reference bits), but storing the full
> lowlevel info on how to pass argument seems bit steep. You will need to
> preserve the RTL containers for parameters that may get non-trivial (PARALLEL)
> and precompute all the other information how to get data on stack.
>
> While playing with the ABi checker I was just looking into this after several
> years (when i was cleaning up calls.c) and calls.c basically works by computing
> arg_data that holds most of the info you would need (you need also return
> argument passing and the hidden argument for structure returns). You can check
> it out - it is fairly non-trivial beast plus it really holds two parallel sets
> of infos - tailcall and normal call (because these differ for targets with
> register windows). The info also depends on flags used to compile function body
> (such as -maccumulate-outgoing-args)
>
> To make something like this a permanent part of GIMPLE would probably need quite
> careful re-engineering of the APIs inventing more high-level intermediate
> representation to get out of the machine description. There is not realy immediate
> benefit from knowing how parameters are housed on stack for gimple optimizers, so
> perhaps just keeping the type information (after promotions) as the way to specify
> call conventions is more practical way to go.
Yeah, I suppose we'd need to either build a new function type for each
variadic call
then or somehow represent 'fntype' differently (note that function
attributes also
need to be preserved).
Richard.
> Honza
>
>> >> But yes, the VIEW_CONVERT "stripping" is a bit fragile and I don't remember
>> >> what exactly we gain from it (when not done on registers).
>> >
>> > I guess gain is really limited to Ada - there are very few cases we do VCE otherwise.
>> > (I think we could do more of them). We can make useless_type_conversion NOP/CONVERT
>> > only. That in fact makes quite a sense because those are types with gimple operations
>> > on it. Perhaps also VCE on vectors, but not VCE in general.
>> >
>> > Honza
>> >>
>> >> But I also don't see where we do the stripping mentioned on memory references.
>> >> The match.pd pattern doesn't apply to memory, only in the GENERIC path
>> >> which is guarded with exact type equality. So I can't see where we end up
>> >> stripping the V_C_E.
>> >>
>> >> There is one bogus case still in fold-const.c:
>> >>
>> >> case VIEW_CONVERT_EXPR:
>> >> if (TREE_CODE (op0) == MEM_REF)
>> >> /* ??? Bogus for aligned types. */
>> >> return fold_build2_loc (loc, MEM_REF, type,
>> >> TREE_OPERAND (op0, 0), TREE_OPERAND (op0, 1));
>> >>
>> >> return NULL_TREE;
>> >>
>> >> that comment is only in my local tree ... (we lose alignment info that is
>> >> on the original MEM_REF type which may be a smaller one).
>> >>
>> >> Richard.
>> >>
>> >> > Honza
>> >> >>
>> >> >>
>> >> >> * gnat.dg/discr44.adb: New test.
>> >> >>
>> >> >> --
>> >> >> Eric Botcazou
>> >> >
>> >> >> -- { dg-do run }
>> >> >> -- { dg-options "-gnatws" }
>> >> >>
>> >> >> procedure Discr44 is
>> >> >>
>> >> >> function Ident (I : Integer) return Integer is
>> >> >> begin
>> >> >> return I;
>> >> >> end;
>> >> >>
>> >> >> type Int is range 1 .. 10;
>> >> >>
>> >> >> type Str is array (Int range <>) of Character;
>> >> >>
>> >> >> type Parent (D1, D2 : Int; B : Boolean) is record
>> >> >> S : Str (D1 .. D2);
>> >> >> end record;
>> >> >>
>> >> >> type Derived (D : Int) is new Parent (D1 => D, D2 => D, B => False);
>> >> >>
>> >> >> X1 : Derived (D => Int (Ident (7)));
>> >> >>
>> >> >> begin
>> >> >> if X1.D /= 7 then
>> >> >> raise Program_Error;
>> >> >> end if;
>> >> >> end;
>> >> >
next prev parent reply other threads:[~2015-10-30 8:56 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 16:29 Jan Hubicka
2015-10-15 8:39 ` Richard Biener
2015-10-15 11:22 ` Eric Botcazou
2015-10-15 19:47 ` Eric Botcazou
2015-10-15 23:24 ` Jan Hubicka
2015-10-16 15:58 ` Eric Botcazou
2015-10-16 21:47 ` Richard Biener
2015-10-17 10:27 ` Eric Botcazou
2015-10-17 15:17 ` Richard Biener
2015-10-17 18:57 ` Jan Hubicka
2015-10-18 12:57 ` Eric Botcazou
2015-10-18 16:37 ` Jan Hubicka
2015-10-18 17:14 ` Richard Biener
2015-10-18 18:45 ` Jan Hubicka
2015-10-19 12:31 ` Richard Biener
2015-10-19 21:01 ` Jan Hubicka
2015-10-19 8:17 ` Eric Botcazou
2015-10-19 7:58 ` Eric Botcazou
2015-10-19 19:46 ` Jan Hubicka
2015-10-20 7:02 ` Eric Botcazou
2015-10-21 22:22 ` Jan Hubicka
2015-10-22 8:52 ` Andreas Schwab
2015-10-28 22:49 ` Eric Botcazou
2015-10-29 4:35 ` Jan Hubicka
2015-10-29 11:31 ` Richard Biener
2015-10-29 11:32 ` Richard Biener
2015-10-29 11:32 ` Richard Biener
2015-11-04 8:51 ` Eric Botcazou
2015-10-29 15:06 ` Jan Hubicka
2015-10-29 15:24 ` Richard Biener
2015-10-29 15:53 ` Jan Hubicka
2015-10-30 8:57 ` Richard Biener [this message]
2015-10-30 15:28 ` Jan Hubicka
2015-11-02 9:55 ` Richard Biener
2015-10-30 9:56 ` Eric Botcazou
2015-10-30 15:19 ` Jan Hubicka
2015-10-31 17:39 ` Eric Botcazou
2015-10-31 17:58 ` Richard Biener
2015-11-03 10:26 ` Eric Botcazou
2015-11-03 11:39 ` Richard Biener
2015-11-02 9:30 ` Andreas Schwab
2015-11-03 8:43 ` Eric Botcazou
2015-11-04 7:23 ` Jan Hubicka
2015-11-04 8:20 ` Eric Botcazou
2015-11-04 16:50 ` Jan Hubicka
2015-11-05 13:49 ` Richard Biener
2015-10-21 4:42 ` Jan Hubicka
2015-10-21 8:54 ` Richard Biener
2015-10-21 11:24 ` Eric Botcazou
2015-10-23 5:22 ` Jan Hubicka
2015-10-23 9:14 ` Richard Biener
2015-10-15 16:59 ` Jan Hubicka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc0WZ_Cxxxw4FvRZZVJDp_Epa1Lc8W6P+xJe6DBik4Z5Xw@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).