Changeset 3285 in CLRX


Ignore:
Timestamp:
Sep 2, 2017, 6:45:41 AM (5 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmGallium?: Add '.arch_minor' and '.arch_stepping' pseudo-ops.

Location:
CLRadeonExtender/trunk
Files:
3 edited

Legend:

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

    r3280 r3285  
    422422    cxuint defaultLLVMVersion;
    423423   
     424    uint32_t archMinor;
     425    uint32_t archStepping;
     426   
    424427    void restoreKcodeCurrentAllocRegs();
    425428    void saveKcodeCurrentAllocRegs();
  • CLRadeonExtender/trunk/amdasm/AsmGalliumFormat.cpp

    r3284 r3285  
    3535static const char* galliumPseudoOpNamesTbl[] =
    3636{
     37    "arch_minor", "arch_stepping",
    3738    "arg", "args", "call_convention", "codeversion",
    3839    "config", "control_directive",
     
    7576enum
    7677{
    77     GALLIUMOP_ARG = 0, GALLIUMOP_ARGS, GALLIUMOP_CALL_CONVENTION, GALLIUMOP_CODEVERSION,
     78    GALLIUMOP_ARCH_MINOR = 0, GALLIUMOP_ARCH_STEPPING,
     79    GALLIUMOP_ARG, GALLIUMOP_ARGS, GALLIUMOP_CALL_CONVENTION, GALLIUMOP_CODEVERSION,
    7880    GALLIUMOP_CONFIG, GALLIUMOP_CONTROL_DIRECTIVE,
    7981    GALLIUMOP_DEBUG_PRIVATE_SEGMENT_BUFFER_SGPR,
     
    149151AsmGalliumHandler::AsmGalliumHandler(Assembler& assembler): AsmFormatHandler(assembler),
    150152             output{}, codeSection(0), dataSection(ASMSECT_NONE),
    151              commentSection(ASMSECT_NONE), extraSectionCount(0)
     153             commentSection(ASMSECT_NONE), extraSectionCount(0),
     154             archMinor(BINGEN_DEFAULT), archStepping(BINGEN_DEFAULT)
    152155{
    153156    assembler.currentKernel = ASMKERN_GLOBAL;
     
    376379               CStringLess()) - galliumPseudoOpNamesTbl;
    377380    return pseudoOp < sizeof(galliumPseudoOpNamesTbl)/sizeof(char*);
     381}
     382
     383void AsmGalliumPseudoOps::setArchMinor(AsmGalliumHandler& handler, const char* linePtr)
     384{
     385    Assembler& asmr = handler.assembler;
     386    const char* end = asmr.line + asmr.lineSize;
     387    skipSpacesToEnd(linePtr, end);
     388    uint64_t value;
     389    const char* valuePlace = linePtr;
     390    if (!getAbsoluteValueArg(asmr, value, linePtr, true))
     391        return;
     392    asmr.printWarningForRange(sizeof(cxuint)<<3, value,
     393                 asmr.getSourcePos(valuePlace), WS_UNSIGNED);
     394    if (!checkGarbagesAtEnd(asmr, linePtr))
     395        return;
     396    handler.archMinor = value;
     397}
     398
     399void AsmGalliumPseudoOps::setArchStepping(AsmGalliumHandler& handler, const char* linePtr)
     400{
     401    Assembler& asmr = handler.assembler;
     402    const char* end = asmr.line + asmr.lineSize;
     403    skipSpacesToEnd(linePtr, end);
     404    uint64_t value;
     405    const char* valuePlace = linePtr;
     406    if (!getAbsoluteValueArg(asmr, value, linePtr, true))
     407        return;
     408    asmr.printWarningForRange(sizeof(cxuint)<<3, value,
     409                 asmr.getSourcePos(valuePlace), WS_UNSIGNED);
     410    if (!checkGarbagesAtEnd(asmr, linePtr))
     411        return;
     412    handler.archStepping = value;
    378413}
    379414
     
    16211656    switch(pseudoOp)
    16221657    {
     1658        case GALLIUMOP_ARCH_MINOR:
     1659            AsmGalliumPseudoOps::setArchMinor(*this, linePtr);
     1660            break;
     1661        case GALLIUMOP_ARCH_STEPPING:
     1662            AsmGalliumPseudoOps::setArchStepping(*this, linePtr);
     1663            break;
    16231664        case GALLIUMOP_ARG:
    16241665            AsmGalliumPseudoOps::doArg(*this, stmtPlace, linePtr);
     
    21092150    AMDGPUArchValues amdGpuArchValues = galliumAmdGpuArchValuesTbl[
    21102151                    cxuint(assembler.deviceType)];
     2152    if (archMinor != BINGEN_DEFAULT)
     2153        amdGpuArchValues.minor = archMinor;
     2154    if (archStepping != BINGEN_DEFAULT)
     2155        amdGpuArchValues.stepping = archStepping;
    21112156    AsmSection& asmCSection = assembler.sections[codeSection];
    21122157    const AsmSymbolMap& symbolMap = assembler.getSymbolMap();
  • CLRadeonExtender/trunk/amdasm/AsmInternals.h

    r3280 r3285  
    370370    static bool checkPseudoOpName(const CString& string);
    371371   
     372    static void setArchMinor(AsmGalliumHandler& handler, const char* linePtr);
     373    static void setArchStepping(AsmGalliumHandler& handler, const char* linePtr);
     374   
    372375    static void doControlDirective(AsmGalliumHandler& handler, const char* pseudoOpPlace,
    373376                      const char* linePtr);
Note: See TracChangeset for help on using the changeset viewer.