Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
A
angle
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • angle
  • Repository

Switch branch/tag
  • angle
  • src
  • libANGLE
  • VaryingPacking.cpp
Find file
BlameHistoryPermalink
  • Olli Etuaho's avatar
    Collect static use information during parsing · 94bbed1e
    Olli Etuaho authored Mar 20, 2018
    We now collect metadata for variables in the symbol table. The
    metadata is stored in a map using the variable unique id as a key, so
    we can store the variables themselves as constexpr while still having
    dynamic metadata.
    
    For now we collect whether a variable is statically read or written.
    This can be used to more accurately determine whether a variable is
    statically used, but can also enable more optimizations in the future,
    such as pruning variables that are never read or folding variables
    that are never written after initialization. The collection is done
    during parsing, so that nothing is pruned from the AST before the
    static use is recorded.
    
    Static writes are flagged in ParseContext::checkCanBeLValue, as that
    function is already called for all variables that are written.
    
    Static reads are flagged whenever there's an operation that requires
    a variable to be read. This includes:
    * Unary and binary math ops
    * Comma ops
    * Ternary ops
    * Assignments
    * Returning the variable
    * Passing the variable as an in or inout argument to a function
    * Using the variable as a constructor argument
    * Using the variable as an if statement condition
    * Using the variable as a loop condition or expression
    * Using the variable as an index
    * Using the variable as a switch statement init expression
    
    In case there are statements that simply refer to a variable without
    doing operations on it, the variable is being treated as statically
    read. Examples of such statements:
    
    my_var;
    my_arr[2];
    
    These are a bit of a corner case, but it makes sense to treat them as
    static use for validation purposes.
    
    Collecting correct static use information costs us a bit of compiler
    performance, but the regression is on the order of just a few percent
    in the compiler perf tests.
    
    BUG=angleproject:2262
    TEST=angle_unittests, angle_end2end_tests
    
    Change-Id: Ib0d7add7e4a7d11bffeb2a4861eeea982c562234
    Reviewed-on: https://chromium-review.googlesource.com/977964Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
    Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
    94bbed1e
VaryingPacking.cpp 15.9 KB
EditWeb IDE
×

Replace VaryingPacking.cpp

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.