Lines Matching +full:stop +full:- +full:mode
20 * 3. Neither the names of the above-listed copyright holders nor the names
224 %left '+' '-'
280 stop("Prefix multiply defined",
284 stop("Unable to record prefix", EX_SOFTWARE);
292 stop("Patch argument list multiply defined",
296 stop("Unable to record patch arg list", EX_SOFTWARE);
312 if ($1->type != UNINITIALIZED) {
313 stop("Register multiply defined", EX_DATAERR);
317 cur_symbol->type = cur_symtype;
327 if (cur_symbol->info.rinfo->valid_bitmask == 0)
328 cur_symbol->info.rinfo->valid_bitmask = 0xFF;
330 if (cur_symbol->info.rinfo->size == 0)
331 cur_symbol->info.rinfo->size = 1;
336 if (cur_symbol->type != REGISTER) {
337 if (cur_symbol->info.rinfo->address == 0)
338 cur_symbol->info.rinfo->address =
341 cur_symbol->info.rinfo->size;
374 cur_symbol->info.rinfo->address = $2;
381 cur_symbol->info.rinfo->size = $2;
386 max_addr = scb_or_sram_symbol->info.rinfo->address
387 + scb_or_sram_symbol->info.rinfo->size;
388 sym_max_addr = cur_symbol->info.rinfo->address
389 + cur_symbol->info.rinfo->size;
392 stop("SCB or SRAM space exhausted", EX_DATAERR);
400 cur_symbol->count += $2;
407 cur_symbol->info.rinfo->mode = $2;
414 cur_symbol->dont_generate_debug_code = 1;
421 cur_symbol->info.rinfo->modes = $2;
440 stop("Valid register modes range between 0 and 4.",
452 if (symbol->type != CONST) {
453 stop("Only \"const\" symbols allowed in "
454 "mode definitions.", EX_DATAERR);
457 if (symbol->info.cinfo->value > 4) {
458 stop("Valid register modes range between 0 and 4.",
462 $$ = (0x1 << symbol->info.cinfo->value);
479 enum_increment = 0x01 << (ffs($3.value) - 1);
501 enum_increment = 0x01 << (ffs($3.value) - 1);
534 if ($2->type != UNINITIALIZED) {
535 stop("Re-definition of register alias",
539 $2->type = ALIAS;
541 $2->info.ainfo->parent = cur_symbol;
549 stop("Only one accumulator definition allowed",
561 stop("Only one mode pointer definition allowed",
573 stop("Only one definition of allones allowed",
585 stop("Only one definition of allzeros allowed",
597 stop("Only one definition of none allowed",
609 stop("Only one definition of sindex allowed",
639 | expression '-' expression
641 $$.value = $1.value - $3.value;
683 | '-' expression %prec UMINUS
686 $$.value = -$$.value;
698 switch (symbol->type) {
700 symbol = $1->info.ainfo->parent;
704 $$.value = symbol->info.rinfo->address;
710 $$.value = symbol->info.finfo->value;
714 $$.value = symbol->info.cinfo->value;
721 symbol->name);
722 stop(errbuf, EX_DATAERR);
735 if ($2->type != UNINITIALIZED) {
736 stop("Re-definition of symbol as a constant",
740 $2->type = CONST;
742 $2->info.cinfo->value = $3.value;
747 stop("Invalid downloaded constant declaration",
751 if ($2->type != UNINITIALIZED) {
752 stop("Re-definition of symbol as a downloaded constant",
756 $2->type = DOWNLOAD_CONST;
758 $2->info.cinfo->value = download_constant_count++;
765 if ($2->type != UNINITIALIZED) {
766 stop("Re-definition of symbol as a macro",
771 cur_symbol->type = MACRO;
784 cur_symbol->info.macroinfo->narg = $3;
801 stop("Comma without preceding argument in arg list",
817 cur_symbol->type = SRAMLOC;
819 cur_symbol->count += 1;
823 sram_or_scb_offset = cur_symbol->info.rinfo->address;
842 if (cur_symbol->type != UNINITIALIZED) {
843 stop("Only one SRAM definition allowed",
847 cur_symbol->type = SCBLOC;
850 cur_symbol->info.rinfo->size = 64;
851 cur_symbol->count += 1;
855 sram_or_scb_offset = cur_symbol->info.rinfo->address;
891 if ($3->type != CONST) {
892 stop("register offset must be a constant", EX_DATAERR);
895 if (($3->info.cinfo->value + 1) > $1->info.rinfo->size) {
896 stop("Accessing offset beyond range of register",
901 $$.offset = $3->info.cinfo->value;
906 if (($3 + 1) > $1->info.rinfo->size) {
907 stop("Accessing offset beyond range of register",
917 stop("No accumulator has been defined", EX_DATAERR);
947 stop(errbuf, EX_DATAERR);
1003 stop("Critical Section within Critical Section",
1008 cs->begin_addr = instruction_ptr;
1019 stop("Unballanced 'end_cs'", EX_DATAERR);
1023 cs->end_addr = instruction_ptr;
1037 if ($2->type != UNINITIALIZED) {
1038 stop("Program label multiply defined", EX_DATAERR);
1041 $2->type = LABEL;
1043 $2->info.linfo->address = instruction_ptr;
1044 $2->info.linfo->exported = $1;
1059 | T_SYMBOL '-' T_NUMBER
1062 $$.offset = -$3;
1074 | '.' '-' T_NUMBER
1077 $$.offset = -$3;
1088 new_scope->type = SCOPE_IF;
1089 new_scope->begin_addr = instruction_ptr;
1090 new_scope->func_num = $2->info.condinfo->func_num;
1103 last_scope = TAILQ_LAST(&scope_context->inner_scope,
1106 || last_scope->type == T_ELSE) {
1108 stop("'else if' without leading 'if'", EX_DATAERR);
1113 new_scope->type = SCOPE_ELSE_IF;
1114 new_scope->begin_addr = instruction_ptr;
1115 new_scope->func_num = $3->info.condinfo->func_num;
1128 last_scope = TAILQ_LAST(&scope_context->inner_scope,
1131 || last_scope->type == SCOPE_ELSE) {
1133 stop("'else' without leading 'if'", EX_DATAERR);
1137 new_scope->type = SCOPE_ELSE;
1138 new_scope->begin_addr = instruction_ptr;
1148 if (scope_context->type == SCOPE_ROOT) {
1149 stop("Unexpected '}' encountered", EX_DATAERR);
1153 scope_context->end_addr = instruction_ptr;
1161 stop("Unexpected '}' encountered", EX_DATAERR);
1203 make_expression(&immed, -1);
1213 make_expression(&immed, -1);
1430 if (sym->type == UNINITIALIZED) {
1431 sym->type = field_type;
1433 sym->info.finfo->value = value;
1436 stop("Empty Field, or Enum", EX_DATAERR);
1439 sym->info.finfo->value = value;
1440 sym->info.finfo->mask = value;
1442 sym->info.finfo->mask = field_symbol->info.finfo->value;
1444 sym->info.finfo->mask = 0xFF;
1446 } else if (sym->type != field_type) {
1447 stop("Field definition mirrors a definition of the same "
1450 } else if (value != sym->info.finfo->value) {
1451 stop("Field redefined with a conflicting value", EX_DATAERR);
1455 if (symlist_search(&(sym->info.finfo->symrefs),
1456 cur_symbol->name) != NULL) {
1457 stop("Field defined multiple times for register", EX_DATAERR);
1460 symlist_add(&(sym->info.finfo->symrefs), cur_symbol,
1462 cur_symbol->info.rinfo->valid_bitmask |= sym->info.finfo->mask;
1463 cur_symbol->info.rinfo->typecheck_masks = TRUE;
1464 symlist_add(&(cur_symbol->info.rinfo->fields), sym, SYMLIST_SORT);
1470 switch (symbol->type) { in initialize_symbol()
1472 stop("Call to initialize_symbol with type field unset", in initialize_symbol()
1479 symbol->info.rinfo = in initialize_symbol()
1481 if (symbol->info.rinfo == NULL) { in initialize_symbol()
1482 stop("Can't create register info", EX_SOFTWARE); in initialize_symbol()
1485 memset(symbol->info.rinfo, 0, in initialize_symbol()
1487 SLIST_INIT(&(symbol->info.rinfo->fields)); in initialize_symbol()
1490 * or to the mode specified by the SCB or SRAM space in initialize_symbol()
1494 symbol->info.rinfo->modes = in initialize_symbol()
1495 scb_or_sram_symbol->info.rinfo->modes; in initialize_symbol()
1497 symbol->info.rinfo->modes = ~0; in initialize_symbol()
1500 symbol->info.ainfo = in initialize_symbol()
1502 if (symbol->info.ainfo == NULL) { in initialize_symbol()
1503 stop("Can't create alias info", EX_SOFTWARE); in initialize_symbol()
1506 memset(symbol->info.ainfo, 0, in initialize_symbol()
1513 symbol->info.finfo = in initialize_symbol()
1515 if (symbol->info.finfo == NULL) { in initialize_symbol()
1516 stop("Can't create field info", EX_SOFTWARE); in initialize_symbol()
1519 memset(symbol->info.finfo, 0, sizeof(struct field_info)); in initialize_symbol()
1520 SLIST_INIT(&(symbol->info.finfo->symrefs)); in initialize_symbol()
1524 symbol->info.cinfo = in initialize_symbol()
1526 if (symbol->info.cinfo == NULL) { in initialize_symbol()
1527 stop("Can't create alias info", EX_SOFTWARE); in initialize_symbol()
1530 memset(symbol->info.cinfo, 0, in initialize_symbol()
1534 symbol->info.linfo = in initialize_symbol()
1536 if (symbol->info.linfo == NULL) { in initialize_symbol()
1537 stop("Can't create label info", EX_SOFTWARE); in initialize_symbol()
1540 memset(symbol->info.linfo, 0, in initialize_symbol()
1544 symbol->info.condinfo = in initialize_symbol()
1546 if (symbol->info.condinfo == NULL) { in initialize_symbol()
1547 stop("Can't create conditional info", EX_SOFTWARE); in initialize_symbol()
1550 memset(symbol->info.condinfo, 0, in initialize_symbol()
1554 symbol->info.macroinfo = in initialize_symbol()
1556 if (symbol->info.macroinfo == NULL) { in initialize_symbol()
1557 stop("Can't create macro info", EX_SOFTWARE); in initialize_symbol()
1560 memset(symbol->info.macroinfo, 0, in initialize_symbol()
1562 STAILQ_INIT(&symbol->info.macroinfo->args); in initialize_symbol()
1565 stop("Call to initialize_symbol with invalid symbol type", in initialize_symbol()
1579 if (cur_symbol == NULL || cur_symbol->type != MACRO) { in add_macro_arg()
1580 stop("Invalid current symbol for adding macro arg", in add_macro_arg()
1587 stop("Can't create macro_arg structure", EX_SOFTWARE); in add_macro_arg()
1590 marg->replacement_text = NULL; in add_macro_arg()
1592 "[^-/A-Za-z0-9_](%s)([^-/A-Za-z0-9_]|$)", in add_macro_arg()
1595 stop("Regex text buffer too small for arg", in add_macro_arg()
1599 retval = regcomp(&marg->arg_regex, regex_pattern, REG_EXTENDED); in add_macro_arg()
1601 stop("Regex compilation failed", EX_SOFTWARE); in add_macro_arg()
1604 STAILQ_INSERT_TAIL(&cur_symbol->info.macroinfo->args, marg, links); in add_macro_arg()
1610 if (cur_symbol == NULL || cur_symbol->type != MACRO) { in add_macro_body()
1611 stop("Invalid current symbol for adding macro arg", in add_macro_body()
1615 cur_symbol->info.macroinfo->body = strdup(bodytext); in add_macro_body()
1616 if (cur_symbol->info.macroinfo->body == NULL) { in add_macro_body()
1617 stop("Can't duplicate macro body text", EX_SOFTWARE); in add_macro_body()
1627 if (symbol->type == UNINITIALIZED) { in process_register()
1629 symbol->name); in process_register()
1630 stop(errbuf, EX_DATAERR); in process_register()
1632 } else if (symbol->type == ALIAS) { in process_register()
1633 *p_symbol = symbol->info.ainfo->parent; in process_register()
1634 } else if ((symbol->type != REGISTER) in process_register()
1635 && (symbol->type != SCBLOC) in process_register()
1636 && (symbol->type != SRAMLOC)) { in process_register()
1639 symbol->name); in process_register()
1640 stop(errbuf, EX_DATAERR); in process_register()
1651 if (src->symbol == NULL) in format_1_instr()
1655 test_writable_symbol(dest->symbol); in format_1_instr()
1656 test_readable_symbol(src->symbol); in format_1_instr()
1658 if (!is_location_address(dest->symbol)) { in format_1_instr()
1665 f1_instr = &instr->format.format1; in format_1_instr()
1666 f1_instr->ret = ret ? 1 : 0; in format_1_instr()
1667 f1_instr->opcode = opcode; in format_1_instr()
1668 f1_instr->destination = dest->symbol->info.rinfo->address in format_1_instr()
1669 + dest->offset; in format_1_instr()
1670 f1_instr->source = src->symbol->info.rinfo->address in format_1_instr()
1671 + src->offset; in format_1_instr()
1672 f1_instr->immediate = immed->value; in format_1_instr()
1675 f1_instr->parity = 1; in format_1_instr()
1676 else if (dest->symbol == mode_ptr.symbol) { in format_1_instr()
1681 * Attempt to update mode information if in format_1_instr()
1682 * we are operating on the mode register. in format_1_instr()
1684 if (src->symbol == allones.symbol) in format_1_instr()
1686 else if (src->symbol == allzeros.symbol) in format_1_instr()
1688 else if (src->symbol == mode_ptr.symbol) in format_1_instr()
1695 dst_value = src_value & immed->value; in format_1_instr()
1698 dst_value = src_value ^ immed->value; in format_1_instr()
1701 dst_value = (src_value + immed->value) & 0xFF; in format_1_instr()
1704 dst_value = src_value | immed->value; in format_1_instr()
1717 symlist_free(&immed->referenced_syms); in format_1_instr()
1729 if (src->symbol == NULL) in format_2_instr()
1733 test_writable_symbol(dest->symbol); in format_2_instr()
1734 test_readable_symbol(src->symbol); in format_2_instr()
1738 f2_instr = &instr->format.format2; in format_2_instr()
1739 f2_instr->ret = ret ? 1 : 0; in format_2_instr()
1740 f2_instr->opcode = AIC_OP_ROL; in format_2_instr()
1741 f2_instr->destination = dest->symbol->info.rinfo->address in format_2_instr()
1742 + dest->offset; in format_2_instr()
1743 f2_instr->source = src->symbol->info.rinfo->address in format_2_instr()
1744 + src->offset; in format_2_instr()
1745 if (places->value > 8 || places->value <= 0) { in format_2_instr()
1746 stop("illegal shift value", EX_DATAERR); in format_2_instr()
1751 if (places->value == 8) in format_2_instr()
1754 shift_control = (places->value << 4) | places->value; in format_2_instr()
1757 if (places->value == 8) { in format_2_instr()
1760 shift_control = (places->value << 4) in format_2_instr()
1761 | (8 - places->value) in format_2_instr()
1766 shift_control = places->value & 0x7; in format_2_instr()
1769 shift_control = (8 - places->value) | 0x08; in format_2_instr()
1773 stop("Invalid shift operation specified", EX_SOFTWARE); in format_2_instr()
1777 f2_instr->shift_control = shift_control; in format_2_instr()
1778 symlist_free(&places->referenced_syms); in format_2_instr()
1791 test_readable_symbol(src->symbol); in format_3_instr()
1795 f3_instr = &instr->format.format3; in format_3_instr()
1796 if (address->symbol == NULL) { in format_3_instr()
1798 addr = instruction_ptr + address->offset; in format_3_instr()
1799 } else if (address->symbol->type == UNINITIALIZED) { in format_3_instr()
1801 addr = address->offset; in format_3_instr()
1802 instr->patch_label = address->symbol; in format_3_instr()
1804 addr = address->symbol->info.linfo->address + address->offset; in format_3_instr()
1805 f3_instr->opcode = opcode; in format_3_instr()
1806 f3_instr->address = addr; in format_3_instr()
1807 f3_instr->source = src->symbol->info.rinfo->address in format_3_instr()
1808 + src->offset; in format_3_instr()
1809 f3_instr->immediate = immed->value; in format_3_instr()
1812 f3_instr->parity = 1; in format_3_instr()
1814 symlist_free(&immed->referenced_syms); in format_3_instr()
1821 if ((symbol->info.rinfo->modes & (0x1 << src_mode)) == 0) { in test_readable_symbol()
1823 "Register %s unavailable in source reg mode %d", in test_readable_symbol()
1824 symbol->name, src_mode); in test_readable_symbol()
1825 stop(errbuf, EX_DATAERR); in test_readable_symbol()
1828 if (symbol->info.rinfo->mode == WO) { in test_readable_symbol()
1829 stop("Write Only register specified as source", in test_readable_symbol()
1838 if ((symbol->info.rinfo->modes & (0x1 << dst_mode)) == 0) { in test_writable_symbol()
1840 "Register %s unavailable in destination reg mode %d", in test_writable_symbol()
1841 symbol->name, dst_mode); in test_writable_symbol()
1842 stop(errbuf, EX_DATAERR); in test_writable_symbol()
1845 if (symbol->info.rinfo->mode == RO) { in test_writable_symbol()
1846 stop("Read Only register specified as destination", in test_writable_symbol()
1855 symbol_t *symbol = sym->symbol; in type_check()
1874 mask = (int8_t)~symbol->info.rinfo->valid_bitmask; in type_check()
1875 value = (int8_t)expression->value; in type_check()
1881 symbol->name); in type_check()
1882 stop(errbuf, EX_DATAERR); in type_check()
1890 if (symbol->info.rinfo->typecheck_masks != FALSE) { in type_check()
1891 for(node = expression->referenced_syms.slh_first; in type_check()
1893 node = node->links.sle_next) { in type_check()
1894 if ((node->symbol->type == MASK in type_check()
1895 || node->symbol->type == FIELD in type_check()
1896 || node->symbol->type == ENUM in type_check()
1897 || node->symbol->type == ENUM_ENTRY) in type_check()
1898 && symlist_search(&node->symbol->info.finfo->symrefs, in type_check()
1899 symbol->name) == NULL) { in type_check()
1903 node->symbol->name, symbol->name); in type_check()
1904 stop(errbuf, EX_DATAERR); in type_check()
1914 SLIST_INIT(&immed->referenced_syms); in make_expression()
1915 immed->value = value & 0xff; in make_expression()
1928 if (false_func->type != UNINITIALIZED) { in add_conditional()
1929 stop("Conditional expression '0' " in add_conditional()
1933 false_func->type = CONDITIONAL; in add_conditional()
1935 false_func->info.condinfo->func_num = numfuncs++; in add_conditional()
1940 if (symbol->type == CONDITIONAL) in add_conditional()
1943 if (symbol->type != UNINITIALIZED) { in add_conditional()
1944 stop("Conditional expression conflicts with a symbol", in add_conditional()
1949 symbol->type = CONDITIONAL; in add_conditional()
1951 symbol->info.condinfo->func_num = numfuncs++; in add_conditional()
1968 stop("Can't allocate version string", EX_SOFTWARE); in add_version()
1978 stop(string, EX_DATAERR); in yyerror()
1984 if ((immed->referenced_syms.slh_first != NULL) in is_download_const()
1985 && (immed->referenced_syms.slh_first->symbol->type == DOWNLOAD_CONST)) in is_download_const()
1994 if (sym->type == SCBLOC || in is_location_address()
1995 sym->type == SRAMLOC) in is_location_address()