Skip to content
Snippets Groups Projects
  • Matheus Tavares Bernardino's avatar
    3bd83593
    target/hexagon: move GETPC() calls to top level helpers · 3bd83593
    Matheus Tavares Bernardino authored
    
    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: default avatarMatheus Tavares Bernardino <quic_mathbern@quicinc.com>
    Reviewed-by: default avatarTaylor Simpson <ltaylorsimpson@gmail.com>
    Message-Id: <2c74c3696946edba7cc5b2942cf296a5af532052.1689070412.git.quic_mathbern@quicinc.com>-ne
    Reviewed-by: default avatarBrian Cain <bcain@quicinc.com>
    Signed-off-by: default avatarBrian Cain <bcain@quicinc.com>
    Message-Id: <20231008220945.983643-2-bcain@quicinc.com>
    3bd83593
    History
    target/hexagon: move GETPC() calls to top level helpers
    Matheus Tavares Bernardino authored
    
    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: default avatarMatheus Tavares Bernardino <quic_mathbern@quicinc.com>
    Reviewed-by: default avatarTaylor Simpson <ltaylorsimpson@gmail.com>
    Message-Id: <2c74c3696946edba7cc5b2942cf296a5af532052.1689070412.git.quic_mathbern@quicinc.com>-ne
    Reviewed-by: default avatarBrian Cain <bcain@quicinc.com>
    Signed-off-by: default avatarBrian Cain <bcain@quicinc.com>
    Message-Id: <20231008220945.983643-2-bcain@quicinc.com>