Changeset 4015 in CLRX


Ignore:
Timestamp:
Apr 17, 2018, 6:46:55 PM (4 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmRegAlloc?: Move typedefs and classes into AsmRegAlloc?.h.

Location:
CLRadeonExtender/trunk/amdasm
Files:
2 edited

Legend:

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

    r4013 r4015  
    714714}
    715715
    716 typedef std::deque<FlowStackEntry3>::const_iterator FlowStackCIter;
    717 
    718 struct CLRX_INTERNAL VRegLastPos
    719 {
    720     size_t ssaId; // last SSA id
    721     std::vector<FlowStackCIter> blockChain; // subsequent blocks that changes SSAId
    722 };
    723 
    724716/* TODO: add handling calls
    725717 * handle many start points in this code (for example many kernel's in same code)
    726718 * replace sets by vector, and sort and remove same values on demand
    727719 */
    728 
    729 typedef std::unordered_map<AsmSingleVReg, VRegLastPos> LastVRegMap;
    730720
    731721static void putCrossBlockLivenesses(const std::deque<FlowStackEntry3>& flowStack,
     
    857847}
    858848
    859 struct LiveBlock
    860 {
    861     size_t start;
    862     size_t end;
    863     size_t vidx;
    864    
    865     bool operator==(const LiveBlock& b) const
    866     { return start==b.start && end==b.end && vidx==b.vidx; }
    867    
    868     bool operator<(const LiveBlock& b) const
    869     { return start<b.start || (start==b.start &&
    870             (end<b.end || (end==b.end && vidx<b.vidx))); }
    871 };
    872 
    873 typedef AsmRegAllocator::LinearDep LinearDep;
    874 typedef AsmRegAllocator::EqualToDep EqualToDep;
    875 typedef std::unordered_map<size_t, LinearDep> LinearDepMap;
    876 typedef std::unordered_map<size_t, EqualToDep> EqualToDepMap;
    877 
    878849static void addUsageDeps(const cxbyte* ldeps, const cxbyte* edeps, cxuint rvusNum,
    879850            const AsmRegVarUsage* rvus, LinearDepMap* ldepsOut,
     
    972943    }
    973944}
    974 
    975 typedef std::unordered_map<size_t, EqualToDep>::const_iterator EqualToDepMapCIter;
    976 
    977 struct EqualStackEntry
    978 {
    979     EqualToDepMapCIter etoDepIt;
    980     size_t nextIdx; // over nextVidxes size, then prevVidxes[nextIdx-nextVidxes.size()]
    981 };
    982945
    983946void AsmRegAllocator::createInterferenceGraph(ISAUsageHandler& usageHandler)
     
    13371300}
    13381301
    1339 typedef AsmRegAllocator::InterGraph InterGraph;
    1340 
    1341 struct CLRX_INTERNAL SDOLDOCompare
    1342 {
    1343     const InterGraph& interGraph;
    1344     const Array<size_t>& sdoCounts;
    1345    
    1346     SDOLDOCompare(const InterGraph& _interGraph, const Array<size_t>&_sdoCounts)
    1347         : interGraph(_interGraph), sdoCounts(_sdoCounts)
    1348     { }
    1349    
    1350     bool operator()(size_t a, size_t b) const
    1351     {
    1352         if (sdoCounts[a] > sdoCounts[b])
    1353             return true;
    1354         return interGraph[a].size() > interGraph[b].size();
    1355     }
    1356 };
    1357 
    13581302/* algorithm to allocate regranges:
    13591303 * from smallest regranges to greatest regranges:
  • CLRadeonExtender/trunk/amdasm/AsmRegAlloc.h

    r4010 r4015  
    326326typedef AsmRegAllocator::VarIndexMap VarIndexMap;
    327327
     328typedef std::deque<FlowStackEntry3>::const_iterator FlowStackCIter;
     329
     330struct CLRX_INTERNAL VRegLastPos
     331{
     332    size_t ssaId; // last SSA id
     333    std::vector<FlowStackCIter> blockChain; // subsequent blocks that changes SSAId
     334};
     335
     336typedef std::unordered_map<AsmSingleVReg, VRegLastPos> LastVRegMap;
     337
     338struct CLRX_INTERNAL LiveBlock
     339{
     340    size_t start;
     341    size_t end;
     342    size_t vidx;
     343   
     344    bool operator==(const LiveBlock& b) const
     345    { return start==b.start && end==b.end && vidx==b.vidx; }
     346   
     347    bool operator<(const LiveBlock& b) const
     348    { return start<b.start || (start==b.start &&
     349            (end<b.end || (end==b.end && vidx<b.vidx))); }
     350};
     351
     352typedef AsmRegAllocator::LinearDep LinearDep;
     353typedef AsmRegAllocator::EqualToDep EqualToDep;
     354typedef std::unordered_map<size_t, LinearDep> LinearDepMap;
     355typedef std::unordered_map<size_t, EqualToDep> EqualToDepMap;
     356
     357typedef std::unordered_map<size_t, EqualToDep>::const_iterator EqualToDepMapCIter;
     358
     359struct CLRX_INTERNAL EqualStackEntry
     360{
     361    EqualToDepMapCIter etoDepIt;
     362    size_t nextIdx; // over nextVidxes size, then prevVidxes[nextIdx-nextVidxes.size()]
     363};
     364
     365typedef AsmRegAllocator::InterGraph InterGraph;
     366
     367struct CLRX_INTERNAL SDOLDOCompare
     368{
     369    const InterGraph& interGraph;
     370    const Array<size_t>& sdoCounts;
     371   
     372    SDOLDOCompare(const InterGraph& _interGraph, const Array<size_t>&_sdoCounts)
     373        : interGraph(_interGraph), sdoCounts(_sdoCounts)
     374    { }
     375   
     376    bool operator()(size_t a, size_t b) const
     377    {
     378        if (sdoCounts[a] > sdoCounts[b])
     379            return true;
     380        return interGraph[a].size() > interGraph[b].size();
     381    }
     382};
     383
    328384};
    329385
Note: See TracChangeset for help on using the changeset viewer.