Changeset 1661 in CLRX


Ignore:
Timestamp:
Nov 5, 2015, 10:24:00 PM (5 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Silly bug, with resolving symbol, that was assignment resolved expression.
Added symbol with register ranges.

Location:
CLRadeonExtender/trunk
Files:
3 edited

Legend:

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

    r1616 r1661  
    128128    /// fill alignment when value is not given
    129129    virtual void fillAlignment(size_t size, cxbyte* output) = 0;
     130    /// parse register range
     131    virtual bool parseRegisterRange(const char*& linePtr,
     132                        cxuint& regStart, cxuint& regEnd) = 0;
    130133};
    131134
     
    161164    const cxuint* getAllocatedRegisters(size_t& regTypesNum, Flags& regFlags) const;
    162165    void fillAlignment(size_t size, cxbyte* output);
     166    bool parseRegisterRange(const char*& linePtr, cxuint& regStart, cxuint& regEnd);
    163167};
    164168
     
    243247    cxuint base:1;              ///< with base expression
    244248    cxuint snapshot:1;          ///< if symbol is snapshot
     249    cxuint regRange:1;          ///< if symbol is register range
    245250    uint64_t value;         ///< value of symbol
    246251    uint64_t size;          ///< size of symbol
  • CLRadeonExtender/trunk/amdasm/Assembler.cpp

    r1611 r1661  
    819819{
    820820    symEntry.second.value = value;
     821    symEntry.second.expression = nullptr;
    821822    symEntry.second.sectionId = sectionId;
    822823    symEntry.second.hasValue = true;
     
    858859                    {    // resolve symbol
    859860                        AsmSymbolEntry& curSymEntry = *target.symbol;
    860                         if (!curSymEntry.second.resolving)
     861                        if (!curSymEntry.second.resolving &&
     862                            curSymEntry.second.expression==expr)
    861863                        {
    862864                            curSymEntry.second.value = value;
     
    952954             const char* linePtr, bool reassign, bool baseExpr)
    953955{
     956    if (linePtr!=line+lineSize && *linePtr=='%')
     957    {
     958        initializeOutputFormat();
     959        ++linePtr;
     960        cxuint regStart, regEnd;
     961        if (!isaAssembler->parseRegisterRange(linePtr, regStart, regEnd))
     962            return false;
     963       
     964        std::pair<AsmSymbolMap::iterator, bool> res =
     965                symbolMap.insert(std::make_pair(symbolName, AsmSymbol()));
     966        if (!res.second && ((res.first->second.onceDefined || !reassign) &&
     967            res.first->second.isDefined()))
     968        {   // found and can be only once defined
     969            printError(symbolPlace, (std::string("Symbol '") + symbolName.c_str() +
     970                        "' is already defined").c_str());
     971            return false;
     972        }
     973        AsmSymbolEntry& symEntry = *res.first;
     974        symEntry.second.expression = nullptr;
     975        symEntry.second.onceDefined = !reassign;
     976        symEntry.second.regRange = symEntry.second.hasValue = true;
     977        symEntry.second.value = (regStart | (uint64_t(regEnd)<<32));
     978    }
     979       
    954980    const char* exprPlace = linePtr;
    955981    // make base expr if baseExpr=true and symbolName is not output counter
  • CLRadeonExtender/trunk/amdasm/GCNAssembler.cpp

    r1571 r1661  
    28102810    std::fill((uint32_t*)output, ((uint32_t*)output) + (size>>2), value);
    28112811}
     2812
     2813bool GCNAssembler::parseRegisterRange(const char*& linePtr, cxuint& regStart,
     2814          cxuint& regEnd)
     2815{
     2816    GCNOperand operand;
     2817    if (!GCNAsmUtils::parseOperand(assembler, linePtr, operand, nullptr, curArchMask, 0,
     2818                INSTROP_SREGS|INSTROP_VREGS))
     2819        return false;
     2820    regStart = operand.range.start;
     2821    regEnd = operand.range.end;
     2822    return true;
     2823}
Note: See TracChangeset for help on using the changeset viewer.