diffs to get gcc-1.22 running on unixpc (3b1)
Bob Rose
rrr at naucse.UUCP
Mon Jun 20 04:09:14 AEST 1988
Here they are. The first thing to do is get gcc-1.22 and DONT touch it.
Don't link anything to anything else and so on. Next unshar the file below
and apply the diffs to the Makefile. Then type `make cpp1' and about
four hours later you will have gcc. The first thing this will do it
to make the file `cpp.' Gcc has so many #define's that is blows up our
cpp this is why you must use their's. Next make calls itself to make
the gcc (it uses `cctmp' instead of `cc' to compile it. `Cctmp' is just
a shell script to run the c code through gnu-cpp before handing it to
`cc'. Finally the make file calls itself one more time to make gcc with
gcc. Note the kernel has a bug in it (what AT&T produce something buggy,
never ;-) so if for some reason the make blows up (usally you see
assembly code spit out on the screen) just type `make' again, or
`make CC=stage1/gcc CFLAGS="-O -Bstage1/"' if it blows up on making
itself (it rarely blows up on making itself though.)
Have fun.
-bob
# This is a shell archive. Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
# "sh file -t" prints a table of contents w/o unpacking..
#
# Wrapped by rrr on Sat Jun 18 01:23:38 MST 1988
if [ "$1" = "-t" ]
then
echo "Files in this shell archive:"
echo " "
for i in Makefile.diffs config.tmp.h tm-3B1.h cctmp
do
echo " $i"
done
exit 0
fi
# Contents: Makefile.diffs config.tmp.h tm-3B1.h cctmp
echo x - Makefile.diffs
sed 's/^@//' > "Makefile.diffs" <<'@//E*O*F Makefile.diffs//'
*** Makefile.orig Fri Jun 17 16:23:29 1988
--- Makefile Sat Jun 18 01:21:24 1988
***************
*** 40,46
# forces only 68000 instructions to be used.
# If you are compiling this with CC on HPUX, you need the following line:
! # CLIB = alloca.o
# Get alloca.o from GNU Emacs.
# You must also change the line that uses `ranlib'. See below.
--- 40,46 -----
# forces only 68000 instructions to be used.
# If you are compiling this with CC on HPUX, you need the following line:
! CLIB = alloca.o
# Get alloca.o from GNU Emacs.
# You must also change the line that uses `ranlib'. See below.
***************
*** 84,90
RTL_H = rtl.h rtl.def machmode.def
TREE_H = tree.h tree.def machmode.def
! all: gnulib gcc cc1 cpp
compilations: ${OBJS}
--- 84,100 -----
RTL_H = rtl.h rtl.def machmode.def
TREE_H = tree.h tree.def machmode.def
! all1: alloca.o
! chmod +x cctmp move-if-change
! -rm config.h
! ln config-hp9k3.h config.h
! -ln tm-3B1.h tm.h
! -ln output-m68k.c aux-output.c
! -ln m68k.md md
! make cc1 CC=cctmp CFLAGS=-g
! make gcc CC=cctmp CFLAGS=-g
! make stage1
! make all CC=stage1/gcc CFLAGS="-O -Bstage1/"
cpp1: alloca.o
-rm config.h
***************
*** 86,91
all: gnulib gcc cc1 cpp
compilations: ${OBJS}
gcc: gcc.o version.o $(OBSTACK1)
--- 96,115 -----
make stage1
make all CC=stage1/gcc CFLAGS="-O -Bstage1/"
+ cpp1: alloca.o
+ -rm config.h
+ ln config.tmp.h config.h
+ make gnulib
+ make cpp CC=cc CFLAGS=-g
+ rm config.h
+ ln config-hp9k3.h config.h
+ make all1
+
+ alloca.o: alloca.s
+ as alloca.s
+
+ all: alloca.o gnulib gcc cc1 cpp
+
compilations: ${OBJS}
gcc: gcc.o version.o $(OBSTACK1)
***************
*** 111,117
rm -f $${name}.c; \
ln ../gnulib.c $${name}.c; \
$(OLDCC) $(CCLIBFLAGS) -O -I.. -c -DL$${name} $${name}.c; \
! $(AR) qc gnulib $${name}.o; \
done
mv libtemp/gnulib .
rm -rf libtemp
--- 135,141 -----
rm -f $${name}.c; \
ln ../gnulib.c $${name}.c; \
$(OLDCC) $(CCLIBFLAGS) -O -I.. -c -DL$${name} $${name}.c; \
! # $(AR) qc gnulib $${name}.o; \
done
cd libtemp; ar cr gnulib `lorder *.o | tsort`
mv libtemp/gnulib .
***************
*** 113,118
$(OLDCC) $(CCLIBFLAGS) -O -I.. -c -DL$${name} $${name}.c; \
$(AR) qc gnulib $${name}.o; \
done
mv libtemp/gnulib .
rm -rf libtemp
ranlib gnulib
--- 137,143 -----
$(OLDCC) $(CCLIBFLAGS) -O -I.. -c -DL$${name} $${name}.c; \
# $(AR) qc gnulib $${name}.o; \
done
+ cd libtemp; ar cr gnulib `lorder *.o | tsort`
mv libtemp/gnulib .
rm -rf libtemp
# ranlib gnulib
***************
*** 115,121
done
mv libtemp/gnulib .
rm -rf libtemp
! ranlib gnulib
# On HPUX, if you are working with the GNU assembler and linker,
# the previous line must be replaced with
# No change is needed here if you are using the HPUX assembler and linker.
--- 140,146 -----
cd libtemp; ar cr gnulib `lorder *.o | tsort`
mv libtemp/gnulib .
rm -rf libtemp
! # ranlib gnulib
# On HPUX, if you are working with the GNU assembler and linker,
# the previous line must be replaced with
# No change is needed here if you are using the HPUX assembler and linker.
@//E*O*F Makefile.diffs//
chmod u=rw,g=r,o=r Makefile.diffs
echo x - config.tmp.h
sed 's/^@//' > "config.tmp.h" <<'@//E*O*F config.tmp.h//'
#define USG
#define CPP_PREDEFINES "-Dmc68000 -Dmc68k -Dm68k -Dunix -Dunixpc"
#define SCCS_DIRECTIVE
@//E*O*F config.tmp.h//
chmod u=rw,g=r,o=r config.tmp.h
echo x - tm-3B1.h
sed 's/^@//' > "tm-3B1.h" <<'@//E*O*F tm-3B1.h//'
/* Definitions of target machine for GNU compiler.
AT&T UNIX PC version (pc7300, 3b1)
Written by Alex Crain (hack by Robert Rose)
bug reports to alex at umbc3.umd.edu
Copyright (C) 1987, 1988 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY. No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing. Refer to the GNU CC General Public
License for full details.
Everyone is granted permission to copy, modify and redistribute
GNU CC, but only under the conditions described in the
GNU CC General Public License. A copy of this license is
supposed to have been given to you along with GNU CC so you
can know your rights and responsibilities. It should be in a
file named COPYING. Among other things, the copyright notice
and this notice must be preserved on all copies. */
#define SCCS_DIRECTIVE
#define SGS_3B1
#define MOTOROLA
#define SGS
#define HPUX_ASM
#define NO_DBX_FORMAT
#include "tm-m68k.h"
/* See tm-m68k.h. 0 means 680[01]0 with no 68881. */
#define TARGET_DEFAULT 0
/* Names to predefine in the preprocessor for this target machine. */
/* This is needed because some programs, particularly GDB, need to
know which assembler is being used so that the correct `asm'
instructions can be used. */
#define CPP_PREDEFINES "-Dmc68000 -Dmc68k -Dm68k -Dunix -Dunixpc"
/* Every structure or union's size must be a multiple of 2 bytes. */
#define STRUCTURE_SIZE_BOUNDARY 16
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
/* Function calls don't save any fp registers on hpux. */
#undef CALL_USED_REGISTERS
#define CALL_USED_REGISTERS \
{1, 1, 0, 0, 0, 0, 0, 0, \
1, 1, 0, 0, 0, 0, 0, 1, \
1, 1, 1, 1, 1, 1, 1, 1}
/* Override parts of tm-m68k.h to fit the unixpc assembler. */
#undef TARGET_VERSION
#undef REGISTER_NAMES
#undef FUNCTION_PROLOGUE
#undef FUNCTION_EPILOGUE
#undef ASM_FILE_START
#undef ASM_APP_ON
#undef ASM_APP_OFF
#undef TEXT_SECTION_ASM_OP
#undef DATA_SECTION_ASM_OP
#undef ASM_OUTPUT_DOUBLE
#undef ASM_OUTPUT_FLOAT
#undef ASM_OUTPUT_INT
#undef ASM_OUTPUT_SHORT
#undef ASM_OUTPUT_CHAR
#undef ASM_OUTPUT_BYTE
#undef ASM_OUTPUT_ADDR_VEC_ELT
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#undef ASM_OUTPUT_ALIGN
#undef ASM_OUTPUT_SKIP
#undef ASM_OUTPUT_COMMON
#undef ASM_OUTPUT_LOCAL
#undef ASM_FORMAT_PRIVATE_NAME
#undef PRINT_OPERAND
#undef PRINT_OPERAND_ADDRESS
#undef FUNCTION_PROFILER
#undef ASM_GLOBALIZE_LABEL
#undef ASM_OUTPUT_INTERNAL_LABEL
#undef ASM_GENERATE_INTERNAL_LABEL
#undef ASM_OUTPUT_LABELREF
#define TARGET_VERSION printf (" (68k, SGS/AT&T unixpc syntax)");
#define ASM_SPEC "%{m68020:-68020}%{!m68020:-68010}"
#define LIB_SPEC "%{!shlib:%{p:-L/lib/libp} %{pg:-L/lib/libp} -lc}"
#define STARTFILE_SPEC \
"%{!shlib:%{pg:mcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}\
%{shlib:crt0s.o%s shlib.ifile%s} "
#define REGISTER_NAMES \
{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
"%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"}
#define FUNCTION_PROLOGUE(FILE, SIZE) \
{ register int regno; \
register int mask = 0; \
static char *reg_names[] = REGISTER_NAMES; \
extern char call_used_regs[]; \
int fsize = (SIZE); \
if (frame_pointer_needed) \
{ if (TARGET_68020 || fsize < 0x8000) \
fprintf (FILE, "\tlink.w %%fp,&%d\n", -fsize); \
else \
fprintf (FILE, "\tlink.w %%fp,&0\n\tsub.l &%d,%%sp\n", fsize); } \
for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
if (regs_ever_live[regno] && ! call_used_regs[regno]) \
mask |= 1 << (regno - 16); \
if (mask != 0) \
fprintf (FILE, "\tfmovem &0x%x,-(%%sp)\n", mask & 0xff); \
mask = 0; \
for (regno = 0; regno < 16; regno++) \
if (regs_ever_live[regno] && ! call_used_regs[regno]) \
mask |= 1 << (15 - regno); \
if (frame_pointer_needed) \
mask &= ~ (1 << (15-FRAME_POINTER_REGNUM)); \
if (exact_log2 (mask) >= 0) \
fprintf (FILE, "\tmov.l %s,-(%%sp)\n", reg_names[15 - exact_log2 (mask)]); \
else if (mask) fprintf (FILE, "\tmovm.l &0x%x,-(%%sp)\n", mask); }
#define FUNCTION_PROFILER(FILE, LABEL_NO) \
fprintf (FILE, "\tmov.l &LP%d,%%d0\n\tjsr mcount\n", (LABEL_NO));
#define FUNCTION_EPILOGUE(FILE, SIZE) \
{ register int regno; \
register int mask, fmask; \
register int nregs; \
int offset, foffset; \
extern char call_used_regs[]; \
static char *reg_names[] = REGISTER_NAMES; \
extern int current_function_pops_args; \
extern int current_function_args_size; \
int fsize = (SIZE); \
int big = 0; \
nregs = 0; fmask = 0; \
for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
if (regs_ever_live[regno] && ! call_used_regs[regno]) \
{ nregs++; fmask |= 1 << (23 - regno); } \
foffset = nregs * 12; \
nregs = 0; mask = 0; \
if (frame_pointer_needed) regs_ever_live[FRAME_POINTER_REGNUM] = 0; \
for (regno = 0; regno < 16; regno++) \
if (regs_ever_live[regno] && ! call_used_regs[regno]) \
{ nregs++; mask |= 1 << regno; } \
offset = foffset + nregs * 4; \
if (offset + fsize >= 0x8000 && frame_pointer_needed) \
{ fprintf (FILE, "\tmov.l &%d,%%a0\n", -fsize); \
fsize = 0, big = 1; } \
if (exact_log2 (mask) >= 0) { \
if (big) \
fprintf (FILE, "\tmov.l -%d(%%fp,%%a0.l),%s\n", \
offset + fsize, reg_names[exact_log2 (mask)]); \
else if (! frame_pointer_needed) \
fprintf (FILE, "\tmov.l (%%sp)+,%s\n", \
reg_names[exact_log2 (mask)]); \
else \
fprintf (FILE, "\tmov.l -%d(%%fp),%s\n", \
offset + fsize, reg_names[exact_log2 (mask)]); } \
else if (mask) { \
if (big) \
fprintf (FILE, "\tmovm.l -%d(%%fp,%%a0.l),&0x%x\n", \
offset + fsize, mask); \
else if (! frame_pointer_needed) \
fprintf (FILE, "\tmovm.l (%%sp)+,&0x%x\n", mask); \
else \
fprintf (FILE, "\tmovm.l -%d(%%fp),&0x%x\n", \
offset + fsize, mask); } \
if (fmask) { \
if (big) \
fprintf (FILE, "\tfmovem -%d(%%fp,%%a0.l),&0x%x\n", \
foffset + fsize, fmask); \
else if (! frame_pointer_needed) \
fprintf (FILE, "\tfmovem (%%sp)+,&0x%x\n", fmask); \
else \
fprintf (FILE, "\tfmovem -%d(%%fp),&0x%x\n", \
foffset + fsize, fmask); } \
if (frame_pointer_needed) \
fprintf (FILE, "\tunlk %%fp\n"); \
if (current_function_pops_args && current_function_args_size) \
fprintf (FILE, "\trtd &%d\n", current_function_args_size); \
else fprintf (FILE, "\trts\n"); }
#define ASM_FILE_START ""
#define ASM_APP_ON ""
#define ASM_APP_OFF ""
#define TEXT_SECTION_ASM_OP "\ttext"
#define DATA_SECTION_ASM_OP "\tdata"
#define ASCII_DATA_ASM_OP "\tbyte"
/* This says how to output an assembler line
to define a global common symbol. */
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE) \
( fputs ("\tcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%d\n", (SIZE)))
/* Store in OUTPUT a string (made with alloca) containing
an assembler-name for a local static variable named NAME.
LABELNO is an integer which is different for each call. */
#define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 12), \
sprintf ((OUTPUT), "%s%%%d", (NAME), (LABELNO)))
/* This is how to output a command to make the user-level label named NAME
defined for reference from other files. */
#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
do { fputs ("\tglobal ", FILE); assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
/* This is how to output an assembler line defining an `int' constant. */
#define ASM_OUTPUT_INT(FILE,VALUE) \
( fprintf (FILE, "\tlong "), \
output_addr_const (FILE, (VALUE)), \
fprintf (FILE, "\n"))
/* Likewise for `char' and `short' constants. */
#define ASM_OUTPUT_SHORT(FILE,VALUE) \
( fprintf (FILE, "\tshort "), \
output_addr_const (FILE, (VALUE)), \
fprintf (FILE, "\n"))
#define ASM_OUTPUT_CHAR(FILE,VALUE) \
( fprintf (FILE, "\tbyte "), \
output_addr_const (FILE, (VALUE)), \
fprintf (FILE, "\n"))
/* This is how to output an assembler line for a numeric constant byte. */
#define ASM_OUTPUT_BYTE(FILE,VALUE) \
fprintf (FILE, "\tbyte 0x%x\n", (VALUE))
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
fprintf (FILE, "\tlong L%%%d\n", VALUE)
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
fprintf (FILE, "\tshort L%%%d-L%%%d\n", VALUE, REL)
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
fprintf (FILE, "\tspace %d\n", (SIZE))
#define PRINT_OPERAND(FILE, X, CODE) \
{ if (CODE == '.') fprintf (FILE, "."); \
else if (CODE == 'j' || CODE == 'e') ; \
else if (CODE == '#') fprintf (FILE, "&"); \
else if (CODE == '-') fprintf (FILE, "-(%%sp)"); \
else if (CODE == '+') fprintf (FILE, "(%%sp)+"); \
else if (CODE == 's') fprintf (FILE, "(%%sp)"); \
else if (CODE == '!') fprintf (FILE, "%%cc"); \
else if (GET_CODE (X) == REG) \
fprintf (FILE, "%s", reg_name [REGNO (X)]); \
else if (GET_CODE (X) == MEM) \
output_address (XEXP (X, 0)); \
else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode) \
{ union { double d; int i[2]; } u; \
union { float f; int i; } u1; \
u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
u1.f = u.d; \
if (CODE == 'f') \
fprintf (FILE, "&0f%.9g", u1.f); \
else \
fprintf (FILE, "&0x%x", u1.i); } \
else if (GET_CODE (X) == CONST_DOUBLE) \
{ union { double d; int i[2]; } u; \
u.i[0] = XINT (X, 0); u.i[1] = XINT (X, 1); \
fprintf (FILE, "&0f%.20g", u.d); } \
else { putc ('&', FILE); output_addr_const (FILE, X); }}
/* The unixpc doesn't know about double's and float's */
#define ASM_OUTPUT_DOUBLE(FILE,VALUE) \
do { union { double d; long l[2]; } tem; \
tem.d = (VALUE); \
fprintf(FILE, "\tlong 0x%x,0x%x\n", tem.l[0], tem.l[1]); \
} while (0)
#define ASM_OUTPUT_FLOAT(FILE,VALUE) \
do { union { float f; long l;} tem; \
tem.f = (VALUE); \
fprintf (FILE, "\tlong 0x%x\n", tem.l); \
} while (0)
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG) == 1) \
fprintf (FILE, "\teven\n"); \
else if ((LOG) != 0) \
abort ();
/* The beginnings of sdb support... */
#define ASM_OUTPUT_SOURCE_FILENAME(FILE, FILENAME)
#define ASM_OUTPUT_SOURCE_LINE(FILE, LINENO) \
fprintf (FILE, "\tln\t%d\n", LINENO);
/* Yet another null terminated string format. */
#define ASM_OUTPUT_ASCII(FILE,PTR,LEN) \
{ register int sp = 0, lp = 0; \
fprintf (FILE, "\tbyte\t"); \
loop: \
if (PTR[sp] > ' ' && ! (PTR[sp] & 0x80) && PTR[sp] != '\\') \
{ lp += 3; \
fprintf (FILE, "'%c", PTR[sp]); } \
else \
{ lp += 5; \
fprintf (FILE, "0x%x", PTR[sp]); } \
if (++sp < LEN) \
{ if (lp > 60) \
{ lp = 0; \
fprintf (FILE, "\n%s ", ASCII_DATA_ASM_OP); } \
else \
putc (',', FILE); \
goto loop; } \
putc ('\n', FILE); }
/* Note that in the case of the movhi which fetches an element of
an ADDR_DIFF_VEC the offset output is too large by 2.
This is because the 3b1 assembler refuses to subtract 2.
ASM_OUTPUT_CASE_LABEL, below, compensates for this. */
#define PRINT_OPERAND_ADDRESS(FILE, ADDR) \
{ register rtx reg1, reg2, breg, ireg; \
register rtx addr = ADDR; \
rtx offset; \
switch (GET_CODE (addr)) \
{ \
case REG: \
fprintf (FILE, "(%s)", reg_name [REGNO (addr)]); \
break; \
case PRE_DEC: \
fprintf (FILE, "-(%s)", reg_name [REGNO (XEXP (addr, 0))]); \
break; \
case POST_INC: \
fprintf (FILE, "(%s)+", reg_name [REGNO (XEXP (addr, 0))]); \
break; \
case PLUS: \
reg1 = 0; reg2 = 0; \
ireg = 0; breg = 0; \
offset = 0; \
if (CONSTANT_ADDRESS_P (XEXP (addr, 0))) \
{ \
offset = XEXP (addr, 0); \
addr = XEXP (addr, 1); \
} \
else if (CONSTANT_ADDRESS_P (XEXP (addr, 1))) \
{ \
offset = XEXP (addr, 1); \
addr = XEXP (addr, 0); \
} \
if (GET_CODE (addr) != PLUS) ; \
else if (GET_CODE (XEXP (addr, 0)) == SIGN_EXTEND) \
{ \
reg1 = XEXP (addr, 0); \
addr = XEXP (addr, 1); \
} \
else if (GET_CODE (XEXP (addr, 1)) == SIGN_EXTEND) \
{ \
reg1 = XEXP (addr, 1); \
addr = XEXP (addr, 0); \
} \
else if (GET_CODE (XEXP (addr, 0)) == MULT) \
{ \
reg1 = XEXP (addr, 0); \
addr = XEXP (addr, 1); \
} \
else if (GET_CODE (XEXP (addr, 1)) == MULT) \
{ \
reg1 = XEXP (addr, 1); \
addr = XEXP (addr, 0); \
} \
else if (GET_CODE (XEXP (addr, 0)) == REG) \
{ \
reg1 = XEXP (addr, 0); \
addr = XEXP (addr, 1); \
} \
else if (GET_CODE (XEXP (addr, 1)) == REG) \
{ \
reg1 = XEXP (addr, 1); \
addr = XEXP (addr, 0); \
} \
if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT \
|| GET_CODE (addr) == SIGN_EXTEND) \
{ if (reg1 == 0) reg1 = addr; else reg2 = addr; addr = 0; } \
/* for OLD_INDEXING \
else if (GET_CODE (addr) == PLUS) \
{ \
if (GET_CODE (XEXP (addr, 0)) == REG) \
{ \
reg2 = XEXP (addr, 0); \
addr = XEXP (addr, 1); \
} \
else if (GET_CODE (XEXP (addr, 1)) == REG) \
{ \
reg2 = XEXP (addr, 1); \
addr = XEXP (addr, 0); \
} \
} \
*/ \
if (offset != 0) { if (addr != 0) abort (); addr = offset; } \
if ((reg1 && (GET_CODE (reg1) == SIGN_EXTEND \
|| GET_CODE (reg1) == MULT)) \
|| (reg2 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg2)))) \
{ breg = reg2; ireg = reg1; } \
else if (reg1 != 0 && REGNO_OK_FOR_BASE_P (REGNO (reg1))) \
{ breg = reg1; ireg = reg2; } \
if (ireg != 0 && breg == 0 && GET_CODE (addr) == LABEL_REF) \
{ int scale = 1; \
if (GET_CODE (ireg) == MULT) \
{ scale = INTVAL (XEXP (ireg, 1)); \
ireg = XEXP (ireg, 0); } \
if (GET_CODE (ireg) == SIGN_EXTEND) \
fprintf (FILE, "10(%%pc,%s.w", \
/*CODE_LABEL_NUMBER (XEXP (addr, 0)), \
CODE_LABEL_NUMBER (XEXP (addr, 0)),*/ \
reg_name[REGNO (XEXP (ireg, 0))]); \
else \
fprintf (FILE, "10(%%pc,%s.l", \
/*CODE_LABEL_NUMBER (XEXP (addr, 0)), \
CODE_LABEL_NUMBER (XEXP (addr, 0)),*/ \
reg_name[REGNO (ireg)]); \
if (scale != 1) fprintf (FILE, ":%d", scale); \
fprintf (FILE, ")"); \
break; } \
if (ireg != 0 || breg != 0) \
{ int scale = 1; \
if (breg == 0) \
abort (); \
if (addr != 0) \
output_addr_const (FILE, addr); \
fprintf (FILE, "(%s", reg_name[REGNO (breg)]); \
if (ireg != 0) \
putc (',', FILE); \
if (ireg != 0 && GET_CODE (ireg) == MULT) \
{ scale = INTVAL (XEXP (ireg, 1)); \
ireg = XEXP (ireg, 0); } \
if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) \
fprintf (FILE, "%s.w", reg_name[REGNO (XEXP (ireg, 0))]); \
else if (ireg != 0) \
fprintf (FILE, "%s.l", reg_name[REGNO (ireg)]); \
if (scale != 1) fprintf (FILE, ":%d", scale); \
putc (')', FILE); \
break; \
} \
else if (reg1 != 0 && GET_CODE (addr) == LABEL_REF) \
{ fprintf (FILE, "10(%%pc,%s.w)", \
/* CODE_LABEL_NUMBER (XEXP (addr, 0)), \
CODE_LABEL_NUMBER (XEXP (addr, 0)),*/ \
reg_name[REGNO (reg1)]); \
break; } \
default: \
if (GET_CODE (addr) == CONST_INT \
&& INTVAL (addr) < 0x8000 \
&& INTVAL (addr) >= -0x8000) \
fprintf (FILE, "%d", INTVAL (addr)); \
else \
output_addr_const (FILE, addr); \
}}
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
fprintf (FILE, "%s%%%d:\n", PREFIX, NUM)
#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
sprintf (LABEL, "%s%%%d", PREFIX, NUM)
#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
fprintf (FILE, "\tswbeg &%d\n%s%%%d:\n", \
XVECLEN (PATTERN (TABLE), 1), PREFIX, NUM)
#define ASM_OUTPUT_OPCODE(FILE, PTR) \
{ if ((PTR)[0] == 'j' && (PTR)[1] == 'b') \
{ ++(PTR); \
while (*(PTR) != ' ') \
{ putc (*(PTR), (FILE)); ++(PTR); } \
fprintf ((FILE), ".w"); } \
else if ((PTR)[0] == 'f') \
{ \
if (!strncmp ((PTR), "fmove", 5)) \
{ fprintf ((FILE), "fmov"); (PTR) += 5; } \
else if (!strncmp ((PTR), "ftst", 4)) \
{ fprintf ((FILE), "ftest"); (PTR) += 4; } \
} \
/* MOVE, MOVEA, MOVEQ, MOVEC ==> MOV */ \
else if ((PTR)[0] == 'm' && (PTR)[1] == 'o' \
&& (PTR)[2] == 'v' && (PTR)[3] == 'e') \
{ fprintf ((FILE), "mov"); (PTR) += 4; \
if ((PTR)[0] == 'q' || (PTR)[0] == 'a' || \
(PTR)[0] == 'c') (PTR)++; } \
/* SUB, SUBQ, SUBA, SUBI ==> SUB */ \
else if ((PTR)[0] == 's' && (PTR)[1] == 'u' \
&& (PTR)[2] == 'b') \
{ fprintf ((FILE), "sub"); (PTR) += 3; \
if ((PTR)[0] == 'q' || (PTR)[0] == 'i' || \
(PTR)[0] == 'a') (PTR)++; } \
/* CMP, CMPA, CMPI, CMPM ==> CMP */ \
else if ((PTR)[0] == 'c' && (PTR)[1] == 'm' \
&& (PTR)[2] == 'p') \
{ fprintf ((FILE), "cmp"); (PTR) += 3; \
if ((PTR)[0] == 'a' || (PTR)[0] == 'i' || \
(PTR)[0] == 'm') (PTR)++; } \
}
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE) \
( fputs ("\tlcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%d\n", (SIZE)))
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
fprintf (FILE, "%s", NAME)
@//E*O*F tm-3B1.h//
chmod u=rw,g=r,o=r tm-3B1.h
echo x - cctmp
sed 's/^@//' > "cctmp" <<'@//E*O*F cctmp//'
#! /bin/sh
PATH=/bin:/usr/bin
export PATH
files=
ofiles=
ldargs=
ccargs=
pcargs=
load=1 # run ld
while [ $# -gt 0 ]
do
case "$1" in
-c) load=0
;;
-o) ldargs="$ldargs $1 $2"
shift
;;
-D*) pcargs="$pcargs $1"
;;
*.o) ofiles="$ofiles $1"
;;
*.c) files="$files $1"
;;
esac
shift
done
if [ "$load" -eq 1 ]
then
cc -g $ofiles $ldargs
else
./cpp -U__STDC__ -U__GNUC__ -U__GNU__ $pcargs $files > xxx.c
cc -c -g xxx.c
mv xxx.o `basename $files .c`.o
rm xxx.c
fi
exit $?
@//E*O*F cctmp//
chmod u=rwx,g=rwx,o=rwx cctmp
exit 0
More information about the Comp.sys.att
mailing list