From: Tom Hanson <thomas.hanson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Grant Likely <grant.likely@hpe.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 2/3] target-arm: Code changes to implement overwrite of tag field on PC load
Date: Wed, 12 Oct 2016 13:52:55 -0600 [thread overview]
Message-ID: <57FE9497.2000907@linaro.org> (raw)
In-Reply-To: <CAFEAcA98ga_YbOtfKcKZGZaUHvwP8c4K25u2cjjNaDheaBGgig@mail.gmail.com>
On 10/11/2016 10:12 AM, Peter Maydell wrote:
> On 11 October 2016 at 16:51, Thomas Hanson <thomas.hanson@linaro.org> wrote:
>> On 5 October 2016 at 16:01, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> It matches the style of the rest of the code which generally
>>> prefers to convert register numbers into TCGv earlier rather
>>> than later (at the level which is doing decode of instruction
>>> bits, rather than inside utility functions), and gives you a
>>> more flexible utility function, which can do a "write value to PC"
>>> for any value, not just something that happens to be in a CPU
>>> register. And as you say it avoids calling cpu_reg() multiple times
>>> as a side benefit.
>
>> This approach seems counter to both structured and OO design principles
>> which would push common code (like type conversion) down into the lower
>> level function in order to increase re-use and minimize code duplication.
>> Those principles suggest that if we need a gen_a64_set_pc_value() function
>> that can load the PC from something other than a register or an immediate,
>> then it should be a lower level function than, and be called by,
>> gen_a64_set_pc_reg(). This also has the benefit of reducing clutter in the
>> caller, making it more readable and more maintainable.
>
> The 'lower level' stuff here has a general pattern of taking either
> (1) a TCGv or (2) an integer immediate. We should follow that pattern.
>
>> As a separate issue, we now have functions to load the PC from an immediate
>> value and from a register. Where else could we legitimately load the PC
>> from?
>
> Anything where we found ourselves wanting to do some preliminary
> manipulation of the value before writing it to the PC.
>
> thanks
> -- PMM
>
I split gen_a64_set_pc_reg() into 2 funtions, upper that takes a register and lower
that takes a variable. Patch v3 submitted.
next prev parent reply other threads:[~2016-10-12 19:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 17:34 [Qemu-devel] [PATCH 0/3] tareget-arm: Handle tagged addresses when loading PC Thomas Hanson
2016-09-16 17:34 ` [Qemu-devel] [PATCH 1/3] target-arm: Infrastucture changes to enable handling of tagged address loading into PC Thomas Hanson
2016-09-30 0:58 ` Peter Maydell
2016-09-16 17:34 ` [Qemu-devel] [PATCH 2/3] target-arm: Code changes to implement overwrite of tag field on PC load Thomas Hanson
2016-09-30 1:24 ` Peter Maydell
2016-10-05 21:53 ` Tom Hanson
2016-10-05 22:01 ` Peter Maydell
2016-10-11 15:51 ` Thomas Hanson
2016-10-11 16:02 ` Richard Henderson
2016-10-11 16:12 ` Peter Maydell
2016-10-12 19:52 ` Tom Hanson [this message]
2016-09-16 17:34 ` [Qemu-devel] [PATCH 3/3] target-arm: Comments to mark location of pending work for 56 bit addresses Thomas Hanson
2016-09-30 1:27 ` Peter Maydell
2016-09-30 22:46 ` Tom Hanson
2016-09-30 23:24 ` Peter Maydell
2016-10-03 17:01 ` Tom Hanson
2016-10-03 18:26 ` Tom Hanson
2016-09-30 1:37 ` [Qemu-devel] [PATCH 0/3] tareget-arm: Handle tagged addresses when loading PC Peter Maydell
2016-09-30 21:48 ` Tom Hanson
2016-09-30 22:06 ` Peter Maydell
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=57FE9497.2000907@linaro.org \
--to=thomas.hanson@linaro.org \
--cc=grant.likely@hpe.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.