Changeset 2583 in CLRX


Ignore:
Timestamp:
Nov 21, 2016, 5:50:36 PM (4 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Update AsmROCmFormat.

Location:
CLRadeonExtender/trunk
Files:
4 edited

Legend:

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

    r2582 r2583  
    435435    {
    436436        cxuint defaultSection;
     437        Flags allocRegFlags;
     438        bool useConfig;
     439        cxuint ctrlDirSection;
     440        cxuint savedSection;
    437441        cxuint allocRegs[2];
    438         Flags allocRegFlags;
    439442    };
    440443    std::vector<Kernel> kernelStates;
  • CLRadeonExtender/trunk/CLRX/amdasm/Assembler.h

    r2582 r2583  
    674674    friend struct AsmAmdPseudoOps; // INTERNAL LOGIC
    675675    friend struct AsmAmdCL2PseudoOps; // INTERNAL LOGIC
     676    friend struct AsmROCmPseudoOps; // INTERNAL LOGIC
    676677    friend struct GCNAsmUtils; // INTERNAL LOGIC
    677678
  • CLRadeonExtender/trunk/amdasm/AsmInternals.h

    r2492 r2583  
    519519};
    520520
     521enum ROCmConfigValueTarget
     522{
     523};
     524
     525struct CLRX_INTERNAL AsmROCmPseudoOps: AsmPseudoOps
     526{
     527    static bool checkPseudoOpName(const CString& string);
     528   
     529    /* user configuration pseudo-ops */
     530    static void doConfig(AsmROCmHandler& handler, const char* pseudoOpPlace,
     531                      const char* linePtr);
     532   
     533    static void setConfigValue(AsmROCmHandler& handler, const char* pseudoOpPlace,
     534                      const char* linePtr, ROCmConfigValueTarget target);
     535   
     536    static void setConfigBoolValue(AsmROCmHandler& handler, const char* pseudoOpPlace,
     537                      const char* linePtr, ROCmConfigValueTarget target);
     538   
     539    static void setDimensions(AsmROCmHandler& handler, const char* pseudoOpPlace,
     540                      const char* linePtr);
     541   
     542    static void doKCode(AsmROCmHandler& handler, const char* pseudoOpPlace,
     543                      const char* linePtr);
     544    static void doKCodeEnd(AsmROCmHandler& handler, const char* pseudoOpPlace,
     545                      const char* linePtr);
     546    static void updateKCodeSel(AsmROCmHandler& handler,
     547                      const std::vector<cxuint>& oldset);
     548};
     549
    521550extern CLRX_INTERNAL cxbyte cstrtobyte(const char*& str, const char* end);
    522551
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r2582 r2583  
    3030using namespace CLRX;
    3131
     32static const char* rocmPseudoOpNamesTbl[] =
     33{
     34    "config", "debugmode", "dims", "dx10clamp",
     35    "exceptions", "floatmode",
     36    "ieeemode", "kcode", "kcodeend",
     37    "localsize", "pgmrsrc1", "pgmrsrc2", "priority",
     38    "privmode", "scratchbuffer", "sgprsnum", "tgsize",
     39    "userdatanum", "vgprsnum"
     40};
     41
     42
    3243/*
    3344 * ROCm format handler
     
    5364    /// add kernel config section
    5465    sections.push_back({ thisKernel, AsmSectionType::CONFIG, ELFSECTID_UNDEF, nullptr });
    55     kernelStates.push_back({ thisSection, false, 0 });
     66    kernelStates.push_back({ thisSection, 0, false, ASMSECT_NONE, thisSection });
    5667   
    5768    if (assembler.currentKernel == ASMKERN_GLOBAL)
     
    6778    const cxuint thisSection = sections.size();
    6879    Section section;
    69     section.kernelId = ASMKERN_GLOBAL;  // we ignore input kernelId, we go to main
    70    
     80    if (::strcmp(sectionName, ".control_directive") == 0)
     81    {
     82        if (kernelId == ASMKERN_GLOBAL)
     83            throw AsmFormatException(".control_directive section must be "
     84                        "defined inside kernel");
     85        if (kernelStates[kernelId].ctrlDirSection != ASMSECT_NONE)
     86            throw AsmFormatException("Only one section "
     87                        "'.control_directive' can be in kernel");
     88        kernelStates[kernelId].ctrlDirSection = thisSection;
     89        section.type = AsmSectionType::ROCM_CONFIG_CTRL_DIRECTIVE;
     90        section.elfBinSectId = ELFSECTID_TEXT; // . in text
     91        section.name = ".control_directive";
     92    }
     93    else // otherwise
     94        section.kernelId = ASMKERN_GLOBAL;  // we ignore input kernelId, we go to main
     95       
    7196    if (::strcmp(sectionName, ".text") == 0) // code
    7297    {
     
    111136    else if (::strcmp(sectionName, ".comment") == 0) // comment
    112137        return commentSection;
     138    else if (assembler.currentKernel != ASMKERN_GLOBAL &&
     139        ::strcmp(sectionName, ".control_directive") == 0) // code
     140        return kernelStates[assembler.currentKernel].ctrlDirSection;
    113141    else
    114142    {
     
    127155    if (assembler.currentKernel == ASMKERN_GLOBAL)
    128156        savedSection = assembler.currentSection;
     157    else // if kernel
     158        kernelStates[assembler.currentKernel].savedSection = assembler.currentSection;
    129159   
    130160    assembler.currentKernel = kernel;
    131161    if (kernel != ASMKERN_GLOBAL)
    132         assembler.currentSection = kernelStates[kernel].defaultSection;
     162        assembler.currentSection = kernelStates[kernel].savedSection;
    133163    else // default main section
    134164        assembler.currentSection = savedSection;
     
    142172    if (assembler.currentKernel == ASMKERN_GLOBAL)
    143173        savedSection = assembler.currentSection;
     174    else // if kernel
     175        kernelStates[assembler.currentKernel].savedSection = assembler.currentSection;
    144176   
    145177    assembler.currentSection = sectionId;
     
    210242}
    211243
     244namespace CLRX
     245{
     246
     247bool AsmROCmPseudoOps::checkPseudoOpName(const CString& string)
     248{
     249    return false;
     250}
     251   
     252/* user configuration pseudo-ops */
     253void AsmROCmPseudoOps::doConfig(AsmROCmHandler& handler, const char* pseudoOpPlace,
     254                  const char* linePtr)
     255{
     256}
     257
     258void AsmROCmPseudoOps::setConfigValue(AsmROCmHandler& handler, const char* pseudoOpPlace,
     259                  const char* linePtr, ROCmConfigValueTarget target)
     260{
     261}
     262
     263void AsmROCmPseudoOps::setConfigBoolValue(AsmROCmHandler& handler,
     264          const char* pseudoOpPlace, const char* linePtr, ROCmConfigValueTarget target)
     265{
     266}
     267
     268void AsmROCmPseudoOps::setDimensions(AsmROCmHandler& handler, const char* pseudoOpPlace,
     269                  const char* linePtr)
     270{
     271}
     272
     273void AsmROCmPseudoOps::doKCode(AsmROCmHandler& handler, const char* pseudoOpPlace,
     274                  const char* linePtr)
     275{
     276}
     277
     278void AsmROCmPseudoOps::doKCodeEnd(AsmROCmHandler& handler, const char* pseudoOpPlace,
     279                  const char* linePtr)
     280{
     281}
     282
     283void AsmROCmPseudoOps::updateKCodeSel(AsmROCmHandler& handler,
     284                  const std::vector<cxuint>& oldset)
     285{
     286}
     287
     288}
    212289
    213290bool AsmROCmHandler::prepareBinary()
Note: See TracChangeset for help on using the changeset viewer.