Lines Matching +full:1 +full:- +full:stop
12 * 1. Redistributions of source code must retain the above copyright
20 * 3. Neither the names of the above-listed copyright holders nor the names
225 %left '+' '-'
281 stop("Prefix multiply defined",
285 stop("Unable to record prefix", EX_SOFTWARE);
293 stop("Patch argument list multiply defined",
297 stop("Unable to record patch arg list", EX_SOFTWARE);
313 if ($1->type != UNINITIALIZED) {
314 stop("Register multiply defined", EX_DATAERR);
317 cur_symbol = $1;
318 cur_symbol->type = cur_symtype;
328 if (cur_symbol->info.rinfo->valid_bitmask == 0)
329 cur_symbol->info.rinfo->valid_bitmask = 0xFF;
331 if (cur_symbol->info.rinfo->size == 0)
332 cur_symbol->info.rinfo->size = 1;
337 if (cur_symbol->type != REGISTER) {
338 if (cur_symbol->info.rinfo->address == 0)
339 cur_symbol->info.rinfo->address =
342 cur_symbol->info.rinfo->size;
375 cur_symbol->info.rinfo->address = $2;
382 cur_symbol->info.rinfo->size = $2;
387 max_addr = scb_or_sram_symbol->info.rinfo->address
388 + scb_or_sram_symbol->info.rinfo->size;
389 sym_max_addr = cur_symbol->info.rinfo->address
390 + cur_symbol->info.rinfo->size;
393 stop("SCB or SRAM space exhausted", EX_DATAERR);
401 cur_symbol->count += $2;
408 cur_symbol->info.rinfo->mode = $2;
415 cur_symbol->dont_generate_debug_code = 1;
422 cur_symbol->info.rinfo->modes = $2;
429 $$ = $1;
433 $$ = $1 | $3;
440 if ($1 > 4) {
441 stop("Valid register modes range between 0 and 4.",
446 $$ = (0x1 << $1);
452 symbol = $1;
453 if (symbol->type != CONST) {
454 stop("Only \"const\" symbols allowed in "
458 if (symbol->info.cinfo->value > 4) {
459 stop("Valid register modes range between 0 and 4.",
463 $$ = (0x1 << symbol->info.cinfo->value);
472 enum_increment = 1;
480 enum_increment = 0x01 << (ffs($3.value) - 1);
494 enum_increment = 1;
502 enum_increment = 0x01 << (ffs($3.value) - 1);
515 process_field(ENUM_ENTRY, $1, enum_next_value);
520 process_field(ENUM_ENTRY, $1, $2.value);
535 if ($2->type != UNINITIALIZED) {
536 stop("Re-definition of register alias",
540 $2->type = ALIAS;
542 $2->info.ainfo->parent = cur_symbol;
550 stop("Only one accumulator definition allowed",
562 stop("Only one mode pointer definition allowed",
574 stop("Only one definition of allones allowed",
586 stop("Only one definition of allzeros allowed",
598 stop("Only one definition of none allowed",
610 stop("Only one definition of sindex allowed",
621 $$.value = $1.value | $3.value;
623 &$1.referenced_syms,
628 $$.value = $1.value & $3.value;
630 &$1.referenced_syms,
635 $$.value = $1.value + $3.value;
637 &$1.referenced_syms,
640 | expression '-' expression
642 $$.value = $1.value - $3.value;
644 &($1.referenced_syms),
649 $$.value = $1.value * $3.value;
651 &($1.referenced_syms),
656 $$.value = $1.value / $3.value;
658 &($1.referenced_syms),
663 $$.value = $1.value << $3.value;
665 &$1.referenced_syms,
670 $$.value = $1.value >> $3.value;
672 &$1.referenced_syms,
684 | '-' expression %prec UMINUS
687 $$.value = -$$.value;
691 $$.value = $1;
698 symbol = $1;
699 switch (symbol->type) {
701 symbol = $1->info.ainfo->parent;
705 $$.value = symbol->info.rinfo->address;
711 $$.value = symbol->info.finfo->value;
715 $$.value = symbol->info.cinfo->value;
722 symbol->name);
723 stop(errbuf, EX_DATAERR);
736 if ($2->type != UNINITIALIZED) {
737 stop("Re-definition of symbol as a constant",
741 $2->type = CONST;
743 $2->info.cinfo->value = $3.value;
747 if ($1) {
748 stop("Invalid downloaded constant declaration",
752 if ($2->type != UNINITIALIZED) {
753 stop("Re-definition of symbol as a downloaded constant",
757 $2->type = DOWNLOAD_CONST;
759 $2->info.cinfo->value = download_constant_count++;
766 if ($2->type != UNINITIALIZED) {
767 stop("Re-definition of symbol as a macro",
772 cur_symbol->type = MACRO;
785 cur_symbol->info.macroinfo->narg = $3;
796 $$ = 1;
797 add_macro_arg($1, 0);
801 if ($1 == 0) {
802 stop("Comma without preceding argument in arg list",
806 $$ = $1 + 1;
807 add_macro_arg($3, $1);
818 cur_symbol->type = SRAMLOC;
820 cur_symbol->count += 1;
824 sram_or_scb_offset = cur_symbol->info.rinfo->address;
843 if (cur_symbol->type != UNINITIALIZED) {
844 stop("Only one SRAM definition allowed",
848 cur_symbol->type = SCBLOC;
851 cur_symbol->info.rinfo->size = 64;
852 cur_symbol->count += 1;
856 sram_or_scb_offset = cur_symbol->info.rinfo->address;
885 process_register(&$1);
886 $$.symbol = $1;
891 process_register(&$1);
892 if ($3->type != CONST) {
893 stop("register offset must be a constant", EX_DATAERR);
896 if (($3->info.cinfo->value + 1) > $1->info.rinfo->size) {
897 stop("Accessing offset beyond range of register",
901 $$.symbol = $1;
902 $$.offset = $3->info.cinfo->value;
906 process_register(&$1);
907 if (($3 + 1) > $1->info.rinfo->size) {
908 stop("Accessing offset beyond range of register",
912 $$.symbol = $1;
918 stop("No accumulator has been defined", EX_DATAERR);
929 test_writable_symbol($1.symbol);
930 $$ = $1;
936 { $$ = $1; }
942 if ($1.value == 0 && is_download_const(&$1) == 0) {
948 stop(errbuf, EX_DATAERR);
950 $$ = $1;
964 test_readable_symbol($1.symbol);
965 $$ = $1;
981 { $$ = 1; }
1004 stop("Critical Section within Critical Section",
1009 cs->begin_addr = instruction_ptr;
1020 stop("Unballanced 'end_cs'", EX_DATAERR);
1024 cs->end_addr = instruction_ptr;
1032 { $$ = 1; }
1038 if ($2->type != UNINITIALIZED) {
1039 stop("Program label multiply defined", EX_DATAERR);
1042 $2->type = LABEL;
1044 $2->info.linfo->address = instruction_ptr;
1045 $2->info.linfo->exported = $1;
1052 $$.symbol = $1;
1057 $$.symbol = $1;
1060 | T_SYMBOL '-' T_NUMBER
1062 $$.symbol = $1;
1063 $$.offset = -$3;
1075 | '.' '-' T_NUMBER
1078 $$.offset = -$3;
1089 new_scope->type = SCOPE_IF;
1090 new_scope->begin_addr = instruction_ptr;
1091 new_scope->func_num = $2->info.condinfo->func_num;
1104 last_scope = TAILQ_LAST(&scope_context->inner_scope,
1107 || last_scope->type == T_ELSE) {
1109 stop("'else if' without leading 'if'", EX_DATAERR);
1114 new_scope->type = SCOPE_ELSE_IF;
1115 new_scope->begin_addr = instruction_ptr;
1116 new_scope->func_num = $3->info.condinfo->func_num;
1129 last_scope = TAILQ_LAST(&scope_context->inner_scope,
1132 || last_scope->type == SCOPE_ELSE) {
1134 stop("'else' without leading 'if'", EX_DATAERR);
1138 new_scope->type = SCOPE_ELSE;
1139 new_scope->begin_addr = instruction_ptr;
1149 if (scope_context->type == SCOPE_ROOT) {
1150 stop("Unexpected '}' encountered", EX_DATAERR);
1154 scope_context->end_addr = instruction_ptr;
1162 stop("Unexpected '}' encountered", EX_DATAERR);
1178 format_1_instr($1, &$2, &$4, &$5, $6);
1194 make_expression(&immed, 1);
1204 make_expression(&immed, -1);
1214 make_expression(&immed, -1);
1228 make_expression(&immed, 1);
1235 make_expression(&immed, 1);
1252 make_expression(&immed, 1);
1269 make_expression(&immed, 1);
1349 format_2_instr($1, &$2, &$4, &$5, $6);
1376 format_3_instr($1, &sindex, &immed, &$2);
1431 if (sym->type == UNINITIALIZED) {
1432 sym->type = field_type;
1434 sym->info.finfo->value = value;
1437 stop("Empty Field, or Enum", EX_DATAERR);
1440 sym->info.finfo->value = value;
1441 sym->info.finfo->mask = value;
1443 sym->info.finfo->mask = field_symbol->info.finfo->value;
1445 sym->info.finfo->mask = 0xFF;
1447 } else if (sym->type != field_type) {
1448 stop("Field definition mirrors a definition of the same "
1451 } else if (value != sym->info.finfo->value) {
1452 stop("Field redefined with a conflicting value", EX_DATAERR);
1456 if (symlist_search(&(sym->info.finfo->symrefs),
1457 cur_symbol->name) != NULL) {
1458 stop("Field defined multiple times for register", EX_DATAERR);
1461 symlist_add(&(sym->info.finfo->symrefs), cur_symbol,
1463 cur_symbol->info.rinfo->valid_bitmask |= sym->info.finfo->mask;
1464 cur_symbol->info.rinfo->typecheck_masks = TRUE;
1465 symlist_add(&(cur_symbol->info.rinfo->fields), sym, SYMLIST_SORT);
1471 switch (symbol->type) { in initialize_symbol()
1473 stop("Call to initialize_symbol with type field unset", in initialize_symbol()
1480 symbol->info.rinfo = in initialize_symbol()
1482 if (symbol->info.rinfo == NULL) { in initialize_symbol()
1483 stop("Can't create register info", EX_SOFTWARE); in initialize_symbol()
1486 memset(symbol->info.rinfo, 0, in initialize_symbol()
1488 SLIST_INIT(&(symbol->info.rinfo->fields)); in initialize_symbol()
1495 symbol->info.rinfo->modes = in initialize_symbol()
1496 scb_or_sram_symbol->info.rinfo->modes; in initialize_symbol()
1498 symbol->info.rinfo->modes = ~0; in initialize_symbol()
1501 symbol->info.ainfo = in initialize_symbol()
1503 if (symbol->info.ainfo == NULL) { in initialize_symbol()
1504 stop("Can't create alias info", EX_SOFTWARE); in initialize_symbol()
1507 memset(symbol->info.ainfo, 0, in initialize_symbol()
1514 symbol->info.finfo = in initialize_symbol()
1516 if (symbol->info.finfo == NULL) { in initialize_symbol()
1517 stop("Can't create field info", EX_SOFTWARE); in initialize_symbol()
1520 memset(symbol->info.finfo, 0, sizeof(struct field_info)); in initialize_symbol()
1521 SLIST_INIT(&(symbol->info.finfo->symrefs)); in initialize_symbol()
1525 symbol->info.cinfo = in initialize_symbol()
1527 if (symbol->info.cinfo == NULL) { in initialize_symbol()
1528 stop("Can't create alias info", EX_SOFTWARE); in initialize_symbol()
1531 memset(symbol->info.cinfo, 0, in initialize_symbol()
1535 symbol->info.linfo = in initialize_symbol()
1537 if (symbol->info.linfo == NULL) { in initialize_symbol()
1538 stop("Can't create label info", EX_SOFTWARE); in initialize_symbol()
1541 memset(symbol->info.linfo, 0, in initialize_symbol()
1545 symbol->info.condinfo = in initialize_symbol()
1547 if (symbol->info.condinfo == NULL) { in initialize_symbol()
1548 stop("Can't create conditional info", EX_SOFTWARE); in initialize_symbol()
1551 memset(symbol->info.condinfo, 0, in initialize_symbol()
1555 symbol->info.macroinfo = in initialize_symbol()
1557 if (symbol->info.macroinfo == NULL) { in initialize_symbol()
1558 stop("Can't create macro info", EX_SOFTWARE); in initialize_symbol()
1561 memset(symbol->info.macroinfo, 0, in initialize_symbol()
1563 STAILQ_INIT(&symbol->info.macroinfo->args); in initialize_symbol()
1566 stop("Call to initialize_symbol with invalid symbol type", in initialize_symbol()
1580 if (cur_symbol == NULL || cur_symbol->type != MACRO) { in add_macro_arg()
1581 stop("Invalid current symbol for adding macro arg", in add_macro_arg()
1588 stop("Can't create macro_arg structure", EX_SOFTWARE); in add_macro_arg()
1591 marg->replacement_text = NULL; in add_macro_arg()
1593 "[^-/A-Za-z0-9_](%s)([^-/A-Za-z0-9_]|$)", in add_macro_arg()
1596 stop("Regex text buffer too small for arg", in add_macro_arg()
1600 retval = regcomp(&marg->arg_regex, regex_pattern, REG_EXTENDED); in add_macro_arg()
1602 stop("Regex compilation failed", EX_SOFTWARE); in add_macro_arg()
1605 STAILQ_INSERT_TAIL(&cur_symbol->info.macroinfo->args, marg, links); in add_macro_arg()
1611 if (cur_symbol == NULL || cur_symbol->type != MACRO) { in add_macro_body()
1612 stop("Invalid current symbol for adding macro arg", in add_macro_body()
1616 cur_symbol->info.macroinfo->body = strdup(bodytext); in add_macro_body()
1617 if (cur_symbol->info.macroinfo->body == NULL) { in add_macro_body()
1618 stop("Can't duplicate macro body text", EX_SOFTWARE); in add_macro_body()
1628 if (symbol->type == UNINITIALIZED) { in process_register()
1630 symbol->name); in process_register()
1631 stop(errbuf, EX_DATAERR); in process_register()
1633 } else if (symbol->type == ALIAS) { in process_register()
1634 *p_symbol = symbol->info.ainfo->parent; in process_register()
1635 } else if ((symbol->type != REGISTER) in process_register()
1636 && (symbol->type != SCBLOC) in process_register()
1637 && (symbol->type != SRAMLOC)) { in process_register()
1640 symbol->name); in process_register()
1641 stop(errbuf, EX_DATAERR); in process_register()
1652 if (src->symbol == NULL) in format_1_instr()
1656 test_writable_symbol(dest->symbol); in format_1_instr()
1657 test_readable_symbol(src->symbol); in format_1_instr()
1659 if (!is_location_address(dest->symbol)) { in format_1_instr()
1666 f1_instr = &instr->format.format1; in format_1_instr()
1667 f1_instr->ret = ret ? 1 : 0; in format_1_instr()
1668 f1_instr->opcode = opcode; in format_1_instr()
1669 f1_instr->destination = dest->symbol->info.rinfo->address in format_1_instr()
1670 + dest->offset; in format_1_instr()
1671 f1_instr->source = src->symbol->info.rinfo->address in format_1_instr()
1672 + src->offset; in format_1_instr()
1673 f1_instr->immediate = immed->value; in format_1_instr()
1676 f1_instr->parity = 1; in format_1_instr()
1677 else if (dest->symbol == mode_ptr.symbol) { in format_1_instr()
1685 if (src->symbol == allones.symbol) in format_1_instr()
1687 else if (src->symbol == allzeros.symbol) in format_1_instr()
1689 else if (src->symbol == mode_ptr.symbol) in format_1_instr()
1696 dst_value = src_value & immed->value; in format_1_instr()
1699 dst_value = src_value ^ immed->value; in format_1_instr()
1702 dst_value = (src_value + immed->value) & 0xFF; in format_1_instr()
1705 dst_value = src_value | immed->value; in format_1_instr()
1718 symlist_free(&immed->referenced_syms); in format_1_instr()
1730 if (src->symbol == NULL) in format_2_instr()
1734 test_writable_symbol(dest->symbol); in format_2_instr()
1735 test_readable_symbol(src->symbol); in format_2_instr()
1739 f2_instr = &instr->format.format2; in format_2_instr()
1740 f2_instr->ret = ret ? 1 : 0; in format_2_instr()
1741 f2_instr->opcode = AIC_OP_ROL; in format_2_instr()
1742 f2_instr->destination = dest->symbol->info.rinfo->address in format_2_instr()
1743 + dest->offset; in format_2_instr()
1744 f2_instr->source = src->symbol->info.rinfo->address in format_2_instr()
1745 + src->offset; in format_2_instr()
1746 if (places->value > 8 || places->value <= 0) { in format_2_instr()
1747 stop("illegal shift value", EX_DATAERR); in format_2_instr()
1752 if (places->value == 8) in format_2_instr()
1755 shift_control = (places->value << 4) | places->value; in format_2_instr()
1758 if (places->value == 8) { in format_2_instr()
1761 shift_control = (places->value << 4) in format_2_instr()
1762 | (8 - places->value) in format_2_instr()
1767 shift_control = places->value & 0x7; in format_2_instr()
1770 shift_control = (8 - places->value) | 0x08; in format_2_instr()
1774 stop("Invalid shift operation specified", EX_SOFTWARE); in format_2_instr()
1778 f2_instr->shift_control = shift_control; in format_2_instr()
1779 symlist_free(&places->referenced_syms); in format_2_instr()
1792 test_readable_symbol(src->symbol); in format_3_instr()
1796 f3_instr = &instr->format.format3; in format_3_instr()
1797 if (address->symbol == NULL) { in format_3_instr()
1799 addr = instruction_ptr + address->offset; in format_3_instr()
1800 } else if (address->symbol->type == UNINITIALIZED) { in format_3_instr()
1802 addr = address->offset; in format_3_instr()
1803 instr->patch_label = address->symbol; in format_3_instr()
1805 addr = address->symbol->info.linfo->address + address->offset; in format_3_instr()
1806 f3_instr->opcode = opcode; in format_3_instr()
1807 f3_instr->address = addr; in format_3_instr()
1808 f3_instr->source = src->symbol->info.rinfo->address in format_3_instr()
1809 + src->offset; in format_3_instr()
1810 f3_instr->immediate = immed->value; in format_3_instr()
1813 f3_instr->parity = 1; in format_3_instr()
1815 symlist_free(&immed->referenced_syms); in format_3_instr()
1822 if ((symbol->info.rinfo->modes & (0x1 << src_mode)) == 0) { in test_readable_symbol()
1825 symbol->name, src_mode); in test_readable_symbol()
1826 stop(errbuf, EX_DATAERR); in test_readable_symbol()
1829 if (symbol->info.rinfo->mode == WO) { in test_readable_symbol()
1830 stop("Write Only register specified as source", in test_readable_symbol()
1839 if ((symbol->info.rinfo->modes & (0x1 << dst_mode)) == 0) { in test_writable_symbol()
1842 symbol->name, dst_mode); in test_writable_symbol()
1843 stop(errbuf, EX_DATAERR); in test_writable_symbol()
1846 if (symbol->info.rinfo->mode == RO) { in test_writable_symbol()
1847 stop("Read Only register specified as destination", in test_writable_symbol()
1856 symbol_t *symbol = sym->symbol; in type_check()
1875 mask = (int8_t)~symbol->info.rinfo->valid_bitmask; in type_check()
1876 value = (int8_t)expression->value; in type_check()
1882 symbol->name); in type_check()
1883 stop(errbuf, EX_DATAERR); in type_check()
1891 if (symbol->info.rinfo->typecheck_masks != FALSE) { in type_check()
1892 for(node = expression->referenced_syms.slh_first; in type_check()
1894 node = node->links.sle_next) { in type_check()
1895 if ((node->symbol->type == MASK in type_check()
1896 || node->symbol->type == FIELD in type_check()
1897 || node->symbol->type == ENUM in type_check()
1898 || node->symbol->type == ENUM_ENTRY) in type_check()
1899 && symlist_search(&node->symbol->info.finfo->symrefs, in type_check()
1900 symbol->name) == NULL) { in type_check()
1904 node->symbol->name, symbol->name); in type_check()
1905 stop(errbuf, EX_DATAERR); in type_check()
1915 SLIST_INIT(&immed->referenced_syms); in make_expression()
1916 immed->value = value & 0xff; in make_expression()
1929 if (false_func->type != UNINITIALIZED) { in add_conditional()
1930 stop("Conditional expression '0' " in add_conditional()
1934 false_func->type = CONDITIONAL; in add_conditional()
1936 false_func->info.condinfo->func_num = numfuncs++; in add_conditional()
1941 if (symbol->type == CONDITIONAL) in add_conditional()
1944 if (symbol->type != UNINITIALIZED) { in add_conditional()
1945 stop("Conditional expression conflicts with a symbol", in add_conditional()
1950 symbol->type = CONDITIONAL; in add_conditional()
1952 symbol->info.condinfo->func_num = numfuncs++; in add_conditional()
1969 stop("Can't allocate version string", EX_SOFTWARE); in add_version()
1973 versions[newlen + oldlen + 1] = '\0'; in add_version()
1979 stop(string, EX_DATAERR); in yyerror()
1985 if ((immed->referenced_syms.slh_first != NULL) in is_download_const()
1986 && (immed->referenced_syms.slh_first->symbol->type == DOWNLOAD_CONST)) in is_download_const()
1995 if (sym->type == SCBLOC || in is_location_address()
1996 sym->type == SRAMLOC) in is_location_address()