Changeset 4172 in CLRX


Ignore:
Timestamp:
May 16, 2018, 1:33:21 PM (4 days ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmRegAlloc?: Unfinished integration LinearDepHandler? with AsmRegAllocator?.

Location:
CLRadeonExtender/trunk
Files:
6 edited

Legend:

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

    r4171 r4172  
    376376        std::unordered_map<AsmSingleVReg, SSAInfo> ssaInfoMap;
    377377        ISAUsageHandler::ReadPos usagePos;
     378        size_t linearDepPos;
    378379    };
    379380   
     
    422423    void createCodeStructure(const std::vector<AsmCodeFlowEntry>& codeFlow,
    423424             size_t codeSize, const cxbyte* code);
    424     void createSSAData(ISAUsageHandler& usageHandler);
     425    void createSSAData(ISAUsageHandler& usageHandler,
     426                ISALinearDepHandler& linDepHandler);
    425427    void applySSAReplaces();
    426     void createLivenesses(ISAUsageHandler& usageHandler);
     428    void createLivenesses(ISAUsageHandler& usageHandler,
     429                ISALinearDepHandler& linDepHandler);
    427430    void createInterferenceGraph();
    428431    void colorInterferenceGraph();
  • CLRadeonExtender/trunk/amdasm/AsmRegAlloc.cpp

    r4171 r4172  
    887887    const AsmSection& section = assembler.sections[sectionId];
    888888    createCodeStructure(section.codeFlow, section.content.size(), section.content.data());
    889     createSSAData(*section.usageHandler);
     889    createSSAData(*section.usageHandler, *section.linearDepHandler);
    890890    applySSAReplaces();
    891     createLivenesses(*section.usageHandler);
     891    createLivenesses(*section.usageHandler, *section.linearDepHandler);
    892892    createInterferenceGraph();
    893893    colorInterferenceGraph();
  • CLRadeonExtender/trunk/amdasm/AsmRegAllocLive.cpp

    r4169 r4172  
    11401140}
    11411141
    1142 void AsmRegAllocator::createLivenesses(ISAUsageHandler& usageHandler)
     1142void AsmRegAllocator::createLivenesses(ISAUsageHandler& usageHandler,
     1143                ISALinearDepHandler& linDepHandler)
    11431144{
    11441145    ARDOut << "----- createLivenesses ------\n";
     
    12721273               
    12731274                usageHandler.setReadPos(cblock.usagePos);
     1275                linDepHandler.setReadPos(cblock.linearDepPos);
    12741276                // register in liveness
    12751277                while (true)
  • CLRadeonExtender/trunk/amdasm/AsmRegAllocSSAData.cpp

    r4168 r4172  
    13871387}
    13881388
    1389 void AsmRegAllocator::createSSAData(ISAUsageHandler& usageHandler)
     1389void AsmRegAllocator::createSSAData(ISAUsageHandler& usageHandler,
     1390                ISALinearDepHandler& linDepHandler)
    13901391{
    13911392    if (codeBlocks.empty())
     
    13941395    auto cbit = codeBlocks.begin();
    13951396    AsmRegVarUsage rvu;
     1397   
    13961398    if (!usageHandler.hasNext())
    13971399        return; // do nothing if no regusages
    13981400    ISAUsageHandler::ReadPos oldReadPos = usageHandler.getReadPos();
     1401    // old linear deps position
    13991402    rvu = usageHandler.nextUsage();
    14001403   
     
    14571460        }
    14581461        ++cbit;
     1462    }
     1463   
     1464    // fillup linear dep position in code blocks
     1465    linDepHandler.rewind();
     1466    cbit = codeBlocks.begin();
     1467   
     1468    if (linDepHandler.hasNext())
     1469    {
     1470        AsmRegVarLinearDep linDep;
     1471        size_t oldLDReadPos = linDepHandler.getReadPos();
     1472        // old linear deps position
     1473        linDep = linDepHandler.nextLinearDep();
     1474       
     1475        while (true)
     1476        {
     1477            while (cbit != codeBlocks.end() && cbit->end <= linDep.offset)
     1478            {
     1479                cbit->linearDepPos = oldLDReadPos;
     1480                ++cbit;
     1481            }
     1482            if (cbit == codeBlocks.end())
     1483                break;
     1484            // skip linDep's before codeblock
     1485            while (linDep.offset < cbit->start && linDepHandler.hasNext())
     1486            {
     1487                oldLDReadPos = linDepHandler.getReadPos();
     1488                linDep = linDepHandler.nextLinearDep();
     1489            }
     1490            if (linDep.offset < cbit->start)
     1491                break;
     1492           
     1493            cbit->linearDepPos = oldLDReadPos;
     1494            while (linDep.offset < cbit->end && linDepHandler.hasNext())
     1495            {
     1496                oldLDReadPos = linDepHandler.getReadPos();
     1497                linDep = linDepHandler.nextLinearDep();
     1498            }
     1499            ++cbit;
     1500        }
    14591501    }
    14601502   
  • CLRadeonExtender/trunk/tests/amdasm/AsmRegAlloc.cpp

    r4019 r4172  
    148148    regAlloc.createCodeStructure(section.codeFlow, section.getSize(),
    149149                            section.content.data());
    150     regAlloc.createSSAData(*section.usageHandler);
     150    regAlloc.createSSAData(*section.usageHandler, *section.linearDepHandler);
    151151   
    152152    const std::vector<CodeBlock>& resCodeBlocks = regAlloc.getCodeBlocks();
  • CLRadeonExtender/trunk/tests/amdasm/AsmRegAlloc3.cpp

    r4165 r4172  
    29292929    regAlloc.createCodeStructure(section.codeFlow, section.getSize(),
    29302930                            section.content.data());
    2931     regAlloc.createSSAData(*section.usageHandler);
     2931    regAlloc.createSSAData(*section.usageHandler, *section.linearDepHandler);
    29322932    regAlloc.applySSAReplaces();
    2933     regAlloc.createLivenesses(*section.usageHandler);
     2933    regAlloc.createLivenesses(*section.usageHandler, *section.linearDepHandler);
    29342934   
    29352935    std::ostringstream oss;
Note: See TracChangeset for help on using the changeset viewer.