Changeset 3961 in CLRX


Ignore:
Timestamp:
Apr 2, 2018, 10:58:32 PM (4 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmRegAlloc?: apply reduction of retSSAIds to curSSAIdMap in createRoutineData. replace push_back in ssaIds by insertValue.
Pass correct nextblock to routineMap.find.

File:
1 edited

Legend:

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

    r3959 r3961  
    14331433}
    14341434
    1435 // TODO: correct reduction for recursion support
     1435static void reduceSSAIds2(std::unordered_map<AsmSingleVReg, size_t>& curSSAIdMap,
     1436            RetSSAIdMap& retSSAIdMap, FlowStackEntry& entry, const SSAEntry& ssaEntry)
     1437{
     1438    const SSAInfo& sinfo = ssaEntry.second;
     1439    size_t& ssaId = curSSAIdMap[ssaEntry.first];
     1440    auto ssaIdsIt = retSSAIdMap.find(ssaEntry.first);
     1441    if (ssaIdsIt != retSSAIdMap.end() && sinfo.readBeforeWrite)
     1442    {
     1443        auto& ssaIds = ssaIdsIt->second.ssaIds;
     1444        ssaId = ssaIds.front()+1; // plus one
     1445        retSSAIdMap.erase(ssaIdsIt);
     1446    }
     1447    else if (ssaIdsIt != retSSAIdMap.end() && sinfo.ssaIdChange!=0)
     1448    {
     1449        // put before removing to revert for other ways after calls
     1450        auto res = entry.prevRetSSAIdSets.insert(*ssaIdsIt);
     1451        if (res.second)
     1452            res.first->second = ssaIdsIt->second;
     1453        // just remove, if some change without read before
     1454        retSSAIdMap.erase(ssaIdsIt);
     1455    }
     1456}
     1457
    14361458// reduce retSSAIds (last SSAIds for regvar) while passing by code block
    14371459// and emits SSA replaces for these ssaids
     
    14491471        if (sinfo.ssaId != SIZE_MAX)
    14501472        {
    1451             std::vector<size_t> outSSAIds = ssaIds;
    1452             outSSAIds.push_back(ssaId-1); // ???
     1473            VectorSet<size_t> outSSAIds = ssaIds;
     1474            outSSAIds.insertValue(ssaId-1); // ???
    14531475            // already set
    14541476            if (outSSAIds.size() >= 1)
     
    16081630            {
    16091631                auto cit = curSSAIdMap.find(v.first);
    1610                 ssaIds.push_back((cit!=curSSAIdMap.end() ? cit->second : 1)-1);
     1632                ssaIds.insertValue((cit!=curSSAIdMap.end() ? cit->second : 1)-1);
    16111633            }
    16121634           
     
    18881910                    if (ssaEntry.first.regVar != nullptr)
    18891911                    {
     1912                        reduceSSAIds2(curSSAIdMap, retSSAIdMap, entry, ssaEntry);
    18901913                        // put data to routine data
    18911914                        updateRoutineData(rdata, ssaEntry, curSSAIdMap[ssaEntry.first]-1);
     
    19351958                    {
    19361959                        //std::cout << "joincall:"<< next.block << std::endl;
    1937                         auto it = routineMap.find(next.block); // must find
    1938                         initializePrevRetSSAIds(cblock, curSSAIdMap, retSSAIdMap,
    1939                                     it->second, entry);
    19401960                        BlockIndex rblock(next.block, entry.blockIndex.pass);
    19411961                        if (callBlocks.find(next.block) != callBlocks.end())
    19421962                            rblock.pass = 1;
     1963                        auto it = routineMap.find(rblock); // must find
     1964                        initializePrevRetSSAIds(cblock, curSSAIdMap, retSSAIdMap,
     1965                                    it->second, entry);
    19431966                       
    19441967                        joinRetSSAIdMap(retSSAIdMap, it->second.lastSSAIdMap, rblock);
Note: See TracChangeset for help on using the changeset viewer.