Lines Matching +full:stop +full:- +full:mode

2 /*-
5 * SPDX-License-Identifier: BSD-3-Clause
22 * 3. Neither the names of the above-listed copyright holders nor the names
214 %left '+' '-'
270 stop("Prefix multiply defined",
274 stop("Unable to record prefix", EX_SOFTWARE);
282 stop("Patch argument list multiply defined",
286 stop("Unable to record patch arg list", EX_SOFTWARE);
302 if ($1->type != UNINITIALIZED) {
303 stop("Register multiply defined", EX_DATAERR);
307 cur_symbol->type = cur_symtype;
317 if (cur_symbol->info.rinfo->valid_bitmask == 0)
318 cur_symbol->info.rinfo->valid_bitmask = 0xFF;
320 if (cur_symbol->info.rinfo->size == 0)
321 cur_symbol->info.rinfo->size = 1;
326 if (cur_symbol->type != REGISTER) {
327 if (cur_symbol->info.rinfo->address == 0)
328 cur_symbol->info.rinfo->address =
331 cur_symbol->info.rinfo->size;
362 cur_symbol->info.rinfo->address = $2;
369 cur_symbol->info.rinfo->size = $2;
374 max_addr = scb_or_sram_symbol->info.rinfo->address
375 + scb_or_sram_symbol->info.rinfo->size;
376 sym_max_addr = cur_symbol->info.rinfo->address
377 + cur_symbol->info.rinfo->size;
380 stop("SCB or SRAM space exhausted", EX_DATAERR);
388 cur_symbol->info.rinfo->mode = $2;
395 cur_symbol->info.rinfo->modes = $2;
414 stop("Valid register modes range between 0 and 4.",
426 if (symbol->type != CONST) {
427 stop("Only \"const\" symbols allowed in "
428 "mode definitions.", EX_DATAERR);
431 if (symbol->info.cinfo->value > 4) {
432 stop("Valid register modes range between 0 and 4.",
436 $$ = (0x1 << symbol->info.cinfo->value);
453 enum_increment = 0x01 << (ffs($3.value) - 1);
475 enum_increment = 0x01 << (ffs($3.value) - 1);
508 if ($2->type != UNINITIALIZED) {
509 stop("Re-definition of register alias",
513 $2->type = ALIAS;
515 $2->info.ainfo->parent = cur_symbol;
523 stop("Only one accumulator definition allowed",
535 stop("Only one mode pointer definition allowed",
547 stop("Only one definition of allones allowed",
559 stop("Only one definition of allzeros allowed",
571 stop("Only one definition of none allowed",
583 stop("Only one definition of sindex allowed",
613 | expression '-' expression
615 $$.value = $1.value - $3.value;
657 | '-' expression %prec UMINUS
660 $$.value = -$$.value;
672 switch (symbol->type) {
674 symbol = $1->info.ainfo->parent;
678 $$.value = symbol->info.rinfo->address;
684 $$.value = symbol->info.finfo->value;
688 $$.value = symbol->info.cinfo->value;
695 symbol->name);
696 stop(errbuf, EX_DATAERR);
709 if ($2->type != UNINITIALIZED) {
710 stop("Re-definition of symbol as a constant",
714 $2->type = CONST;
716 $2->info.cinfo->value = $3.value;
721 stop("Invalid downloaded constant declaration",
725 if ($2->type != UNINITIALIZED) {
726 stop("Re-definition of symbol as a downloaded constant",
730 $2->type = DOWNLOAD_CONST;
732 $2->info.cinfo->value = download_constant_count++;
739 if ($2->type != UNINITIALIZED) {
740 stop("Re-definition of symbol as a macro",
745 cur_symbol->type = MACRO;
758 cur_symbol->info.macroinfo->narg = $3;
775 stop("Comma without preceding argument in arg list",
791 cur_symbol->type = SRAMLOC;
796 sram_or_scb_offset = cur_symbol->info.rinfo->address;
815 if (cur_symbol->type != UNINITIALIZED) {
816 stop("Only one SRAM definition allowed",
820 cur_symbol->type = SCBLOC;
823 cur_symbol->info.rinfo->size = 64;
827 sram_or_scb_offset = cur_symbol->info.rinfo->address;
863 if ($3->type != CONST) {
864 stop("register offset must be a constant", EX_DATAERR);
867 if (($3->info.cinfo->value + 1) > (unsigned)$1->info.rinfo->size) {
868 stop("Accessing offset beyond range of register",
873 $$.offset = $3->info.cinfo->value;
878 if (($3 + 1) > (unsigned)$1->info.rinfo->size) {
879 stop("Accessing offset beyond range of register",
889 stop("No accumulator has been defined", EX_DATAERR);
919 stop(errbuf, EX_DATAERR);
975 stop("Critical Section within Critical Section",
980 cs->begin_addr = instruction_ptr;
991 stop("Unballanced 'end_cs'", EX_DATAERR);
995 cs->end_addr = instruction_ptr;
1009 if ($2->type != UNINITIALIZED) {
1010 stop("Program label multiply defined", EX_DATAERR);
1013 $2->type = LABEL;
1015 $2->info.linfo->address = instruction_ptr;
1016 $2->info.linfo->exported = $1;
1031 | T_SYMBOL '-' T_NUMBER
1034 $$.offset = -$3;
1046 | '.' '-' T_NUMBER
1049 $$.offset = -$3;
1060 new_scope->type = SCOPE_IF;
1061 new_scope->begin_addr = instruction_ptr;
1062 new_scope->func_num = $2->info.condinfo->func_num;
1075 last_scope = TAILQ_LAST(&scope_context->inner_scope,
1078 || last_scope->type == SCOPE_ELSE) {
1080 stop("'else if' without leading 'if'", EX_DATAERR);
1085 new_scope->type = SCOPE_ELSE_IF;
1086 new_scope->begin_addr = instruction_ptr;
1087 new_scope->func_num = $3->info.condinfo->func_num;
1100 last_scope = TAILQ_LAST(&scope_context->inner_scope,
1103 || last_scope->type == SCOPE_ELSE) {
1105 stop("'else' without leading 'if'", EX_DATAERR);
1109 new_scope->type = SCOPE_ELSE;
1110 new_scope->begin_addr = instruction_ptr;
1120 if (scope_context->type == SCOPE_ROOT) {
1121 stop("Unexpected '}' encountered", EX_DATAERR);
1125 scope_context->end_addr = instruction_ptr;
1133 stop("Unexpected '}' encountered", EX_DATAERR);
1175 make_expression(&immed, -1);
1185 make_expression(&immed, -1);
1388 if (sym->type == UNINITIALIZED) {
1389 sym->type = field_type;
1391 sym->info.finfo->value = value;
1394 stop("Empty Field, or Enum", EX_DATAERR);
1397 sym->info.finfo->value = value;
1398 sym->info.finfo->mask = value;
1400 sym->info.finfo->mask = field_symbol->info.finfo->value;
1402 sym->info.finfo->mask = 0xFF;
1404 } else if (sym->type != field_type) {
1405 stop("Field definition mirrors a definition of the same "
1408 } else if (value != sym->info.finfo->value) {
1409 stop("Field redefined with a conflicting value", EX_DATAERR);
1413 if (symlist_search(&(sym->info.finfo->symrefs),
1414 cur_symbol->name) != NULL) {
1415 stop("Field defined multiple times for register", EX_DATAERR);
1418 symlist_add(&(sym->info.finfo->symrefs), cur_symbol,
1420 cur_symbol->info.rinfo->valid_bitmask |= sym->info.finfo->mask;
1421 cur_symbol->info.rinfo->typecheck_masks = TRUE;
1422 symlist_add(&(cur_symbol->info.rinfo->fields), sym, SYMLIST_SORT);
1428 switch (symbol->type) { in initialize_symbol()
1430 stop("Call to initialize_symbol with type field unset", in initialize_symbol()
1437 symbol->info.rinfo = in initialize_symbol()
1439 if (symbol->info.rinfo == NULL) { in initialize_symbol()
1440 stop("Can't create register info", EX_SOFTWARE); in initialize_symbol()
1443 memset(symbol->info.rinfo, 0, in initialize_symbol()
1445 SLIST_INIT(&(symbol->info.rinfo->fields)); in initialize_symbol()
1448 * or to the mode specified by the SCB or SRAM space in initialize_symbol()
1452 symbol->info.rinfo->modes = in initialize_symbol()
1453 scb_or_sram_symbol->info.rinfo->modes; in initialize_symbol()
1455 symbol->info.rinfo->modes = ~0; in initialize_symbol()
1458 symbol->info.ainfo = in initialize_symbol()
1460 if (symbol->info.ainfo == NULL) { in initialize_symbol()
1461 stop("Can't create alias info", EX_SOFTWARE); in initialize_symbol()
1464 memset(symbol->info.ainfo, 0, in initialize_symbol()
1471 symbol->info.finfo = in initialize_symbol()
1473 if (symbol->info.finfo == NULL) { in initialize_symbol()
1474 stop("Can't create field info", EX_SOFTWARE); in initialize_symbol()
1477 memset(symbol->info.finfo, 0, sizeof(struct field_info)); in initialize_symbol()
1478 SLIST_INIT(&(symbol->info.finfo->symrefs)); in initialize_symbol()
1482 symbol->info.cinfo = in initialize_symbol()
1484 if (symbol->info.cinfo == NULL) { in initialize_symbol()
1485 stop("Can't create alias info", EX_SOFTWARE); in initialize_symbol()
1488 memset(symbol->info.cinfo, 0, in initialize_symbol()
1492 symbol->info.linfo = in initialize_symbol()
1494 if (symbol->info.linfo == NULL) { in initialize_symbol()
1495 stop("Can't create label info", EX_SOFTWARE); in initialize_symbol()
1498 memset(symbol->info.linfo, 0, in initialize_symbol()
1502 symbol->info.condinfo = in initialize_symbol()
1504 if (symbol->info.condinfo == NULL) { in initialize_symbol()
1505 stop("Can't create conditional info", EX_SOFTWARE); in initialize_symbol()
1508 memset(symbol->info.condinfo, 0, in initialize_symbol()
1512 symbol->info.macroinfo = in initialize_symbol()
1514 if (symbol->info.macroinfo == NULL) { in initialize_symbol()
1515 stop("Can't create macro info", EX_SOFTWARE); in initialize_symbol()
1518 memset(symbol->info.macroinfo, 0, in initialize_symbol()
1520 STAILQ_INIT(&symbol->info.macroinfo->args); in initialize_symbol()
1523 stop("Call to initialize_symbol with invalid symbol type", in initialize_symbol()
1537 if (cur_symbol == NULL || cur_symbol->type != MACRO) { in add_macro_arg()
1538 stop("Invalid current symbol for adding macro arg", in add_macro_arg()
1545 stop("Can't create macro_arg structure", EX_SOFTWARE); in add_macro_arg()
1548 marg->replacement_text = NULL; in add_macro_arg()
1550 "[^-/A-Za-z0-9_](%s)([^-/A-Za-z0-9_]|$)", in add_macro_arg()
1553 stop("Regex text buffer too small for arg", in add_macro_arg()
1557 retval = regcomp(&marg->arg_regex, regex_pattern, REG_EXTENDED); in add_macro_arg()
1559 stop("Regex compilation failed", EX_SOFTWARE); in add_macro_arg()
1562 STAILQ_INSERT_TAIL(&cur_symbol->info.macroinfo->args, marg, links); in add_macro_arg()
1568 if (cur_symbol == NULL || cur_symbol->type != MACRO) { in add_macro_body()
1569 stop("Invalid current symbol for adding macro arg", in add_macro_body()
1573 cur_symbol->info.macroinfo->body = strdup(bodytext); in add_macro_body()
1574 if (cur_symbol->info.macroinfo->body == NULL) { in add_macro_body()
1575 stop("Can't duplicate macro body text", EX_SOFTWARE); in add_macro_body()
1585 if (symbol->type == UNINITIALIZED) { in process_register()
1587 symbol->name); in process_register()
1588 stop(errbuf, EX_DATAERR); in process_register()
1590 } else if (symbol->type == ALIAS) { in process_register()
1591 *p_symbol = symbol->info.ainfo->parent; in process_register()
1592 } else if ((symbol->type != REGISTER) in process_register()
1593 && (symbol->type != SCBLOC) in process_register()
1594 && (symbol->type != SRAMLOC)) { in process_register()
1597 symbol->name); in process_register()
1598 stop(errbuf, EX_DATAERR); in process_register()
1609 if (src->symbol == NULL) in format_1_instr()
1613 test_writable_symbol(dest->symbol); in format_1_instr()
1614 test_readable_symbol(src->symbol); in format_1_instr()
1617 type_check(dest->symbol, immed, opcode); in format_1_instr()
1621 f1_instr = &instr->format.format1; in format_1_instr()
1622 f1_instr->ret = ret ? 1 : 0; in format_1_instr()
1623 f1_instr->opcode = opcode; in format_1_instr()
1624 f1_instr->destination = dest->symbol->info.rinfo->address in format_1_instr()
1625 + dest->offset; in format_1_instr()
1626 f1_instr->source = src->symbol->info.rinfo->address in format_1_instr()
1627 + src->offset; in format_1_instr()
1628 f1_instr->immediate = immed->value; in format_1_instr()
1631 f1_instr->parity = 1; in format_1_instr()
1632 else if (dest->symbol == mode_ptr.symbol) { in format_1_instr()
1637 * Attempt to update mode information if in format_1_instr()
1638 * we are operating on the mode register. in format_1_instr()
1640 if (src->symbol == allones.symbol) in format_1_instr()
1642 else if (src->symbol == allzeros.symbol) in format_1_instr()
1644 else if (src->symbol == mode_ptr.symbol) in format_1_instr()
1651 dst_value = src_value & immed->value; in format_1_instr()
1654 dst_value = src_value ^ immed->value; in format_1_instr()
1657 dst_value = (src_value + immed->value) & 0xFF; in format_1_instr()
1660 dst_value = src_value | immed->value; in format_1_instr()
1673 symlist_free(&immed->referenced_syms); in format_1_instr()
1685 if (src->symbol == NULL) in format_2_instr()
1689 test_writable_symbol(dest->symbol); in format_2_instr()
1690 test_readable_symbol(src->symbol); in format_2_instr()
1694 f2_instr = &instr->format.format2; in format_2_instr()
1695 f2_instr->ret = ret ? 1 : 0; in format_2_instr()
1696 f2_instr->opcode = AIC_OP_ROL; in format_2_instr()
1697 f2_instr->destination = dest->symbol->info.rinfo->address in format_2_instr()
1698 + dest->offset; in format_2_instr()
1699 f2_instr->source = src->symbol->info.rinfo->address in format_2_instr()
1700 + src->offset; in format_2_instr()
1701 if (places->value > 8 || places->value <= 0) { in format_2_instr()
1702 stop("illegal shift value", EX_DATAERR); in format_2_instr()
1707 if (places->value == 8) in format_2_instr()
1710 shift_control = (places->value << 4) | places->value; in format_2_instr()
1713 if (places->value == 8) { in format_2_instr()
1716 shift_control = (places->value << 4) in format_2_instr()
1717 | (8 - places->value) in format_2_instr()
1722 shift_control = places->value & 0x7; in format_2_instr()
1725 shift_control = (8 - places->value) | 0x08; in format_2_instr()
1729 stop("Invalid shift operation specified", EX_SOFTWARE); in format_2_instr()
1733 f2_instr->shift_control = shift_control; in format_2_instr()
1734 symlist_free(&places->referenced_syms); in format_2_instr()
1747 test_readable_symbol(src->symbol); in format_3_instr()
1750 type_check(src->symbol, immed, opcode); in format_3_instr()
1754 f3_instr = &instr->format.format3; in format_3_instr()
1755 if (address->symbol == NULL) { in format_3_instr()
1757 addr = instruction_ptr + address->offset; in format_3_instr()
1758 } else if (address->symbol->type == UNINITIALIZED) { in format_3_instr()
1760 addr = address->offset; in format_3_instr()
1761 instr->patch_label = address->symbol; in format_3_instr()
1763 addr = address->symbol->info.linfo->address + address->offset; in format_3_instr()
1764 f3_instr->opcode = opcode; in format_3_instr()
1765 f3_instr->address = addr; in format_3_instr()
1766 f3_instr->source = src->symbol->info.rinfo->address in format_3_instr()
1767 + src->offset; in format_3_instr()
1768 f3_instr->immediate = immed->value; in format_3_instr()
1771 f3_instr->parity = 1; in format_3_instr()
1773 symlist_free(&immed->referenced_syms); in format_3_instr()
1781 if ((symbol->info.rinfo->modes & (0x1 << src_mode)) == 0) { in test_readable_symbol()
1783 "Register %s unavailable in source reg mode %d", in test_readable_symbol()
1784 symbol->name, src_mode); in test_readable_symbol()
1785 stop(errbuf, EX_DATAERR); in test_readable_symbol()
1788 if (symbol->info.rinfo->mode == WO) { in test_readable_symbol()
1789 stop("Write Only register specified as source", in test_readable_symbol()
1799 if ((symbol->info.rinfo->modes & (0x1 << dst_mode)) == 0) { in test_writable_symbol()
1801 "Register %s unavailable in destination reg mode %d", in test_writable_symbol()
1802 symbol->name, dst_mode); in test_writable_symbol()
1803 stop(errbuf, EX_DATAERR); in test_writable_symbol()
1806 if (symbol->info.rinfo->mode == RO) { in test_writable_symbol()
1807 stop("Read Only register specified as destination", in test_writable_symbol()
1834 invalid_bits = expression->value & ~symbol->info.rinfo->valid_bitmask; in type_check()
1838 invalid_bits, symbol->name); in type_check()
1839 stop(errbuf, EX_DATAERR); in type_check()
1847 if (symbol->info.rinfo->typecheck_masks != FALSE) { in type_check()
1848 for(node = expression->referenced_syms.slh_first; in type_check()
1850 node = node->links.sle_next) { in type_check()
1851 if ((node->symbol->type == MASK in type_check()
1852 || node->symbol->type == FIELD in type_check()
1853 || node->symbol->type == ENUM in type_check()
1854 || node->symbol->type == ENUM_ENTRY) in type_check()
1855 && symlist_search(&node->symbol->info.finfo->symrefs, in type_check()
1856 symbol->name) == NULL) { in type_check()
1860 node->symbol->name, symbol->name); in type_check()
1861 stop(errbuf, EX_DATAERR); in type_check()
1871 SLIST_INIT(&immed->referenced_syms); in make_expression()
1872 immed->value = value & 0xff; in make_expression()
1885 if (false_func->type != UNINITIALIZED) { in add_conditional()
1886 stop("Conditional expression '0' " in add_conditional()
1890 false_func->type = CONDITIONAL; in add_conditional()
1892 false_func->info.condinfo->func_num = numfuncs++; in add_conditional()
1897 if (symbol->type == CONDITIONAL) in add_conditional()
1900 if (symbol->type != UNINITIALIZED) { in add_conditional()
1901 stop("Conditional expression conflicts with a symbol", in add_conditional()
1906 symbol->type = CONDITIONAL; in add_conditional()
1908 symbol->info.condinfo->func_num = numfuncs++; in add_conditional()
1925 stop("Can't allocate version string", EX_SOFTWARE); in add_version()
1935 stop(string, EX_DATAERR); in yyerror()
1941 if ((immed->referenced_syms.slh_first != NULL) in is_download_const()
1942 && (immed->referenced_syms.slh_first->symbol->type == DOWNLOAD_CONST)) in is_download_const()