On 9/10/23 00:09, Brian Cain wrote:
From: Matheus Tavares Bernardino <[email protected]>

As docs/devel/loads-stores.rst states:

   ``GETPC()`` should be used with great care: calling
   it in other functions that are *not* the top level
   ``HELPER(foo)`` will cause unexpected behavior. Instead, the
   value of ``GETPC()`` should be read from the helper and passed
   if needed to the functions that the helper calls.

Let's fix the GETPC() usage in Hexagon, making sure it's always called
from top level helpers and passed down to the places where it's
needed. There are a few snippets where that is not currently the case:

- probe_store(), which is only called from two helpers, so it's easy to
   move GETPC() up.

- mem_load*() functions, which are also called directly from helpers,
   but through the MEM_LOAD*() set of macros. Note that this are only
   used when compiling with --disable-hexagon-idef-parser.

   In this case, we also take this opportunity to simplify the code,
   unifying the mem_load*() functions.

- HELPER(probe_hvx_stores), when called from another helper, ends up
   using its own GETPC() expansion instead of the top level caller.

Signed-off-by: Matheus Tavares Bernardino <[email protected]>
Reviewed-by: Taylor Simpson <[email protected]>
Message-Id: 
<2c74c3696946edba7cc5b2942cf296a5af532052.1689070412.git.quic_mathb...@quicinc.com>-ne

Again suspicious '-ne' trailing.

Reviewed-by: Brian Cain <[email protected]>
Signed-off-by: Brian Cain <[email protected]>
---
  target/hexagon/macros.h    | 19 +++++-----
  target/hexagon/op_helper.c | 75 +++++++++++++++-----------------------
  target/hexagon/op_helper.h |  9 -----
  3 files changed, 38 insertions(+), 65 deletions(-)


Reply via email to