Changeset 3845 in CLRX


Ignore:
Timestamp:
Feb 24, 2018, 8:34:42 AM (17 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmRegAlloc?: Use SSAEntry shortcut. SimpleCache?: Set maxWeight to elemWeight*2 if elemWeight is greater.

File:
1 edited

Legend:

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

    r3844 r3845  
    3939typedef AsmRegAllocator::NextBlock NextBlock;
    4040typedef AsmRegAllocator::SSAInfo SSAInfo;
     41typedef std::pair<const AsmSingleVReg, SSAInfo> SSAEntry;
    4142
    4243ISAUsageHandler::ISAUsageHandler(const std::vector<cxbyte>& _content) :
     
    534535       
    535536        // correct max weight if element have greater weight
    536         maxWeight = std::max(elemWeight, maxWeight);
     537        if (elemWeight > maxWeight)
     538            maxWeight = elemWeight<<1;
    537539       
    538540        while (totalWeight+elemWeight > maxWeight)
     
    627629            const LastSSAIdMap& stackVarMap,
    628630            std::unordered_map<AsmSingleVReg, size_t>& toResolveMap,
    629             FlowStackEntry2& entry,
    630             const std::pair<const AsmSingleVReg, SSAInfo>& sentry)
     631            FlowStackEntry2& entry, const SSAEntry& sentry)
    631632{
    632633    const SSAInfo& sinfo = sentry.second;
     
    906907static void reduceSSAIds(std::unordered_map<AsmSingleVReg, size_t>& curSSAIdMap,
    907908            RetSSAIdMap& retSSAIdMap, std::unordered_map<size_t, RoutineData>& routineMap,
    908             SSAReplacesMap& ssaReplacesMap,
    909             std::pair<const AsmSingleVReg, SSAInfo>& ssaEntry)
     909            SSAReplacesMap& ssaReplacesMap, SSAEntry& ssaEntry)
    910910{
    911911    SSAInfo& sinfo = ssaEntry.second;
     
    942942}
    943943
    944 static void updateRoutineData(RoutineData& rdata,
    945         std::pair<const AsmSingleVReg, SSAInfo>& ssaEntry)
     944static void updateRoutineData(RoutineData& rdata, SSAEntry& ssaEntry)
    946945{
    947946    const SSAInfo& sinfo = ssaEntry.second;
     
    10321031}
    10331032
    1034 static void updateRoutineCurSSAIdMap(RoutineData* rdata,
    1035             const std::pair<const AsmSingleVReg, SSAInfo>& ssaEntry,
     1033static void updateRoutineCurSSAIdMap(RoutineData* rdata, const SSAEntry& ssaEntry,
    10361034            const FlowStackEntry& entry, size_t curSSAId, size_t nextSSAId)
    10371035{
     
    10831081    size_t regTypesNum;
    10841082    assembler.isaAssembler->getRegisterRanges(regTypesNum, regRanges);
     1083   
     1084    size_t rbwCount = 0;
    10851085   
    10861086    while (true)
     
    11231123                    sinfo.ssaIdBefore = sinfo.ssaIdFirst =
    11241124                            sinfo.ssaId = sinfo.ssaIdLast = 0;
     1125                // count read before writes (for cache weight)
     1126                if (rvu.regVar!=nullptr && sinfo.readBeforeWrite)
     1127                    rbwCount++;
    11251128            }
    11261129            // get next rvusage
     
    13081311    std::fill(visited.begin(), visited.end(), false);
    13091312    flowStack.push_back({ 0, 0 });
     1313   
     1314    SimpleCache<size_t, RBWSSAIdMap> toReplaceCache(rbwCount<<1);
    13101315   
    13111316    while (!flowStack.empty())
Note: See TracChangeset for help on using the changeset viewer.