Changeset 3855 in CLRX


Ignore:
Timestamp:
Feb 27, 2018, 12:59:59 PM (16 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmRegAlloc?: Mark cblock to res second cache after second usage.

File:
1 edited

Legend:

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

    r3854 r3855  
    641641};
    642642
     643class ResSecondPointsToCache: public std::vector<bool>
     644{
     645public:
     646    explicit ResSecondPointsToCache(size_t n) : std::vector<bool>(n<<1, false)
     647    { }
     648   
     649    void increase(size_t i)
     650    {
     651        if ((*this)[i<<1])
     652            (*this)[(i<<1)+1] = true;
     653        else
     654            (*this)[i<<1] = true;
     655    }
     656   
     657    cxuint count(size_t i) const
     658    { return cxuint((*this)[i<<1]) + (*this)[(i<<1)+1]; }
     659};
     660
    643661typedef AsmRegAllocator::SSAReplace SSAReplace; // first - orig ssaid, second - dest ssaid
    644662typedef AsmRegAllocator::SSAReplacesMap SSAReplacesMap;
     
    709727        const std::vector<CodeBlock>& codeBlocks,
    710728        const PrevWaysIndexMap& prevWaysIndexMap,
    711         const std::vector<bool>& waysToCache, std::vector<bool>& cblocksToCache,
     729        const std::vector<bool>& waysToCache, ResSecondPointsToCache& cblocksToCache,
    712730        SimpleCache<size_t, LastSSAIdMap>& resFirstPointsCache,
    713731        SimpleCache<size_t, RBWSSAIdMap>& resSecondPointsCache,
     
    814832   
    815833    RBWSSAIdMap cacheSecPoints;
    816     const bool toCache = (resSecondPoints == nullptr) && cblocksToCache[nextBlock];
     834    const bool toCache = (resSecondPoints == nullptr) &&
     835                cblocksToCache.count(nextBlock)>=2;
    817836   
    818837    //std::stack<CallStackEntry> callStack = prevCallStack;
     
    848867            else
    849868            {
    850                 cblocksToCache[entry.blockIndex] = true;
     869                cblocksToCache.increase(entry.blockIndex);
     870                std::cout << "cblockToCache: " << entry.blockIndex << "=" <<
     871                            cblocksToCache.count(entry.blockIndex) << std::endl;
    851872                // back, already visited
    852873                std::cout << "resolv already: " << entry.blockIndex << std::endl;
     
    12311252   
    12321253    std::vector<bool> waysToCache(codeBlocks.size(), false);
    1233     std::vector<bool> cblocksToCache(codeBlocks.size(), false);
     1254    ResSecondPointsToCache cblocksToCache(codeBlocks.size());
    12341255    std::vector<bool> visited(codeBlocks.size(), false);
    12351256    flowStack.push_back({ 0, 0 });
     
    12971318            else
    12981319            {
    1299                 cblocksToCache[entry.blockIndex] = true;
     1320                cblocksToCache.increase(entry.blockIndex);
     1321                std::cout << "cblockToCache: " << entry.blockIndex << "=" <<
     1322                            cblocksToCache.count(entry.blockIndex) << std::endl;
    13001323                // back, already visited
    13011324                flowStack.pop_back();
Note: See TracChangeset for help on using the changeset viewer.