Changeset 3959 in CLRX


Ignore:
Timestamp:
Apr 1, 2018, 10:12:06 PM (8 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmRegAlloc?: fixing recursion support: correct finding routines in routineMap (includes second pass).

Location:
CLRadeonExtender/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/AsmRegAlloc.cpp

    r3958 r3959  
    12151215// join ret SSAId Map - src - last SSAIdMap from called routine
    12161216static void joinRetSSAIdMap(RetSSAIdMap& dest, const LastSSAIdMap& src,
    1217                 size_t routineBlock)
     1217                BlockIndex routineBlock)
    12181218{
    12191219    for (const auto& entry: src)
     
    16731673        std::unordered_map<AsmSingleVReg, size_t>& curSSAIdMap,
    16741674        const std::unordered_set<BlockIndex>& loopBlocks,
     1675        const std::unordered_set<BlockIndex>& callBlocks,
    16751676        const ResSecondPointsToCache& subroutToCache,
    16761677        SimpleCache<BlockIndex, RoutineData>& subroutinesCache,
     
    17211722            const bool oldFB = flowStackBlocks[entry.blockIndex];
    17221723            flowStackBlocks[entry.blockIndex] = !oldFB;
    1723             createRoutineData(codeBlocks, curSSAIdMap, loopBlocks, subroutToCache,
    1724                 subroutinesCache, routineMap, subrData, entry.blockIndex, true,
    1725                 flowStackBlocks);
     1724            createRoutineData(codeBlocks, curSSAIdMap, loopBlocks, callBlocks,
     1725                    subroutToCache, subroutinesCache, routineMap, subrData,
     1726                    entry.blockIndex, true, flowStackBlocks);
    17261727            RoutineData subrDataCopy;
    17271728            flowStackBlocks[entry.blockIndex] = oldFB;
     
    19061907        for (; entry.nextIndex < cblock.nexts.size() &&
    19071908                    cblock.nexts[entry.nextIndex].isCall; entry.nextIndex++)
    1908             joinRoutineData(rdata, routineMap.find(
    1909                             cblock.nexts[entry.nextIndex].block)->second);
     1909        {
     1910            BlockIndex rblock = cblock.nexts[entry.nextIndex].block;
     1911            if (callBlocks.find(rblock) != callBlocks.end())
     1912                rblock.pass = 1;
     1913            if (rblock != routineBlock)
     1914                joinRoutineData(rdata, routineMap.find(rblock)->second);
     1915        }
    19101916       
    19111917        if (entry.nextIndex < cblock.nexts.size())
     
    19321938                        initializePrevRetSSAIds(cblock, curSSAIdMap, retSSAIdMap,
    19331939                                    it->second, entry);
    1934                         joinRetSSAIdMap(retSSAIdMap, it->second.lastSSAIdMap, next.block);
     1940                        BlockIndex rblock(next.block, entry.blockIndex.pass);
     1941                        if (callBlocks.find(next.block) != callBlocks.end())
     1942                            rblock.pass = 1;
     1943                       
     1944                        joinRetSSAIdMap(retSSAIdMap, it->second.lastSSAIdMap, rblock);
    19351945                    }
    19361946            }
     
    22102220            if (!isRoutineGen[routineBlock])
    22112221            {
    2212                 createRoutineData(codeBlocks, curSSAIdMap, loopBlocks,
     2222                createRoutineData(codeBlocks, curSSAIdMap, loopBlocks, callBlocks,
    22132223                            cblocksToCache, subroutinesCache, routineMap, prevRdata,
    22142224                            routineBlock);
     
    23052315                        initializePrevRetSSAIds(cblock, curSSAIdMap, retSSAIdMap,
    23062316                                    it->second, entry);
    2307                         joinRetSSAIdMap(retSSAIdMap, it->second.lastSSAIdMap, next.block);
     2317                       
     2318                        BlockIndex rblock(next.block, entry.blockIndex.pass);
     2319                        if (callBlocks.find(next.block) != callBlocks.end())
     2320                            rblock.pass = 1;
     2321                       
     2322                        joinRetSSAIdMap(retSSAIdMap, it->second.lastSSAIdMap, rblock);
    23082323                    }
    23092324            }
  • CLRadeonExtender/trunk/tests/amdasm/AsmRegAllocCase3.cpp

    r3958 r3959  
    12411241                    { { "sa", 0 }, SSAInfo(0, SIZE_MAX, 1, SIZE_MAX, 0, true) },
    12421242                    { { "sa", 2 }, SSAInfo(2, 4, 4, 4, 1, true) },
    1243                     //{ { "sa", 3 }, SSAInfo(3, 5, 5, 5, 1, true) },
    1244                     //{ { "sa", 6 }, SSAInfo(2, 4, 4, 4, 1, true) }
    1245                     { { "sa", 3 }, SSAInfo(2, 5, 5, 5, 1, true) },
    1246                     { { "sa", 6 }, SSAInfo(1, 4, 4, 4, 1, true) }
     1243                    { { "sa", 3 }, SSAInfo(3, 5, 5, 5, 1, true) },
     1244                    { { "sa", 6 }, SSAInfo(2, 4, 4, 4, 1, true) }
     1245                    //{ { "sa", 3 }, SSAInfo(2, 5, 5, 5, 1, true) },
     1246                    //{ { "sa", 6 }, SSAInfo(1, 4, 4, 4, 1, true) }
    12471247                }, false, false, true },
    12481248            {   // block 2 - routine
     
    12891289            { { "sa", 2 }, { { 3, 2 }, { 2, 1 } } },
    12901290            //{ { "sa", 3 }, { { 3, 2 }, { 4, 3 }, { 2, 1 } } },
    1291             { { "sa", 3 }, { { 3, 2 }, { 4, 2 }, { 2, 1 } } },
     1291            { { "sa", 3 }, { { 3, 2 }, { 4, 2 }, { 4, 3 }, { 2, 1 } } },
    12921292            //{ { "sa", 6 }, { { 2, 1 }, { 3, 2 } } }
    1293             { { "sa", 6 }, { { 2, 1 }, { 3, 1 } } }
     1293            { { "sa", 6 }, { { 2, 1 }, { 3, 1 }, { 3, 2 } } }
    12941294        },
    12951295        true, ""
Note: See TracChangeset for help on using the changeset viewer.