Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement likely/unlikely intrinsics #26429

Closed
wants to merge 7 commits into from

Commits on Jun 19, 2015

  1. Add likely/unlikely intrinsics

    Aatch committed Jun 19, 2015
    Configuration menu
    Copy the full SHA
    a2dbed9 View commit details
    Browse the repository at this point in the history
  2. Improve translation of functions with simple return types

    Previously, all function calls would store the result to a temporary
    stack slot. While this would often be optimized out, it prevents the
    branch hinting from taking effect.
    
    Now function calls that return a scalar have their return values, well,
    returned directly, avoiding the redundant store/load pair that was there
    before. The return types it does this for are fairly limited due to
    issues when doing it for other types.
    Aatch committed Jun 19, 2015
    Configuration menu
    Copy the full SHA
    79d69a7 View commit details
    Browse the repository at this point in the history
  3. Fix the named tuple constructor code to return a value

    This is essentially the same change as in `intrinsics`. Returns a value
    or `()` depending on whether or not the type is immediate.
    Aatch committed Jun 19, 2015
    Configuration menu
    Copy the full SHA
    7ec6f7b View commit details
    Browse the repository at this point in the history
  4. Fix and improve translation of transmute

    My earlier changes caused the result to be incorrect when both the input
    and output types were immediate. This has been fixed. I also extended
    the code to handle int -> ptr and ptr -> int casts as simple cases,
    since it's fairly easy to do.
    
    I changed the one place that was transmuting a function pointer to an
    integer to just use a cast, it's more clear this way.
    Aatch committed Jun 19, 2015
    Configuration menu
    Copy the full SHA
    9c0b97d View commit details
    Browse the repository at this point in the history
  5. Improve handling of function calls with immediate returns

    This fixes up calling foreign functions so they return the value the
    function returns, same as other calls. It also refactors the as-datum
    function-call code to handle more cases and to be in a better place.
    Aatch committed Jun 19, 2015
    Configuration menu
    Copy the full SHA
    4bd32cf View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e74d5be View commit details
    Browse the repository at this point in the history
  7. Handle block expressions a little nicer.

    This handles block expressions based on the kind of their trailing
    expression (if there is one), rather than always using DPS. This is to
    allow `unsafe { likely(foo) }` to work as expected, but also reduces the
    number of temporary allocas in some cases.
    
    Also adds a codegen test to make sure the intrinsics are being
    codegenned in a way that means they are having an effect.
    
    This commit also fixes a small bug I noticed in the translation of
    overflow checking that meant the branch hints weren't actually taking
    effect.
    Aatch committed Jun 19, 2015
    Configuration menu
    Copy the full SHA
    e75cf7e View commit details
    Browse the repository at this point in the history