This is the mail archive of the gcc@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]

Re: ggc_alloc_rtvec_sized allocates spaces more than necessary?


On Tue, Aug 16, 2011 at 1:51 PM, Laurynas Biveinis
<laurynas.biveinis@gmail.com> wrote:
>> On Mon, Aug 15, 2011 at 2:16 PM, çä <netcasper@gmail.com> wrote:
>>> The size it allocates is
>>>
>>> Â(sizeof (struct rtvec_def) + ((NELT) - 1)) * sizeof (rtx)
>
>>> Originally, the allocated size is
>>>
>>> Âsizeof (struct rtvec_def) + ((NELT) - 1) * sizeof (rtx)
>
> Yes, this is correct, good catch.
>
>>> Â(sizeof (struct rtvec_def) + sizeof (rtx) - 1) / sizeof (rtx) +
>>> ((NELT) - 1) Â // (3)
>
> Due to the way those macros expand, right now replacing the first arg
> with "1" and the second one with straightforward "sizeof (struct
> rtvec_def) + ((NELT) - 1) * sizeof (rtx)" will work and will be easier
> to read than division. Liang, would you submit such patch?

Yes, I have sent patch to gcc-patches.

>
> Thanks again,
> --
> Laurynas
>


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