Precise and noContraction propagation
authorqining <qining@google.com>
Wed, 4 May 2016 21:34:38 +0000 (17:34 -0400)
committerqining <qining@google.com>
Mon, 9 May 2016 14:46:40 +0000 (10:46 -0400)
commit9220dbb078c0652028186b3aa2d1238f4bb8dfa1
tree7b037f0eb106bfff38bdf7f20b301c855cb368e7
parentd3d3ce7160001846ede74978954e67f4f9fd84e4
Precise and noContraction propagation

    Reimplement the whole workflow to make that: precise'ness of struct
    members won't spread to other non-precise members of the same struct
    instance.

    Approach:
    1. Build the map from symbols to their defining nodes. And for each
    object node (StructIndex, DirectIndex, Symbol nodes, etc), generates an
    accesschain path. Different AST nodes that indicating a same object
    should have the same accesschain path.

    2. Along the building phase in step 1, collect the initial set of
    'precise' (AST qualifier: 'noContraction') objects' accesschain paths.

    3. Start with the initial set of 'precise' accesschain paths, use it as
    a worklist, do as the following steps until the worklist is empty:

        1) Pop an accesschain path from worklist.
        2) Get the symbol part from the accesschain path.
        3) Find the defining nodes of that symbol.
        4) For each defining node, check whether it is defining a 'precise'
        object, or its assignee has nested 'precise' object. Get the
        incremental path from assignee to its nested 'precise' object (if
        any).
        5) Traverse the right side of the defining node, obtain the
        accesschain paths of the corresponding involved 'precise' objects.
        Update the worklist with those new objects' accesschain paths.
        Label involved operations with 'noContraction'.

    In each step, whenever we find the parent object of an nested object is
    'precise' (has 'noContraction' qualifier), we let the nested object
    inherit the 'precise'ness from its parent object.
15 files changed:
SPIRV/GlslangToSpv.cpp
Test/baseResults/precise.tesc.out [new file with mode: 0644]
Test/baseResults/precise_struct_block.vert.out [new file with mode: 0644]
Test/baseResults/spv.precise.tesc.out [new file with mode: 0644]
Test/baseResults/spv.precise.tese.out [new file with mode: 0644]
Test/precise.tesc [new file with mode: 0644]
Test/precise_struct_block.vert [new file with mode: 0644]
Test/spv.precise.tesc [new file with mode: 0644]
Test/spv.precise.tese [new file with mode: 0644]
Test/test-spirv-list
Test/testlist
glslang/CMakeLists.txt
glslang/MachineIndependent/Intermediate.cpp
glslang/MachineIndependent/propagateNoContraction.cpp [new file with mode: 0644]
glslang/MachineIndependent/propagateNoContraction.h [new file with mode: 0644]