Changeset 3338 in CLRX


Ignore:
Timestamp:
Sep 8, 2017, 1:21:58 PM (13 months ago)
Author:
matszpk
Message:

CLRadeonExtender: Asm: Vast killing code lines by using macros PSEUDOOP_RETURN_BY_ERROR, ASM_RETURN_BY_ERROR and ASM_FAIL_BY_ERROR.

Location:
CLRadeonExtender/trunk/amdasm
Files:
6 edited

Legend:

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

    r3337 r3338  
    476476    const CString symName = extractScopedSymName(linePtr, end, false);
    477477    if (symName.empty())
    478     {
    479         asmr.printError(symNamePlace, "Illegal symbol name");
    480         return;
    481     }
     478        ASM_RETURN_BY_ERROR(symNamePlace, "Illegal symbol name")
    482479    size_t symNameLength = symName.size();
    483480    if (symNameLength >= 3 && symName.compare(symNameLength-3, 3, "::.")==0)
    484     {
    485         asmr.printError(symNamePlace, "Symbol '.' can be only in global scope");
    486         return;
    487     }
     481        ASM_RETURN_BY_ERROR(symNamePlace, "Symbol '.' can be only in global scope")
    488482    if (!checkGarbagesAtEnd(asmr, linePtr))
    489483        return;
     
    528522    Assembler& asmr = handler.assembler;
    529523    if (handler.getDriverVersion() < 191205)
    530     {
    531         asmr.printError(pseudoOpPlace, "Global Data allowed only for new binary format");
    532         return;
    533     }
     524        PSEUDOOP_RETURN_BY_ERROR("Global Data allowed only for new binary format")
    534525    if (!checkGarbagesAtEnd(asmr, linePtr))
    535526        return;
     
    551542   
    552543    if (handler.getDriverVersion() < 191205)
    553     {
    554         asmr.printError(pseudoOpPlace, "Global RWData allowed only for new binary format");
    555         return;
    556     }
     544        PSEUDOOP_RETURN_BY_ERROR("Global RWData allowed only for new binary format")
    557545    if (!checkGarbagesAtEnd(asmr, linePtr))
    558546        return;
     
    575563   
    576564    if (handler.getDriverVersion() < 191205)
    577     {
    578         asmr.printError(pseudoOpPlace, "Global BSS allowed only for new binary format");
    579         return;
    580     }
     565        PSEUDOOP_RETURN_BY_ERROR("Global BSS allowed only for new binary format")
    581566   
    582567    uint64_t sectionAlign = 0;
     
    629614    Assembler& asmr = handler.assembler;
    630615    if (handler.getDriverVersion() < 191205)
    631     {
    632         asmr.printError(pseudoOpPlace, "SamplerInit allowed only for new binary format");
    633         return;
    634     }
     616        PSEUDOOP_RETURN_BY_ERROR("SamplerInit allowed only for new binary format")
    635617    if (handler.output.samplerConfig)
    636     {   // error
    637         asmr.printError(pseudoOpPlace,
    638                 "SamplerInit is illegal if sampler definitions are present");
    639         return;
    640     }
     618        PSEUDOOP_RETURN_BY_ERROR("SamplerInit is illegal if sampler "
     619                    "definitions are present")
    641620    if (!checkGarbagesAtEnd(asmr, linePtr))
    642621        return;
     
    658637    if (asmr.currentKernel!=ASMKERN_GLOBAL && asmr.currentKernel!=ASMKERN_INNER &&
    659638        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    660     {
    661         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    662         return;
    663     }
     639        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op");
    664640    if (handler.getDriverVersion() < 191205)
    665     {
    666         asmr.printError(pseudoOpPlace, "Sampler allowed only for new binary format");
    667         return;
    668     }
     641        PSEUDOOP_RETURN_BY_ERROR("Sampler allowed only for new binary format")
    669642   
    670643    bool inMain = asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER;
     
    691664    {   // global sampler definitions
    692665        if (handler.samplerInitSection!=ASMSECT_NONE)
    693         {   // error
    694             asmr.printError(pseudoOpPlace,
    695                     "Illegal sampler definition if samplerinit was defined");
    696             return;
    697         }
     666            PSEUDOOP_RETURN_BY_ERROR("Illegal sampler definition if "
     667                    "samplerinit was defined")
    698668        handler.output.samplerConfig = true;
    699669        if (linePtr == end)
     
    720690   
    721691    if (asmr.currentKernel!=ASMKERN_GLOBAL && asmr.currentKernel!=ASMKERN_INNER)
    722     {
    723         asmr.printError(pseudoOpPlace, "Illegal place of samplerreloc pseudo-op");
    724         return;
    725     }
     692        PSEUDOOP_RETURN_BY_ERROR("Illegal place of samplerreloc pseudo-op")
    726693    if (handler.getDriverVersion() < 191205)
    727     {
    728         asmr.printError(pseudoOpPlace, "SamplerReloc allowed only for new binary format");
    729         return;
    730     }
     694        PSEUDOOP_RETURN_BY_ERROR("SamplerReloc allowed only for new binary format")
    731695   
    732696    skipSpacesToEnd(linePtr, end);
     
    743707   
    744708    if (sectionId != ASMSECT_ABS && sectionId != handler.rodataSection)
    745     {
    746         asmr.printError(offsetPlace, "Offset can be an absolute value "
    747                     "or globaldata place");
    748         return;
    749     }
     709        ASM_RETURN_BY_ERROR(offsetPlace, "Offset can be an absolute value "
     710                        "or globaldata place")
    750711    // put to sampler offsets
    751712    if (handler.output.samplerOffsets.size() <= samplerId)
     
    759720    Assembler& asmr = handler.assembler;
    760721    if (asmr.currentKernel==ASMKERN_GLOBAL)
    761     {
    762         asmr.printError(pseudoOpPlace, "Kernel control directive can be defined "
    763                     "only inside kernel");
    764         return;
    765     }
     722        PSEUDOOP_RETURN_BY_ERROR("Kernel control directive can be defined "
     723                    "only inside kernel")
    766724    AsmAmdCL2Handler::Kernel& kernel = *handler.kernelStates[asmr.currentKernel];
    767725    if (kernel.metadataSection!=ASMSECT_NONE || kernel.isaMetadataSection!=ASMSECT_NONE ||
    768726        kernel.setupSection!=ASMSECT_NONE || kernel.stubSection!=ASMSECT_NONE)
    769     {
    770         asmr.printError(pseudoOpPlace, "Control directive "
    771             "can't be defined if metadata,header,setup,stub section exists");
    772         return;
    773     }
     727        PSEUDOOP_RETURN_BY_ERROR("Control directive "
     728            "can't be defined if metadata,header,setup,stub section exists")
    774729    if (kernel.configSection != ASMSECT_NONE && !kernel.useHsaConfig)
    775     {   // control directive only if hsa config
    776         asmr.printError(pseudoOpPlace, "Config and Control directive can't be mixed");
    777         return;
    778     }
     730        // control directive only if hsa config
     731        PSEUDOOP_RETURN_BY_ERROR("Config and Control directive can't be mixed")
    779732   
    780733    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    804757    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER ||
    805758        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    806     {
    807         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    808         return;
    809     }
     759        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    810760    const bool useHsaConfig = handler.kernelStates[asmr.currentKernel]->useHsaConfig;
    811761    if (!useHsaConfig && (target >= AMDCL2CVAL_ONLY_HSA_FIRST_PARAM ||
    812762            target == AMDCL2CVAL_USERDATANUM))
    813     {
    814         asmr.printError(pseudoOpPlace, "HSAConfig pseudo-op only in HSAConfig");
    815         return;
    816     }
     763        PSEUDOOP_RETURN_BY_ERROR("HSAConfig pseudo-op only in HSAConfig")
    817764   
    818765    skipSpacesToEnd(linePtr, end);
     
    995942    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER ||
    996943        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    997     {
    998         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    999         return;
    1000     }
     944        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    1001945   
    1002946    const bool useHsaConfig = handler.kernelStates[asmr.currentKernel]->useHsaConfig;
     
    1004948        (target == AMDCL2CVAL_USESETUP || target == AMDCL2CVAL_USEARGS ||
    1005949         target == AMDCL2CVAL_USEENQUEUE || target == AMDCL2CVAL_USEGENERIC))
    1006     {
    1007         asmr.printError(pseudoOpPlace, "Illegal config pseudo-op in HSAConfig");
    1008         return;
    1009     }
     950        PSEUDOOP_RETURN_BY_ERROR("Illegal config pseudo-op in HSAConfig")
    1010951    if (!useHsaConfig && target >= AMDCL2CVAL_ONLY_HSA_FIRST_PARAM)
    1011     {
    1012         asmr.printError(pseudoOpPlace, "HSAConfig pseudo-op only in HSAConfig");
    1013         return;
    1014     }
     952        PSEUDOOP_RETURN_BY_ERROR("HSAConfig pseudo-op only in HSAConfig")
    1015953   
    1016954    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    10681006    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    10691007        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1070     {
    1071         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1072         return;
    1073     }
     1008        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    10741009    if (!handler.kernelStates[asmr.currentKernel]->useHsaConfig)
    1075     {
    1076         asmr.printError(pseudoOpPlace, "HSAConfig pseudo-op only in HSAConfig");
    1077         return;
    1078     }
     1010        PSEUDOOP_RETURN_BY_ERROR("HSAConfig pseudo-op only in HSAConfig")
    10791011   
    10801012    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    10941026    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER ||
    10951027        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1096     {
    1097         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1098         return;
    1099     }
     1028        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    11001029    cxuint dimMask = 0;
    11011030    if (!parseDimensions(asmr, linePtr, dimMask))
     
    11151044    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    11161045        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1117     {
    1118         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1119         return;
    1120     }
     1046        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    11211047    if (!handler.kernelStates[asmr.currentKernel]->useHsaConfig)
    1122     {
    1123         asmr.printError(pseudoOpPlace, "HSAConfig pseudo-op only in HSAConfig");
    1124         return;
    1125     }
     1048        PSEUDOOP_RETURN_BY_ERROR("HSAConfig pseudo-op only in HSAConfig")
    11261049   
    11271050    uint16_t kindValue = 0, majorValue = 0;
     
    11451068    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    11461069        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1147     {
    1148         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1149         return;
    1150     }
     1070        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    11511071    if (!handler.kernelStates[asmr.currentKernel]->useHsaConfig)
    1152     {
    1153         asmr.printError(pseudoOpPlace, "HSAConfig pseudo-op only in HSAConfig");
    1154         return;
    1155     }
     1072        PSEUDOOP_RETURN_BY_ERROR("HSAConfig pseudo-op only in HSAConfig")
    11561073   
    11571074    uint16_t majorValue = 0, minorValue = 0;
     
    11711088    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    11721089        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1173     {
    1174         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1175         return;
    1176     }
     1090        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    11771091    if (!handler.kernelStates[asmr.currentKernel]->useHsaConfig)
    1178     {
    1179         asmr.printError(pseudoOpPlace, "HSAConfig pseudo-op only in HSAConfig");
    1180         return;
    1181     }
     1092        PSEUDOOP_RETURN_BY_ERROR("HSAConfig pseudo-op only in HSAConfig")
    11821093   
    11831094    uint16_t gprFirst = 0, gprCount = 0;
     
    12061117    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    12071118        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1208     {
    1209         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1210         return;
    1211     }
     1119        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    12121120    if (!handler.kernelStates[asmr.currentKernel]->useHsaConfig)
    1213     {
    1214         asmr.printError(pseudoOpPlace, "HSAConfig pseudo-op only in HSAConfig");
    1215         return;
    1216     }
     1121        PSEUDOOP_RETURN_BY_ERROR("HSAConfig pseudo-op only in HSAConfig")
    12171122   
    12181123    cxuint dimMask = 0;
     
    12341139    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER ||
    12351140        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1236     {
    1237         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1238         return;
    1239     }
     1141        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    12401142   
    12411143    skipSpacesToEnd(linePtr, end);
     
    12551157    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER ||
    12561158        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1257     {
    1258         asmr.printError(pseudoOpPlace, "Illegal place of kernel argument");
    1259         return;
    1260     }
     1159        PSEUDOOP_RETURN_BY_ERROR("Illegal place of kernel argument")
    12611160   
    12621161    auto& kernelState = *handler.kernelStates[asmr.currentKernel];
     
    13241223    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER ||
    13251224        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1326     {
    1327         asmr.printError(pseudoOpPlace, "Illegal place of kernel argument");
    1328         return;
    1329     }
     1225        PSEUDOOP_RETURN_BY_ERROR("Illegal place of kernel argument")
    13301226   
    13311227    auto& kernelState = *handler.kernelStates[asmr.currentKernel];
    13321228    if (!kernelState.argNamesSet.empty())
    1333     {
    1334         asmr.printError(pseudoOpPlace, "SetupArgs must be as first in argument list");
    1335         return;
    1336     }
     1229        PSEUDOOP_RETURN_BY_ERROR("SetupArgs must be as first in argument list")
    13371230    if (!checkGarbagesAtEnd(asmr, linePtr))
    13381231        return;
     
    13551248   
    13561249    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER)
    1357     {
    1358         asmr.printError(pseudoOpPlace, "Metadata can be defined only inside kernel");
    1359         return;
    1360     }
     1250        PSEUDOOP_RETURN_BY_ERROR("Metadata can be defined only inside kernel")
    13611251    if (handler.kernelStates[asmr.currentKernel]->configSection!=ASMSECT_NONE)
    1362     {
    1363         asmr.printError(pseudoOpPlace,
    1364                     "Metadata can't be defined if configuration was defined");
    1365         return;
    1366     }
     1252        PSEUDOOP_RETURN_BY_ERROR("Metadata can't be defined if configuration was defined")
    13671253   
    13681254    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    13861272   
    13871273    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER)
    1388     {
    1389         asmr.printError(pseudoOpPlace, "ISAMetadata can be defined only inside kernel");
    1390         return;
    1391     }
     1274        PSEUDOOP_RETURN_BY_ERROR("ISAMetadata can be defined only inside kernel")
    13921275    if (handler.kernelStates[asmr.currentKernel]->configSection!=ASMSECT_NONE)
    1393     {
    1394         asmr.printError(pseudoOpPlace,
    1395                     "ISAMetadata can't be defined if configuration was defined");
    1396         return;
    1397     }
     1276        PSEUDOOP_RETURN_BY_ERROR("ISAMetadata can't be defined if configuration "
     1277                "was defined")
    13981278    if (handler.getDriverVersion() >= 191205)
    1399     {
    1400         asmr.printError(pseudoOpPlace, "ISA Metadata allowed only for old binary format");
    1401         return;
    1402     }
     1279        PSEUDOOP_RETURN_BY_ERROR("ISA Metadata allowed only for old binary format")
    14031280   
    14041281    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    14221299   
    14231300    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER)
    1424     {
    1425         asmr.printError(pseudoOpPlace, "Setup can be defined only inside kernel");
    1426         return;
    1427     }
     1301        PSEUDOOP_RETURN_BY_ERROR("Setup can be defined only inside kernel")
    14281302    if (handler.kernelStates[asmr.currentKernel]->configSection!=ASMSECT_NONE)
    1429     {
    1430         asmr.printError(pseudoOpPlace,
    1431                     "Setup can't be defined if configuration was defined");
    1432         return;
    1433     }
     1303        PSEUDOOP_RETURN_BY_ERROR("Setup can't be defined if configuration was defined")
    14341304   
    14351305    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    14531323   
    14541324    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER)
    1455     {
    1456         asmr.printError(pseudoOpPlace, "Stub can be defined only inside kernel");
    1457         return;
    1458     }
     1325        PSEUDOOP_RETURN_BY_ERROR("Stub can be defined only inside kernel")
    14591326    if (handler.kernelStates[asmr.currentKernel]->configSection!=ASMSECT_NONE)
    1460     {
    1461         asmr.printError(pseudoOpPlace,
    1462                     "Stub can't be defined if configuration was defined");
    1463         return;
    1464     }
     1327        PSEUDOOP_RETURN_BY_ERROR("Stub can't be defined if configuration was defined")
    14651328    if (handler.getDriverVersion() >= 191205)
    1466     {
    1467         asmr.printError(pseudoOpPlace, "Stub allowed only for old binary format");
    1468         return;
    1469     }
     1329        PSEUDOOP_RETURN_BY_ERROR("Stub allowed only for old binary format")
    14701330   
    14711331    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    14881348    Assembler& asmr = handler.assembler;
    14891349    if (asmr.currentKernel==ASMKERN_GLOBAL || asmr.currentKernel==ASMKERN_INNER)
    1490     {
    1491         asmr.printError(pseudoOpPlace, "Kernel config can be defined only inside kernel");
    1492         return;
    1493     }
     1350        PSEUDOOP_RETURN_BY_ERROR("Kernel config can be defined only inside kernel")
    14941351    AsmAmdCL2Handler::Kernel& kernel = *handler.kernelStates[asmr.currentKernel];
    14951352    if (kernel.metadataSection!=ASMSECT_NONE || kernel.isaMetadataSection!=ASMSECT_NONE ||
    14961353        kernel.setupSection!=ASMSECT_NONE || kernel.stubSection!=ASMSECT_NONE)
    1497     {
    1498         asmr.printError(pseudoOpPlace, "Config can't be defined if metadata,header,setup,"
    1499                         "stub section exists");
    1500         return;
    1501     }
     1354        PSEUDOOP_RETURN_BY_ERROR("Config can't be defined if metadata,header,setup,"
     1355                        "stub section exists")
    15021356    if (kernel.configSection != ASMSECT_NONE && kernel.useHsaConfig != hsaConfig)
    1503     {   // if config defined and doesn't match type of config
    1504         asmr.printError(pseudoOpPlace, "Config and HSAConfig can't be mixed");
    1505         return;
    1506     }
     1357        // if config defined and doesn't match type of config
     1358        PSEUDOOP_RETURN_BY_ERROR("Config and HSAConfig can't be mixed")
    15071359   
    15081360    if (!checkGarbagesAtEnd(asmr, linePtr))
  • CLRadeonExtender/trunk/amdasm/AsmAmdFormat.cpp

    r3337 r3338  
    332332    const CString symName = extractScopedSymName(linePtr, end, false);
    333333    if (symName.empty())
    334     {
    335         asmr.printError(symNamePlace, "Illegal symbol name");
    336         return;
    337     }
     334        ASM_RETURN_BY_ERROR(symNamePlace, "Illegal symbol name")
    338335    size_t symNameLength = symName.size();
    339336    if (symNameLength >= 3 && symName.compare(symNameLength-3, 3, "::.")==0)
    340     {
    341         asmr.printError(symNamePlace, "Symbol '.' can be only in global scope");
    342         return;
    343     }
     337        ASM_RETURN_BY_ERROR(symNamePlace, "Symbol '.' can be only in global scope")
    344338    if (!checkGarbagesAtEnd(asmr, linePtr))
    345339        return;
     
    382376    Assembler& asmr = handler.assembler;
    383377    if (asmr.currentKernel==ASMKERN_GLOBAL)
    384     {
    385         asmr.printError(pseudoOpPlace, "Metadata can be defined only inside kernel");
    386         return;
    387     }
     378        PSEUDOOP_RETURN_BY_ERROR("Metadata can be defined only inside kernel")
    388379    if (handler.kernelStates[asmr.currentKernel]->configSection!=ASMSECT_NONE)
    389     {
    390         asmr.printError(pseudoOpPlace,
    391                     "Metadata can't be defined if configuration was defined");
    392         return;
    393     }
     380        PSEUDOOP_RETURN_BY_ERROR("Metadata can't be defined if configuration was defined")
    394381   
    395382    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    412399    Assembler& asmr = handler.assembler;
    413400    if (asmr.currentKernel==ASMKERN_GLOBAL)
    414     {
    415         asmr.printError(pseudoOpPlace, "Kernel config can be defined only inside kernel");
    416         return;
    417     }
     401        PSEUDOOP_RETURN_BY_ERROR("Kernel config can be defined only inside kernel")
    418402    AsmAmdHandler::Kernel& kernel = *handler.kernelStates[asmr.currentKernel];
    419403    if (kernel.metadataSection!=ASMSECT_NONE || kernel.headerSection!=ASMSECT_NONE ||
    420404        !kernel.calNoteSections.empty())
    421     {
    422         asmr.printError(pseudoOpPlace, "Config can't be defined if metadata,header and/or"
    423                         " CALnotes section exists");
    424         return;
    425     }
     405        PSEUDOOP_RETURN_BY_ERROR("Config can't be defined if metadata,header and/or"
     406                        " CALnotes section exists")
    426407
    427408    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    449430    const char* end = asmr.line + asmr.lineSize;
    450431    if (asmr.currentKernel==ASMKERN_GLOBAL)
    451     {
    452         asmr.printError(pseudoOpPlace, "CALNote can be defined only inside kernel");
    453         return;
    454     }
     432        PSEUDOOP_RETURN_BY_ERROR("CALNote can be defined only inside kernel")
    455433    AsmAmdHandler::Kernel& kernel = *handler.kernelStates[asmr.currentKernel];
    456434    if (kernel.configSection!=ASMSECT_NONE)
    457     {
    458         asmr.printError(pseudoOpPlace,
    459                     "CALNote can't be defined if configuration was defined");
    460         return;
    461     }
     435        PSEUDOOP_RETURN_BY_ERROR("CALNote can't be defined if configuration was defined")
    462436   
    463437    skipSpacesToEnd(linePtr, end);
     
    497471   
    498472    if (asmr.currentKernel==ASMKERN_GLOBAL)
    499     {
    500         asmr.printError(pseudoOpPlace, "CALNote can be defined only inside kernel");
    501         return;
    502     }
     473        PSEUDOOP_RETURN_BY_ERROR("CALNote can be defined only inside kernel")
    503474    AsmAmdHandler::Kernel& kernel = *handler.kernelStates[asmr.currentKernel];
    504475    if (kernel.configSection!=ASMSECT_NONE)
    505     {
    506         asmr.printError(pseudoOpPlace,
    507                     "CALNote can't be defined if configuration was defined");
    508         return;
    509     }
     476        PSEUDOOP_RETURN_BY_ERROR("CALNote can't be defined if configuration was defined")
    510477   
    511478    skipSpacesToEnd(linePtr, end);
     
    522489    Assembler& asmr = handler.assembler;
    523490    if (asmr.currentKernel==ASMKERN_GLOBAL)
    524     {
    525         asmr.printError(pseudoOpPlace, "Header can be defined only inside kernel");
    526         return;
    527     }
     491        PSEUDOOP_RETURN_BY_ERROR("Header can be defined only inside kernel")
    528492    if (handler.kernelStates[asmr.currentKernel]->configSection!=ASMSECT_NONE)
    529     {
    530         asmr.printError(pseudoOpPlace,
    531                 "Header can't be defined if configuration was defined");
    532         return;
    533     }
     493        PSEUDOOP_RETURN_BY_ERROR("Header can't be defined if configuration was defined")
    534494   
    535495    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    558518        (handler.sections[asmr.currentSection].extraId >= 32 ||
    559519        ((1U<<handler.sections[asmr.currentSection].extraId) & requiredCalNoteIdMask))==0)
    560     {
    561         asmr.printError(pseudoOpPlace, (std::string("Illegal place of ")+entryName).c_str());
    562         return;
    563     }
     520        PSEUDOOP_RETURN_BY_ERROR((std::string("Illegal place of ")+entryName).c_str())
    564521   
    565522    if (handler.sections[asmr.currentSection].extraId == CALNOTE_ATI_UAV)
     
    691648        if (asmr.currentKernel==ASMKERN_GLOBAL ||
    692649            asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    693         {
    694             asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    695             return;
    696         }
     650            PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    697651       
    698652        AmdKernelConfig& config = handler.output.kernels[asmr.currentKernel].config;
     
    728682    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    729683        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    730     {
    731         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    732         return;
    733     }
     684        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    734685   
    735686    skipSpacesToEnd(linePtr, end);
     
    902853    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    903854        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    904     {
    905         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    906         return;
    907     }
     855        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    908856   
    909857    skipSpacesToEnd(linePtr, end);
     
    971919    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    972920        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    973     {
    974         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    975         return;
    976     }
     921        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    977922   
    978923    uint64_t out[3] = { 0, 0, 0 };
     
    1033978    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    1034979        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1035     {
    1036         asmr.printError(pseudoOpPlace, "Illegal place of UserData");
    1037         return;
    1038     }
     980        PSEUDOOP_RETURN_BY_ERROR("Illegal place of UserData")
    1039981   
    1040982    cxuint dataClass = 0;
     
    10891031    AmdKernelConfig& config = handler.output.kernels[asmr.currentKernel].config;
    10901032    if (config.userDatas.size() == 16)
    1091     {
    1092         asmr.printError(pseudoOpPlace, "Too many UserData elements");
    1093         return;
    1094     }
     1033        PSEUDOOP_RETURN_BY_ERROR("Too many UserData elements")
    10951034    AmdUserData userData;
    10961035    userData.dataClass = dataClass;
     
    11071046    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    11081047        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1109     {
    1110         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    1111         return;
    1112     }
     1048        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    11131049    cxuint dimMask = 0;
    11141050    if (!parseDimensions(asmr, linePtr, dimMask))
     
    15581494    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    15591495        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1560     {
    1561         asmr.printError(pseudoOpPlace, "Illegal place of kernel argument");
    1562         return;
    1563     }
     1496        PSEUDOOP_RETURN_BY_ERROR("Illegal place of kernel argument")
    15641497   
    15651498    auto& kernelState = *handler.kernelStates[asmr.currentKernel];
  • CLRadeonExtender/trunk/amdasm/AsmGalliumFormat.cpp

    r3337 r3338  
    439439    const CString symName = extractScopedSymName(linePtr, end, false);
    440440    if (symName.empty())
    441     {
    442         asmr.printError(symNamePlace, "Illegal symbol name");
    443         return;
    444     }
     441        ASM_RETURN_BY_ERROR(symNamePlace, "Illegal symbol name")
    445442    size_t symNameLength = symName.size();
    446443    if (symNameLength >= 3 && symName.compare(symNameLength-3, 3, "::.")==0)
    447     {
    448         asmr.printError(symNamePlace, "Symbol '.' can be only in global scope");
    449         return;
    450     }
     444        ASM_RETURN_BY_ERROR(symNamePlace, "Symbol '.' can be only in global scope")
    451445    if (!checkGarbagesAtEnd(asmr, linePtr))
    452446        return;
     
    475469    Assembler& asmr = handler.assembler;
    476470    if (handler.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    477     {
    478         asmr.printError(pseudoOpPlace, "Configuration outside kernel definition");
    479         return;
    480     }
     471        PSEUDOOP_RETURN_BY_ERROR("Configuration outside kernel definition")
    481472    if (handler.kernelStates[asmr.currentKernel]->hasProgInfo)
    482     {
    483         asmr.printError(pseudoOpPlace,
    484                 "Configuration can't be defined if progInfo was defined");
    485         return;
    486     }
     473        PSEUDOOP_RETURN_BY_ERROR("Configuration can't be defined if progInfo was defined")
    487474    if (!checkGarbagesAtEnd(asmr, linePtr))
    488475        return;
     
    499486    Assembler& asmr = handler.assembler;
    500487    if (asmr.currentKernel==ASMKERN_GLOBAL)
    501     {
    502         asmr.printError(pseudoOpPlace, "Kernel control directive can be defined "
    503                     "only inside kernel");
    504         return;
    505     }
     488        PSEUDOOP_RETURN_BY_ERROR("Kernel control directive can be defined "
     489                    "only inside kernel")
    506490    if (handler.determineLLVMVersion() < 40000U)
    507     {
    508         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    509         return;
    510     }
     491        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    511492    if (!checkGarbagesAtEnd(asmr, linePtr))
    512493        return;
     
    541522    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    542523        handler.inside != AsmGalliumHandler::Inside::CONFIG)
    543     {
    544         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    545         return;
    546     }
     524        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    547525    if (amdHsa && handler.determineLLVMVersion() < 40000U)
    548     {
    549         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    550         return;
    551     }
     526        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    552527       
    553528    cxuint dimMask = 0;
     
    574549    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    575550        handler.inside != AsmGalliumHandler::Inside::CONFIG)
    576     {
    577         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    578         return;
    579     }
    580    
     551        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    581552    if (target >= GALLIUMCVAL_HSA_FIRST_PARAM && handler.determineLLVMVersion() < 40000U)
    582     {
    583         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    584         return;
    585     }
     553        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    586554   
    587555    skipSpacesToEnd(linePtr, end);
     
    766734    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    767735        handler.inside != AsmGalliumHandler::Inside::CONFIG)
    768     {
    769         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    770         return;
    771     }
    772    
     736        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    773737    if (target >= GALLIUMCVAL_HSA_FIRST_PARAM && handler.determineLLVMVersion() < 40000U)
    774     {
    775         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    776         return;
    777     }
     738        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    778739   
    779740    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    817778    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    818779        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    819     {
    820         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    821         return;
    822     }
     780        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    823781    if (handler.determineLLVMVersion() < 40000U)
    824     {
    825         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    826         return;
    827     }
     782        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    828783   
    829784    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    845800    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    846801        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    847     {
    848         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    849         return;
    850     }
     802        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    851803    if (handler.determineLLVMVersion() < 40000U)
    852     {
    853         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    854         return;
    855     }
     804        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    856805   
    857806    uint16_t kindValue = 0, majorValue = 0;
     
    876825    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    877826        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    878     {
    879         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    880         return;
    881     }
     827        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    882828    if (handler.determineLLVMVersion() < 40000U)
    883     {
    884         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    885         return;
    886     }
     829        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    887830   
    888831    uint16_t majorValue = 0, minorValue = 0;
     
    903846    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    904847        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    905     {
    906         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    907         return;
    908     }
     848        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    909849    if (handler.determineLLVMVersion() < 40000U)
    910     {
    911         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    912         return;
    913     }
     850        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    914851   
    915852    uint16_t gprFirst = 0, gprCount = 0;
     
    938875    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    939876        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    940     {
    941         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    942         return;
    943     }
     877        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    944878    if (handler.determineLLVMVersion() < 40000U)
    945     {
    946         asmr.printError(pseudoOpPlace, "HSA configuration pseudo-op only for LLVM>=4.0.0");
    947         return;
    948     }
     879        PSEUDOOP_RETURN_BY_ERROR("HSA configuration pseudo-op only for LLVM>=4.0.0")
    949880   
    950881    cxuint dimMask = 0;
     
    964895    Assembler& asmr = handler.assembler;
    965896    if (handler.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    966     {
    967         asmr.printError(pseudoOpPlace, "Arguments outside kernel definition");
    968         return;
    969     }
     897        PSEUDOOP_RETURN_BY_ERROR("Arguments outside kernel definition")
    970898    if (!checkGarbagesAtEnd(asmr, linePtr))
    971899        return;
     
    1003931   
    1004932    if (handler.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1005     {
    1006         asmr.printError(pseudoOpPlace, "Argument definition outside kernel configuration");
    1007         return;
    1008     }
     933        PSEUDOOP_RETURN_BY_ERROR("Argument definition outside kernel configuration")
    1009934    if (handler.inside != AsmGalliumHandler::Inside::ARGS)
    1010     {
    1011         asmr.printError(pseudoOpPlace, "Argument definition outside arguments list");
    1012         return;
    1013     }
     935        PSEUDOOP_RETURN_BY_ERROR("Argument definition outside arguments list")
    1014936   
    1015937    skipSpacesToEnd(linePtr, end);
     
    11561078    Assembler& asmr = handler.assembler;
    11571079    if (handler.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1158     {
    1159         asmr.printError(pseudoOpPlace, "ProgInfo outside kernel definition");
    1160         return;
    1161     }
     1080        PSEUDOOP_RETURN_BY_ERROR("ProgInfo outside kernel definition")
    11621081    if (handler.output.kernels[asmr.currentKernel].useConfig)
    1163     {
    1164         asmr.printError(pseudoOpPlace,
    1165                 "ProgInfo can't be defined if configuration was exists");
    1166         return;
    1167     }
     1082        PSEUDOOP_RETURN_BY_ERROR("ProgInfo can't be defined if configuration was exists")
    11681083    if (!checkGarbagesAtEnd(asmr, linePtr))
    11691084        return;
     
    11801095   
    11811096    if (handler.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    1182     {
    1183         asmr.printError(pseudoOpPlace, "ProgInfo entry outside kernel configuration");
    1184         return;
    1185     }
     1097        PSEUDOOP_RETURN_BY_ERROR("ProgInfo entry outside kernel configuration")
    11861098    if (handler.inside != AsmGalliumHandler::Inside::PROGINFO)
    1187     {
    1188         asmr.printError(pseudoOpPlace, "ProgInfo entry definition outside ProgInfo");
    1189         return;
    1190     }
     1099        PSEUDOOP_RETURN_BY_ERROR("ProgInfo entry definition outside ProgInfo")
    11911100   
    11921101    skipSpacesToEnd(linePtr, end);
     
    12181127    const cxuint llvmVersion = handler.determineLLVMVersion();
    12191128    if (llvmVersion<30900U && kstate.progInfoEntries == 3)
    1220     {
    1221         asmr.printError(pseudoOpPlace, "Maximum 3 entries can be in ProgInfo");
    1222         return;
    1223     }
     1129        PSEUDOOP_RETURN_BY_ERROR("Maximum 3 entries can be in ProgInfo")
    12241130    if (llvmVersion>=30900U && kstate.progInfoEntries == 5)
    1225     {
    1226         asmr.printError(pseudoOpPlace, "Maximum 5 entries can be in ProgInfo");
    1227         return;
    1228     }
     1131        PSEUDOOP_RETURN_BY_ERROR("Maximum 5 entries can be in ProgInfo")
    12291132    GalliumProgInfoEntry& pentry = handler.output.kernels[asmr.currentKernel]
    12301133            .progInfo[kstate.progInfoEntries++];
     
    13071210   
    13081211    if (handler.sections[asmr.currentSection].type != AsmSectionType::CODE)
    1309     {
    1310         asmr.printError(pseudoOpPlace, "KCode outside code");
    1311         return;
    1312     }
     1212        PSEUDOOP_RETURN_BY_ERROR("KCode outside code")
    13131213    if (handler.kcodeSelStack.empty())
    13141214        handler.saveKcodeCurrentAllocRegs();
     
    13391239    Assembler& asmr = handler.assembler;
    13401240    if (handler.sections[asmr.currentSection].type != AsmSectionType::CODE)
    1341     {
    1342         asmr.printError(pseudoOpPlace, "KCodeEnd outside code");
    1343         return;
    1344     }
     1241        PSEUDOOP_RETURN_BY_ERROR("KCodeEnd outside code")
    13451242    if (handler.kcodeSelStack.empty())
    1346     {
    1347         asmr.printError(pseudoOpPlace, "'.kcodeend' without '.kcode'");
    1348         return;
    1349     }
     1243        PSEUDOOP_RETURN_BY_ERROR("'.kcodeend' without '.kcode'")
    13501244    if (!checkGarbagesAtEnd(asmr, linePtr))
    13511245        return;
  • CLRadeonExtender/trunk/amdasm/AsmInternals.h

    r3333 r3338  
    299299};
    300300
     301#define PSEUDOOP_RETURN_BY_ERROR(STRING) \
     302    { \
     303        asmr.printError(pseudoOpPlace, STRING); \
     304        return; \
     305    }
     306
     307#define ASM_RETURN_BY_ERROR(PLACE, STRING) \
     308    { \
     309        asmr.printError(PLACE, STRING); \
     310        return; \
     311    }
     312
     313#define ASM_FAIL_BY_ERROR(PLACE, STRING) \
     314    { \
     315        asmr.printError(PLACE, STRING); \
     316        return false; \
     317    }
     318
    301319extern CLRX_INTERNAL cxbyte cstrtobyte(const char*& str, const char* end);
    302320
  • CLRadeonExtender/trunk/amdasm/AsmPseudoOps.cpp

    r3333 r3338  
    215215        format = BinaryFormat::RAWCODE;
    216216    else
    217     {
    218         asmr.printError(formatPlace, "Unknown output format type");
    219         return false;
    220     }
     217        ASM_FAIL_BY_ERROR(formatPlace, "Unknown output format type")
    221218    return true;
    222219}
     
    234231    {
    235232        if (asmr.formatHandler!=nullptr)
    236         {
    237             asmr.printError(formatPlace, "Output format type is already defined");
    238             return;
    239         }
     233            ASM_RETURN_BY_ERROR(formatPlace, "Output format type is already defined")
    240234        asmr.format = format;
    241235    }
     
    554548    }
    555549    if (!ifs)
    556     {
    557         asmr.printError(namePlace, (std::string("Binary file '") + filename +
    558                     "' not found or unavailable in any directory").c_str());
    559         return;
    560     }
     550        ASM_RETURN_BY_ERROR(namePlace, (std::string("Binary file '") + filename +
     551                    "' not found or unavailable in any directory").c_str())
    561552    // exception for checking file seeking
    562553    bool seekingIsWorking = true;
     
    580571        ifs.read(output, toRead);
    581572        if (ifs.gcount() != std::streamsize(toRead))
    582         {
    583             asmr.printError(namePlace, "Can't read whole needed file content");
    584             return;
    585         }
     573            ASM_RETURN_BY_ERROR(namePlace, "Can't read whole needed file content")
    586574    }
    587575    else
     
    675663    asmr.initializeOutputFormat();
    676664    if (!asmr.isWriteableSection())
    677     {
    678         asmr.printError(pseudoOpPlace,
    679                 "Writing data into non-writeable section is illegal");
    680         return;
    681     }
     665        PSEUDOOP_RETURN_BY_ERROR("Writing data into non-writeable section is illegal")
    682666    skipSpacesToEnd(linePtr, end);
    683667    if (linePtr == end)
     
    761745    asmr.initializeOutputFormat();
    762746    if (!asmr.isWriteableSection())
    763     {
    764         asmr.printError(pseudoOpPlace,
    765                     "Writing data into non-writeable section is illegal");
    766         return;
    767     }
     747        PSEUDOOP_RETURN_BY_ERROR("Writing data into non-writeable section is illegal");
    768748    skipSpacesToEnd(linePtr, end);
    769749    if (linePtr == end)
     
    794774    asmr.initializeOutputFormat();
    795775    if (!asmr.isWriteableSection())
    796     {
    797         asmr.printError(pseudoOpPlace,
    798                     "Writing data into non-writeable section is illegal");
    799         return;
    800     }
     776        PSEUDOOP_RETURN_BY_ERROR("Writing data into non-writeable section is illegal")
    801777    skipSpacesToEnd(linePtr, end);
    802778    if (linePtr == end)
     
    841817    asmr.initializeOutputFormat();
    842818    if (!asmr.isWriteableSection())
    843     {
    844         asmr.printError(pseudoOpPlace,
    845                     "Writing data into non-writeable section is illegal");
    846         return;
    847     }
     819        PSEUDOOP_RETURN_BY_ERROR("Writing data into non-writeable section is illegal")
    848820    skipSpacesToEnd(linePtr, end);
    849821    if (linePtr == end)
     
    866838    const char* end = asmr.line + asmr.lineSize;
    867839    if (!asmr.isWriteableSection())
    868     {
    869         asmr.printError(pseudoOpPlace,
    870                     "Writing data into non-writeable section is illegal");
    871         return;
    872     }
     840        PSEUDOOP_RETURN_BY_ERROR("Writing data into non-writeable section is illegal")
    873841    asmr.initializeOutputFormat();
    874842    skipSpacesToEnd(linePtr, end);
     
    1015983   
    1016984    if (!asmr.isWriteableSection())
    1017     {
    1018         asmr.printError(pseudoOpPlace,
    1019                     "Writing data into non-writeable section is illegal");
    1020         return;
    1021     }
     985        PSEUDOOP_RETURN_BY_ERROR("Writing data into non-writeable section is illegal")
    1022986   
    1023987    skipSpacesToEnd(linePtr, end);
     
    10991063   
    11001064    if (!asmr.isAddressableSection())
    1101     {
    1102         asmr.printError(pseudoOpPlace,
    1103                     "Change output counter inside non-addressable section is illegal");
    1104         return;
    1105     }
     1065        PSEUDOOP_RETURN_BY_ERROR("Change output counter inside non-addressable "
     1066                    "section is illegal");
    11061067   
    11071068    skipSpacesToEnd(linePtr, end);
     
    11441105   
    11451106    if (!asmr.isAddressableSection())
    1146     {
    1147         asmr.printError(pseudoOpPlace,
    1148                     "Change output counter inside non-addressable section is illegal");
    1149         return;
    1150     }
     1107        PSEUDOOP_RETURN_BY_ERROR("Change output counter inside non-addressable"
     1108                    " section is illegal")
    11511109   
    11521110    skipSpacesToEnd(linePtr, end);
     
    12251183   
    12261184    if (!asmr.isAddressableSection())
    1227     {
    1228         asmr.printError(pseudoOpPlace,
    1229                     "Change output counter inside non-addressable section is illegal");
    1230         return;
    1231     }
     1185        PSEUDOOP_RETURN_BY_ERROR("Change output counter inside non-addressable "
     1186                    "section is illegal")
    12321187   
    12331188    skipSpacesToEnd(linePtr, end);
     
    12721227    uint64_t outPos = asmr.currentOutPos;
    12731228    if (outPos&(sizeof(Word)-1))
    1274     {
    1275         asmr.printError(pseudoOpPlace, "Offset is not aligned to word");
    1276         return;
    1277     }
     1229        PSEUDOOP_RETURN_BY_ERROR("Offset is not aligned to word")
    12781230   
    12791231    const uint64_t bytesToFill = ((outPos&(alignment-1))!=0) ?
     
    14831435    while (linePtr != end && *linePtr != ',') linePtr++;
    14841436    if (linePtr == end)
    1485     {
    1486         asmr.printError(linePtr, "Missing second string");
    1487         return;
    1488     }
     1437        ASM_RETURN_BY_ERROR(linePtr, "Missing second string")
    14891438    const char* firstStrEnd = linePtr;
    14901439    if (good) linePtr++; // comma
     
    16651614   
    16661615    if (asmr.repetitionLevel == 1000)
    1667     {
    1668         asmr.printError(pseudoOpPlace, "Repetition level is greater than 1000");
    1669         return;
    1670     }
     1616        PSEUDOOP_RETURN_BY_ERROR("Repetition level is greater than 1000")
    16711617    asmr.pushClause(pseudoOpPlace, AsmClauseType::REPEAT);
    16721618    if (repeatsNum == 0)
     
    17041650    CString macroName = extractSymName(linePtr, end, false);
    17051651    if (macroName.empty())
    1706     {
    1707         asmr.printError(macroNamePlace, "Expected macro name");
    1708         return;
    1709     }
     1652        ASM_RETURN_BY_ERROR(macroNamePlace, "Expected macro name")
    17101653    if (asmr.macroCase)
    17111654        toLowerString(macroName);
     
    17331676        CString argName = extractSymName(linePtr, end, false);
    17341677        if (argName.empty())
    1735         {
    1736             asmr.printError(argPlace, "Expected macro argument name");
    1737             return; //
    1738         }
     1678            ASM_RETURN_BY_ERROR(argPlace, "Expected macro argument name")
    17391679        bool argRequired = false;
    17401680        bool argVarArgs = false;
     
    18591799    CString symName = extractSymName(linePtr, end, false);
    18601800    if (symName.empty())
    1861     {
    1862         asmr.printError(symNamePlace, "Expected argument name");
    1863         return;
    1864     }
     1801        ASM_RETURN_BY_ERROR(symNamePlace, "Expected argument name")
    18651802    /* parse args */
    18661803    std::vector<CString> symValues;
     
    18941831   
    18951832    if (asmr.repetitionLevel == 1000)
    1896     {
    1897         asmr.printError(pseudoOpPlace, "Repetition level is greater than 1000");
    1898         return;
    1899     }
     1833        PSEUDOOP_RETURN_BY_ERROR("Repetition level is greater than 1000")
    19001834   
    19011835    if (symValues.empty())
     
    19311865    bool good = true;
    19321866    if (macroName.empty())
    1933     {
    1934         asmr.printError(macroNamePlace, "Expected macro name");
    1935         good = false;
    1936     }
     1867        ASM_RETURN_BY_ERROR(macroNamePlace, "Expected macro name")
    19371868    if (!good || !checkGarbagesAtEnd(asmr, linePtr))
    19381869        return;
     
    21942125    if (asmr.currentSection==ASMSECT_ABS ||
    21952126        asmr.sections[asmr.currentSection].type != AsmSectionType::CODE)
    2196     {
    2197         asmr.printError(pseudoOpPlace,
    2198                         "Defining codeflow in non-code section is illegal");
    2199         return;
    2200     }
     2127        PSEUDOOP_RETURN_BY_ERROR("Defining codeflow in non-code section is illegal")
    22012128   
    22022129    const char* end = asmr.line+asmr.lineSize;
     
    22362163    const CString symName = extractScopedSymName(linePtr, end, false);
    22372164    if (symName.empty())
    2238     {
    2239         asmr.printError(symNamePlace, "Illegal symbol name");
    2240         return;
    2241     }
     2165        ASM_RETURN_BY_ERROR(symNamePlace, "Illegal symbol name")
    22422166    size_t symNameLength = symName.size();
    22432167    if (symNameLength >= 3 && symName.compare(symNameLength-3, 3, "::.")==0)
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r3337 r3338  
    348348    Assembler& asmr = handler.assembler;
    349349    if (asmr.currentKernel==ASMKERN_GLOBAL)
    350     {
    351         asmr.printError(pseudoOpPlace, "Kernel config can be defined only inside kernel");
    352         return;
    353     }
     350        PSEUDOOP_RETURN_BY_ERROR("Kernel config can be defined only inside kernel")
    354351   
    355352    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    365362    Assembler& asmr = handler.assembler;
    366363    if (asmr.currentKernel==ASMKERN_GLOBAL)
    367     {
    368         asmr.printError(pseudoOpPlace, "Kernel control directive can be defined "
    369                     "only inside kernel");
    370         return;
    371     }
     364        PSEUDOOP_RETURN_BY_ERROR("Kernel control directive can be defined "
     365                    "only inside kernel")
    372366    if (!checkGarbagesAtEnd(asmr, linePtr))
    373367        return;
     
    391385    Assembler& asmr = handler.assembler;
    392386    if (asmr.currentKernel==ASMKERN_GLOBAL)
    393     {
    394         asmr.printError(pseudoOpPlace, ".fkernel can be only inside kernel");
    395         return;
    396     }
     387        PSEUDOOP_RETURN_BY_ERROR(".fkernel can be only inside kernel")
    397388    if (!checkGarbagesAtEnd(asmr, linePtr))
    398389        return;
     
    644635    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    645636        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    646     {
    647         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    648         return;
    649     }
     637        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    650638   
    651639    skipSpacesToEnd(linePtr, end);
     
    733721    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    734722        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    735     {
    736         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    737         return;
    738     }
     723        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    739724   
    740725    skipSpacesToEnd(linePtr, end);
     
    754739    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    755740        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    756     {
    757         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    758         return;
    759     }
     741        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    760742   
    761743    if (!checkGarbagesAtEnd(asmr, linePtr))
     
    774756    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    775757        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    776     {
    777         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    778         return;
    779     }
     758        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    780759    cxuint dimMask = 0;
    781760    if (!parseDimensions(asmr, linePtr, dimMask))
     
    839818    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    840819        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    841     {
    842         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    843         return;
    844     }
     820        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    845821   
    846822    uint16_t kindValue = 0, majorValue = 0;
     
    891867    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    892868        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    893     {
    894         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    895         return;
    896     }
     869        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    897870   
    898871    uint16_t majorValue = 0, minorValue = 0;
     
    965938    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    966939        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    967     {
    968         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    969         return;
    970     }
     940        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    971941   
    972942    uint16_t gprFirst = 0, gprCount = 0;
     
    994964    if (asmr.currentKernel==ASMKERN_GLOBAL ||
    995965        asmr.sections[asmr.currentSection].type != AsmSectionType::CONFIG)
    996     {
    997         asmr.printError(pseudoOpPlace, "Illegal place of configuration pseudo-op");
    998         return;
    999     }
     966        PSEUDOOP_RETURN_BY_ERROR("Illegal place of configuration pseudo-op")
    1000967    cxuint dimMask = 0;
    1001968    if (!parseDimensions(asmr, linePtr, dimMask))
     
    10811048   
    10821049    if (handler.sections[asmr.currentSection].type != AsmSectionType::CODE)
    1083     {
    1084         asmr.printError(pseudoOpPlace, "KCode outside code");
    1085         return;
    1086     }
     1050        PSEUDOOP_RETURN_BY_ERROR("KCode outside code")
    10871051    if (handler.kcodeSelStack.empty())
    10881052        handler.saveKcodeCurrentAllocRegs();
     
    11131077    Assembler& asmr = handler.assembler;
    11141078    if (handler.sections[asmr.currentSection].type != AsmSectionType::CODE)
    1115     {
    1116         asmr.printError(pseudoOpPlace, "KCodeEnd outside code");
    1117         return;
    1118     }
     1079        PSEUDOOP_RETURN_BY_ERROR("KCodeEnd outside code")
    11191080    if (handler.kcodeSelStack.empty())
    1120     {
    1121         asmr.printError(pseudoOpPlace, "'.kcodeend' without '.kcode'");
    1122         return;
    1123     }
     1081        PSEUDOOP_RETURN_BY_ERROR("'.kcodeend' without '.kcode'")
    11241082    if (!checkGarbagesAtEnd(asmr, linePtr))
    11251083        return;
Note: See TracChangeset for help on using the changeset viewer.