Changeset 4016 in CLRX


Ignore:
Timestamp:
Apr 18, 2018, 7:26:48 AM (6 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmRegAlloc?: Separate creating livenesses and creating interference graph. Store output livenesses into AsmRegAllocator? object (for testing).

Location:
CLRadeonExtender/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/CLRX/amdasm/Assembler.h

    r3997 r4016  
    335335    };
    336336   
     337    typedef Array<std::pair<size_t, size_t> > OutLiveness;
     338   
    337339     // first - orig ssaid, second - dest ssaid
    338340    typedef std::pair<size_t, size_t> SSAReplace;
     
    358360    size_t regTypesNum;
    359361   
     362    Array<OutLiveness> outLivenesses[MAX_REGTYPES_NUM];
     363    size_t graphVregsCounts[MAX_REGTYPES_NUM];
    360364    VarIndexMap vregIndexMaps[MAX_REGTYPES_NUM]; // indices to igraph for 2 reg types
    361365    InterGraph interGraphs[MAX_REGTYPES_NUM]; // for 2 register
     
    376380    void createSSAData(ISAUsageHandler& usageHandler);
    377381    void applySSAReplaces();
    378     void createInterferenceGraph(ISAUsageHandler& usageHandler);
     382    void createLivenesses(ISAUsageHandler& usageHandler);
     383    void createInterferenceGraph();
    379384    void colorInterferenceGraph();
    380385   
     
    385390    const SSAReplacesMap& getSSAReplacesMap() const
    386391    { return ssaReplacesMap; }
     392    const Array<OutLiveness>* getOutLivenesses() const
     393    { return outLivenesses; }
    387394};
    388395
  • CLRadeonExtender/trunk/amdasm/AsmRegAlloc.cpp

    r4015 r4016  
    944944}
    945945
    946 void AsmRegAllocator::createInterferenceGraph(ISAUsageHandler& usageHandler)
     946void AsmRegAllocator::createLivenesses(ISAUsageHandler& usageHandler)
    947947{
    948948    // construct var index maps
    949     size_t graphVregsCounts[MAX_REGTYPES_NUM];
    950949    std::fill(graphVregsCounts, graphVregsCounts+regTypesNum, 0);
    951950    cxuint regRanges[MAX_REGTYPES_NUM*2];
     
    11711170    }
    11721171   
     1172    // move livenesses to AsmRegAllocator outLivenesses
     1173    for (size_t regType = 0; regType < regTypesNum; regType++)
     1174    {
     1175        std::vector<Liveness>& livenesses2 = livenesses[regType];
     1176        Array<OutLiveness>& outLivenesses2 = outLivenesses[regType];
     1177        outLivenesses2.resize(livenesses2.size());
     1178        for (size_t li = 0; li < livenesses2.size(); li++)
     1179        {
     1180            outLivenesses2[li].resize(livenesses2[li].l.size());
     1181            std::copy(livenesses2[li].l.begin(), livenesses2[li].l.end(),
     1182                      outLivenesses2[li].begin());
     1183            livenesses2[li].clear();
     1184        }
     1185        livenesses2.clear();
     1186    }
     1187}
     1188
     1189void AsmRegAllocator::createInterferenceGraph()
     1190{
    11731191    /// construct liveBlockMaps
    11741192    std::set<LiveBlock> liveBlockMaps[MAX_REGTYPES_NUM];
     
    11761194    {
    11771195        std::set<LiveBlock>& liveBlockMap = liveBlockMaps[regType];
    1178         std::vector<Liveness>& liveness = livenesses[regType];
     1196        Array<OutLiveness>& liveness = outLivenesses[regType];
    11791197        for (size_t li = 0; li < liveness.size(); li++)
    11801198        {
    1181             Liveness& lv = liveness[li];
    1182             for (const std::pair<size_t, size_t>& blk: lv.l)
     1199            OutLiveness& lv = liveness[li];
     1200            for (const std::pair<size_t, size_t>& blk: lv)
    11831201                if (blk.first != blk.second)
    11841202                    liveBlockMap.insert({ blk.first, blk.second, li });
     
    14381456    createSSAData(*section.usageHandler);
    14391457    applySSAReplaces();
    1440     createInterferenceGraph(*section.usageHandler);
     1458    createLivenesses(*section.usageHandler);
     1459    createInterferenceGraph();
    14411460    colorInterferenceGraph();
    14421461}
Note: See TracChangeset for help on using the changeset viewer.