Changeset 3786 in CLRX


Ignore:
Timestamp:
Feb 13, 2018, 11:24:10 PM (17 months ago)
Author:
matszpk
Message:

CLRadeonExtender: Asm: Keep unevaluated expression of symbol after setting symbol value, and use this expression to resolve values.

Location:
CLRadeonExtender/trunk
Files:
2 edited

Legend:

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

    r3785 r3786  
    169169    cxuint regRange:1;          ///< if symbol is register range
    170170    cxuint detached:1;
     171    cxuint withUnevalExpr:1;
    171172    uint64_t value;         ///< value of symbol
    172173    uint64_t size;          ///< size of symbol
     
    183184            refCount(1), sectionId(ASMSECT_ABS), info(0), other(0), hasValue(false),
    184185            onceDefined(_onceDefined), resolving(false), base(false), snapshot(false),
    185             regRange(false), detached(false), value(0), size(0), expression(nullptr)
     186            regRange(false), detached(false), withUnevalExpr(false),
     187            value(0), size(0), expression(nullptr)
    186188    { }
    187189    /// constructor with expression
     
    189191            refCount(1), sectionId(ASMSECT_ABS), info(0), other(0), hasValue(false),
    190192            onceDefined(_onceDefined), resolving(false), base(_base),
    191             snapshot(false), regRange(false), detached(false),
     193            snapshot(false), regRange(false), detached(false), withUnevalExpr(false),
    192194            value(0), size(0), expression(expr)
    193195    { }
     
    196198            refCount(1), sectionId(_sectionId), info(0), other(0), hasValue(true),
    197199            onceDefined(_onceDefined), resolving(false), base(false), snapshot(false),
    198             regRange(false), detached(false), value(_value), size(0), expression(nullptr)
     200            regRange(false), detached(false), withUnevalExpr(false),
     201            value(_value), size(0), expression(nullptr)
    199202    { }
    200203    /// destructor
  • CLRadeonExtender/trunk/amdasm/Assembler.cpp

    r3785 r3786  
    13931393void Assembler::createTempSymEntryIfNeeded(AsmSymbolEntry& symEntry)
    13941394{
    1395     if (symEntry.second.expression != nullptr &&
    1396                 symEntry.second.expression->getSymOccursNum()!=0)
     1395    if (symEntry.second.expression != nullptr && (
     1396        (symEntry.second.withUnevalExpr && !sectionDiffsPrepared) ||
     1397                symEntry.second.expression->getSymOccursNum()!=0))
    13971398    {   // create new symbol with this expression
    13981399        std::unique_ptr<AsmSymbolEntry> newSymEntry(new AsmSymbolEntry(symEntry.first,
     
    14201421    symEntry.second.regRange = false;
    14211422    symEntry.second.base = false;
     1423    symEntry.second.withUnevalExpr = false;
    14221424    if (!symEntry.second.hasValue) // if not resolved we just return
    14231425        return true; // no error
     
    14641466                    {   // try later if can not be evaluated
    14651467                        unevalExpressions.push_back(occurrence.expression);
     1468                        if (target.type==ASMXTGT_SYMBOL)
     1469                            target.symbol->second.withUnevalExpr = true;
    14661470                        // but still good
    14671471                        continue;
     
    14881492                        curSymEntry.second.value = value;
    14891493                        curSymEntry.second.sectionId = sectionId;
     1494                        curSymEntry.second.withUnevalExpr = false;
    14901495                        curSymEntry.second.hasValue =
    14911496                            isResolvableSection(sectionId) || resolvingRelocs;
     
    16801685        expr->setTarget(AsmExprTarget::symbolTarget(&symEntry));
    16811686        if (expr->getSymOccursNum() == 0)
     1687        {
    16821688            unevalExpressions.push_back(expr.get());
     1689            symEntry.second.withUnevalExpr = true;
     1690        }
     1691        else
     1692            symEntry.second.withUnevalExpr = false;
    16831693        symEntry.second.expression = expr.release();
    16841694        symEntry.second.regRange = symEntry.second.hasValue = false;
Note: See TracChangeset for help on using the changeset viewer.