From 1faff418ec1943d2b4715763ed7beb1829d512a6 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Tue, 13 Aug 2019 15:37:05 -0400 Subject: [PATCH] Teach some ncg machines to use .data8 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. --- mach/i386/ncg/mach.c | 8 +++----- mach/i80/ncg/mach.c | 8 ++++---- mach/i86/ncg/mach.c | 9 +++------ mach/m68020/ncg/mach.c | 6 +++--- mach/powerpc/ncg/mach.c | 7 +++---- mach/vc4/ncg/mach.c | 9 +++++---- 6 files changed, 21 insertions(+), 26 deletions(-) diff --git a/mach/i386/ncg/mach.c b/mach/i386/ncg/mach.c index 34a4b6f16..5f67a3dfb 100644 --- a/mach/i386/ncg/mach.c +++ b/mach/i386/ncg/mach.c @@ -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 diff --git a/mach/i80/ncg/mach.c b/mach/i80/ncg/mach.c index 968ececbe..84a87ff6e 100644 --- a/mach/i80/ncg/mach.c +++ b/mach/i80/ncg/mach.c @@ -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 diff --git a/mach/i86/ncg/mach.c b/mach/i86/ncg/mach.c index d93eaba3d..17cc876b6 100644 --- a/mach/i86/ncg/mach.c +++ b/mach/i86/ncg/mach.c @@ -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 diff --git a/mach/m68020/ncg/mach.c b/mach/m68020/ncg/mach.c index f230761c4..0df6c8389 100644 --- a/mach/m68020/ncg/mach.c +++ b/mach/m68020/ncg/mach.c @@ -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 diff --git a/mach/powerpc/ncg/mach.c b/mach/powerpc/ncg/mach.c index 1a1d98d6c..218920ed9 100644 --- a/mach/powerpc/ncg/mach.c +++ b/mach/powerpc/ncg/mach.c @@ -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 diff --git a/mach/vc4/ncg/mach.c b/mach/vc4/ncg/mach.c index 16ca94f35..68f205c06 100644 --- a/mach/vc4/ncg/mach.c +++ b/mach/vc4/ncg/mach.c @@ -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