Widen valu_t in the assembler to 64 bits.
Most machines had undefined valu_t and redefined it to a different type. Edit mach/*/as/mach0.c to remove such redefinitions, so the next change to valu_t will affect all machines. Edit mach/proto/as/comm0.h to change valu_t to int64_t, and add uvalu_t and uint64_t. Remove int64_t y_valu8 from the yacc %union, now that valu_t y_valu can hold 64 bits. Replace y_valu8 with y_valu. The .data8 pseudo becomes less special; it now accepts absolute expressions. This change simplifies the assembler and seems to have no effect on the assembled output. Among the files in share/ack/examples, the only changes are in hilo_bas.* and startrek_c.linuxppc, but those files seem to change whenever I rebuild them.
This commit is contained in:
parent
0b0c3d5b60
commit
a434749fd9
|
@ -8,9 +8,6 @@
|
|||
#define WORDS_REVERSED
|
||||
#define BYTES_REVERSED
|
||||
*/
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
|
||||
#undef ADDR_T
|
||||
#define ADDR_T long
|
||||
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#define LISTING /* enable listing facilities */
|
||||
#define RELOCATION /* generate relocation info */
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
#undef ADDR_T
|
||||
#define ADDR_T long
|
||||
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#define RELOCATION /* generate relocation info */
|
||||
#define DEBUG 0
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
|
||||
#undef ALIGNWORD
|
||||
#define ALIGNWORD 2
|
||||
#undef ALIGNSECT
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#define RELOCATION /* generate relocatable code */
|
||||
#define DEBUG 0
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
#undef ADDR_T
|
||||
#define ADDR_T long
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#define Xfit(f) if (!(f)) Xnofit();
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
#undef ADDR_T
|
||||
#define ADDR_T long
|
||||
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
#define RELOCATION /* generate relocatable code */
|
||||
#define DEBUG 0
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t int32_t
|
||||
|
||||
#undef ADDR_T
|
||||
#define ADDR_T uint32_t
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
#define THREE_PASS /* branch and offset optimization */
|
||||
#define LISTING /* enable listing facilities */
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
#undef ADDR_T
|
||||
#define ADDR_T long
|
||||
#undef ALIGNSECT
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#define RELOCATION /* generate relocatable code */
|
||||
#define DEBUG 0
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t int32_t
|
||||
|
||||
#undef ADDR_T
|
||||
#define ADDR_T uint32_t
|
||||
|
||||
|
|
|
@ -58,7 +58,8 @@ _include <string.h>
|
|||
|
||||
#define GENLAB "I" /* compiler generated labels */
|
||||
|
||||
#define valu_t long /* type of expression values */
|
||||
#define valu_t int64_t /* type of expression values */
|
||||
#define uvalu_t uint64_t /* unsigned valu_t */
|
||||
#define ADDR_T unsigned short /* type of dot */
|
||||
#define word_t short /* type of keyword value */
|
||||
/*
|
||||
|
|
|
@ -22,7 +22,6 @@ static item_t *last_it, *o_it;
|
|||
%union {
|
||||
word_t y_word;
|
||||
valu_t y_valu;
|
||||
int64_t y_valu8;
|
||||
expr_t y_expr;
|
||||
item_t *y_item;
|
||||
#ifdef ASLD
|
||||
|
@ -44,7 +43,7 @@ static item_t *last_it, *o_it;
|
|||
%token NUMBER2
|
||||
%token NUMBER3
|
||||
%token NUMBER4
|
||||
%token <y_valu8> NUMBER8
|
||||
%token <y_valu> NUMBER8
|
||||
%token NUMBERF
|
||||
%token DOT
|
||||
%token EXTERN
|
||||
|
@ -77,7 +76,6 @@ static item_t *last_it, *o_it;
|
|||
%nonassoc '~'
|
||||
|
||||
%type <y_valu> absexp optabs1 optabs2
|
||||
%type <y_valu8> datum8
|
||||
%type <y_expr> expr
|
||||
%type <y_item> id_fb
|
||||
|
||||
|
@ -285,17 +283,10 @@ datalist
|
|||
}
|
||||
;
|
||||
|
||||
/* datum8 isn't expr, because int64_t may be wider than valu_t. */
|
||||
datum8 : NUMBER8
|
||||
{ $$ = $1;}
|
||||
| '-' NUMBER8
|
||||
{ $$ = -$2;}
|
||||
;
|
||||
|
||||
data8list
|
||||
: datum8
|
||||
: absexp
|
||||
{ emit8($1);}
|
||||
| data8list ',' datum8
|
||||
| data8list ',' absexp
|
||||
{ emit8($3);}
|
||||
;
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ void putval(int c)
|
|||
v = yylval.y_valu;
|
||||
goto putnum;
|
||||
case NUMBER8:
|
||||
v = yylval.y_valu8;
|
||||
v = yylval.y_valu;
|
||||
for (n = 0; n < sizeof(v); n++)
|
||||
{
|
||||
if (v == 0)
|
||||
|
@ -132,7 +132,7 @@ void putval(int c)
|
|||
c = NUMBER0 + n;
|
||||
else
|
||||
n = 8;
|
||||
v = yylval.y_valu8;
|
||||
v = yylval.y_valu;
|
||||
putnum:
|
||||
putc(c, tempfile);
|
||||
putc(c >> 8, tempfile);
|
||||
|
@ -236,9 +236,6 @@ int getval(int c)
|
|||
v <<= 8;
|
||||
v |= getc(tempfile);
|
||||
}
|
||||
if (c == NUMBER8)
|
||||
yylval.y_valu8 = v;
|
||||
else
|
||||
yylval.y_valu = v;
|
||||
return (c);
|
||||
case IDENT:
|
||||
|
@ -421,7 +418,7 @@ static void need_stringbuf()
|
|||
|
||||
static int innumber(int c)
|
||||
{
|
||||
uint64_t uv;
|
||||
uvalu_t uv;
|
||||
char* p;
|
||||
int radix;
|
||||
static char num[40 + 1];
|
||||
|
@ -473,7 +470,7 @@ static int innumber(int c)
|
|||
serror("digit exceeds radix");
|
||||
uv = uv * radix + c;
|
||||
}
|
||||
yylval.y_valu8 = uv; /* signed = unsigned */
|
||||
yylval.y_valu = uv; /* signed = unsigned */
|
||||
return (NUMBER8);
|
||||
|
||||
floatconstant:
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
#define LISTING
|
||||
#define RELOCATION
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
#undef word_t
|
||||
#define word_t long
|
||||
#undef ADDR_T
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
#define RELOCATION /* generate relocatable code */
|
||||
#define DEBUG 0
|
||||
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
|
||||
#undef ADDR_T
|
||||
#define ADDR_T long
|
||||
|
||||
|
|
|
@ -14,7 +14,5 @@
|
|||
#define ASLD
|
||||
#undef ALIGNSECT
|
||||
#define ALIGNSECT 2
|
||||
#undef valu_t
|
||||
#define valu_t long
|
||||
#undef ADDR_T
|
||||
#define ADDR_T long
|
||||
|
|
|
@ -154,9 +154,8 @@ if the number starts with '0x' it is hexadecimal else
|
|||
if the number starts with '0' it is octal else
|
||||
it's decimal.
|
||||
.fi
|
||||
The range of numbers depends on the machine.
|
||||
A rule of the thumb is that the width of the machine's registers
|
||||
the same is as the number of bits allowed in numbers.
|
||||
The width of numbers is at least 64 bits, so the .data8 pseudo may
|
||||
accept the full range of 8-byte values.
|
||||
.IP comment
|
||||
The character '!' denotes the start of comment, every character
|
||||
up to the next newline is skipped.
|
||||
|
@ -206,11 +205,9 @@ This is not followed by automatic alignment.
|
|||
.Pu ".data4 \fIexpression\fP [, \fIexpression\fP]*"
|
||||
Initialize a sequence of longs (4-byte values).
|
||||
This is not followed by automatic alignment.
|
||||
.Pu ".data8 \fIliteralint\fP [, \fIliteralint\fP]*"
|
||||
.Pu ".data8 \fIexpression\fP [, \fIexpression\fP]*"
|
||||
Initialize a sequence of long longs (8-byte values).
|
||||
This accepts only literal integers, not symbols nor expressions; but
|
||||
a \fIliteralint\fP may be any signed or unsigned 8-byte integer, even
|
||||
if it is outside the usual range for the machine.
|
||||
The expressions must be absolute.
|
||||
This is not followed by automatic alignment.
|
||||
.Pu ".dataf4 \fIliteralfloat\fP [, \fIliteralfloat\fP]*"
|
||||
Initialize a sequence of floats (4-byte values).
|
||||
|
|
Loading…
Reference in a new issue