Skip to content

Commit

Permalink
Teach some ncg machines to use .data8
Browse files Browse the repository at this point in the history
This turns EM `con 5000000000I8` into assembly `.data8 5000000000` for
machines i386, i80, i86, m68020, powerpc, vc4.  These are the only ncg
machines in our build.

i80 and i86 get con_mult(sz) for sz == 4 and sz == 8.  The other
machines only get sz == 8, because they have 4-byte words, and ncg
only calls con_mult(sz) when sz is greater than the word size.  The
tab "\t" after .data4 or .data8 is like the tabs in the con_*() macros
of mach/*/ncg/mach.h.

i86 now uses .data4, like i80.  Also, i86 and i386 now use the numeric
string without converting it to an integer and back to a string.
  • Loading branch information
kernigh committed Aug 13, 2019
1 parent 054b9c8 commit 1faff41
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
8 changes: 3 additions & 5 deletions mach/i386/ncg/mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@ con_part(sz,w) register sz; word w; {
}

void
con_mult(sz) word sz; {
long l;
con_mult(word sz) {

if (sz != 4)
if (sz != 8)
fatal("bad icon/ucon size");
l = atol(str);
fprintf(codefile,"\t.data4 %ld\n", l);
fprintf(codefile,".data8\t%s\n", str);
}

#define CODE_GENERATOR
Expand Down
8 changes: 4 additions & 4 deletions mach/i80/ncg/mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ void con_part(int sz, word w)
part_size += sz;
}

void con_mult(sz) word sz;
{
void
con_mult(word sz) {

if (argval != 4)
if (sz != 4 && sz != 8)
fatal("bad icon/ucon size");
fprintf(codefile, ".data4\t%ld\n", atol(str));
fprintf(codefile,".data%d\t%s\n", (int)sz, str);
}

#define CODE_GENERATOR
Expand Down
9 changes: 3 additions & 6 deletions mach/i86/ncg/mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,11 @@ con_part(sz,w) register sz; word w; {
}

void
con_mult(sz) word sz; {
long l;
con_mult(word sz) {

if (sz != 4)
if (sz != 4 && sz != 8)
fatal("bad icon/ucon size");
l = atol(str);
fprintf(codefile,"\t.data2 %d,%d\n",
(int)l&0xFFFF,(int)(l>>16)&0xFFFF);
fprintf(codefile,".data%d\t%s\n", (int)sz, str);
}

#define CODE_GENERATOR
Expand Down
6 changes: 3 additions & 3 deletions mach/m68020/ncg/mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ con_part(sz,w) register sz; word w; {
}

void
con_mult(sz) word sz; {
con_mult(word sz) {

if (sz != 4)
if (sz != 8)
fatal("bad icon/ucon size");
fprintf(codefile,".data4 %s\n",str);
fprintf(codefile,".data8\t%s\n", str);
}

#define IEEEFLOAT
Expand Down
7 changes: 3 additions & 4 deletions mach/powerpc/ncg/mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ con_part(int sz, word w)
}

void
con_mult(word sz)
{
con_mult(word sz) {

if (argval != 4)
if (sz != 8)
fatal("bad icon/ucon size");
fprintf(codefile,".data4 %s\n", str);
fprintf(codefile,".data8\t%s\n", str);
}

#define CODE_GENERATOR
Expand Down
9 changes: 5 additions & 4 deletions mach/vc4/ncg/mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ void con_part(int sz, word w)
part_size += sz;
}

void con_mult(word sz)
{
if (argval != 4)
void
con_mult(word sz) {

if (sz != 8)
fatal("bad icon/ucon size");
fprintf(codefile,".data4 %s\n", str);
fprintf(codefile,".data8\t%s\n", str);
}

#define CODE_GENERATOR
Expand Down

0 comments on commit 1faff41

Please sign in to comment.