Changeset 3774 in CLRX


Ignore:
Timestamp:
Feb 12, 2018, 9:00:05 PM (14 months ago)
Author:
matszpk
Message:

CLRadeonExtender: Asm: Working section diffs comparison on expressions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/AsmExpression.cpp

    r3772 r3774  
    147147}
    148148
     149static void convertRelSpaces(const RelMultiply& relative,
     150        RelMultiply& relSpace, const std::vector<AsmSection>& sections,
     151        const std::vector<Array<cxuint> >& relSpacesSects, uint64_t fixAddr1)
     152{
     153    if (sections[relative.sectionId].relSpace != UINT_MAX)
     154    {
     155        cxuint osectId = relative.sectionId;
     156        relSpace = { relative.multiply, sections[osectId].relSpace };
     157        if (!relSpacesSects.empty())
     158        {
     159            cxuint rsectId = relSpacesSects[sections[osectId].relSpace][0];
     160            fixAddr1 += relative.multiply*(sections[osectId].relAddress -
     161                    sections[rsectId].relAddress);
     162        }
     163    }
     164    else // treat as separate relSpace
     165        relSpace = { relative.multiply, 0x80000000U | relative.sectionId };
     166}
     167
    149168static bool checkRelativesEquality(Assembler& assembler,
    150169            std::vector<RelMultiply>& relatives,
     
    188207    // convert sections to relspaces
    189208    for (size_t i = 0; i < relSpaces1.size(); i++)
    190         if (sections[relatives[i].sectionId].relSpace != UINT_MAX)
    191         {
    192             cxuint osectId = relatives[i].sectionId;
    193             relSpaces1[i] = { relatives[i].multiply,
    194                     sections[osectId].relSpace };
    195             cxuint rsectId = relSpacesSects[sections[osectId].relSpace][0];
    196             fixAddr1 = relatives[i].multiply*(sections[osectId].relAddress -
    197                     sections[rsectId].relAddress);
    198         }
    199         else // treat as separate relSpace
    200             relSpaces1[i] = { relatives[i].multiply,
    201                     0x80000000 | relatives[i].sectionId };
     209        convertRelSpaces(relatives[i], relSpaces1[i], sections, relSpacesSects, fixAddr1);
    202210   
    203211    for (size_t i = 0; i < relSpaces2.size(); i++)
    204         if (sections[relatives2[i].sectionId].relSpace != UINT_MAX)
    205         {
    206             cxuint osectId = relatives2[i].sectionId;
    207             relSpaces1[i] = { relatives2[i].multiply,
    208                     sections[osectId].relSpace };
    209             cxuint rsectId = relSpacesSects[sections[osectId].relSpace][0];
    210             fixAddr1 = relatives2[i].multiply*(sections[osectId].relAddress -
    211                     sections[rsectId].relAddress);
    212         }
    213         else // treat as separate relSpace
    214             relSpaces2[i] = { relatives2[i].multiply,
    215                     0x80000000 | relatives2[i].sectionId };
     212        convertRelSpaces(relatives2[i], relSpaces2[i], sections, relSpacesSects, fixAddr2);
    216213   
    217214    // sort
Note: See TracChangeset for help on using the changeset viewer.