Changeset 3740 in CLRX


Ignore:
Timestamp:
Feb 7, 2018, 4:29:59 PM (17 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmROCm: Accept '.arg' without access qualifiers (use default access qualifier if not included).
Asm: Add errorWhenNoEnd to skipComma.

Location:
CLRadeonExtender/trunk/amdasm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/AsmInternals.h

    r3632 r3740  
    121121   
    122122    // skip comma
    123     static bool skipComma(Assembler& asmr, bool& haveComma, const char*& linePtr);
     123    // errorWhenNoEnd - print error if not end and not comma
     124    static bool skipComma(Assembler& asmr, bool& haveComma, const char*& linePtr,
     125                    bool errorWhenNoEnd = true);
    124126    // skip required comma, (returns false if not found comma)
    125127    static bool skipRequiredComma(Assembler& asmr, const char*& linePtr);
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r3739 r3740  
    962962    }
    963963   
    964     bool haveComma = false;
    965964    cxuint addressSpaceVal = 0;
    966965    if (valueKindVal == cxuint(ROCmValueKind::DYN_SHARED_PTR) ||
    967966        valueKindVal == cxuint(ROCmValueKind::GLOBAL_BUFFER))
    968967    {
    969         if (!skipComma(asmr, haveComma, linePtr))
     968        if (!skipRequiredComma(asmr, linePtr))
    970969            return;
    971970        // parse address space
    972         if (haveComma)
    973             good &= getEnumeration(asmr, linePtr, "address space",
    974                         6, rocmAddressSpaceNamesTbl, addressSpaceVal, nullptr);
    975     }
    976    
     971        good &= getEnumeration(asmr, linePtr, "address space",
     972                    6, rocmAddressSpaceNamesTbl, addressSpaceVal, nullptr);
     973    }
     974   
     975    bool haveComma = false;
    977976    cxuint accessQualVal = 0;
    978977    if (valueKindVal == cxuint(ROCmValueKind::IMAGE) ||
    979978        valueKindVal == cxuint(ROCmValueKind::PIPE))
    980979    {
    981         if (!skipComma(asmr, haveComma, linePtr))
     980        if (!skipComma(asmr, haveComma, linePtr, false))
    982981            return;
    983982        // parse access qualifier
     
    991990        valueKindVal == cxuint(ROCmValueKind::PIPE))
    992991    {
    993         if (!skipComma(asmr, haveComma, linePtr))
     992        if (!skipComma(asmr, haveComma, linePtr, false))
    994993            return;
    995994        // parse actual access qualifier
  • CLRadeonExtender/trunk/amdasm/Assembler.cpp

    r3629 r3740  
    427427
    428428// skip comma (can be not present), return true in haveComma if ',' encountered
    429 bool AsmParseUtils::skipComma(Assembler& asmr, bool& haveComma, const char*& linePtr)
     429bool AsmParseUtils::skipComma(Assembler& asmr, bool& haveComma, const char*& linePtr,
     430                        bool errorWhenNoEnd)
    430431{
    431432    const char* end = asmr.line + asmr.lineSize;
     
    437438    }
    438439    if (*linePtr != ',')
    439         ASM_FAIL_BY_ERROR(linePtr, "Expected ',' before argument")
     440    {
     441        if (errorWhenNoEnd)
     442            ASM_FAIL_BY_ERROR(linePtr, "Expected ',' before argument")
     443        else
     444        {
     445            haveComma = false;
     446            return true;
     447        }
     448    }
    440449    linePtr++;
    441450    haveComma = true;
Note: See TracChangeset for help on using the changeset viewer.