Hack: add -fno-dce when compiling for x86_64

This commit is contained in:
Clifford Matthews 2009-06-22 16:24:05 -06:00
parent 9c5ceb4e0f
commit dada69c88d
3 changed files with 29 additions and 15 deletions

20
TODO
View File

@ -1,23 +1,12 @@
May be able to avoid dce problems if we use && for labels (that
may also get rid of our need for the cleanup code, too)
Need to make it so that the minimal required compilation options for
TEST Need to make it so that the minimal required compilation options for
x86_64 (-fno-dce) are set up by default
should probably report dead code elimination bug before I
forget the details (I've probably already lost the minimal
test case) (the details being that if you update a global
register and then use a label pointer to jump away, the
update can get eliminated even though the register can
still be accessed
cleanup and optimize shouldn't be done via environment variables;
TEST cleanup and optimize shouldn't be done via environment variables;
they should be done with AC_ARG_ENABLE and default to be turned on
on the architectures where they work (and should be made to work on
the architectures they support)
only invoke the x86 cleanup & optimize when compiling for an
TEST only invoke the x86 cleanup & optimize when compiling for an
x86 architecture
can probably write cleanup scripts for other architectures,
@ -60,3 +49,6 @@
need a .spec file so we can build syn68k and syn68k-devel
RPMS
May be able to avoid dce problems if we use && for labels (that
may also get rid of our need for the cleanup code, too)

View File

@ -41,6 +41,13 @@ esac
AC_SUBST(host_cpu_class)
# See lengthy explanation in runtime/Makefile.am for dce_fixup explanation
if test x$host_cpu = xx86_64; then
dce_fixup=-fno-dce
fi
AC_SUBST(dce_fixup)
AC_MSG_CHECKING([Syn68k C flags (TODO: FIXME)])
SYN68K_CFLAGS="${SYN68K_CFLAGS--O2 -fomit-frame-pointer}"

View File

@ -9,6 +9,21 @@ SYN68K_CFLAGS=@SYN68K_CFLAGS@
CLEANUP=@assembly_cleanup_script@
OPTIMIZE=@assembly_optimization_script@
# The way we use labels in our assembler is out of spec. The gcc info
# pages say that you're not allowed to jump between labels of asm.
# Historically, however, we chose not to put everything into a single
# function and then jump about within spec. IIRC, that was either due
# to the compilation time and memory consumption to be excessive
# and/or due to us running into compiler bugs. This was all back
# around 1995 though and we have more memory and better compilers. As
# such, it may make sense to re-evaluate the decision to split all the
# opcodes into separate functions. However, until we do that, we need
# to deal with the fact that some dead-code-elimination (DCE)
# optimizations will cause our trickery to fail. As such, we include
# "-fno-dce" in the architectures where we know we're going to have trouble.
dce_fixup=@dce_fixup@
AM_CFLAGS = -DRUNTIME
LOCAL_INCLUDES =
@ -62,7 +77,7 @@ syn68k.o: syn68k.c
outgoing=;\
$(CC) -maccumulate-outgoing-args -c -x c /dev/null 2> /dev/null \
&& outgoing=-maccumulate-outgoing-args; \
$(CC) -S $(SYN68K_CFLAGS) -Wall -static -fno-defer-pop -Wno-unused\
$(CC) -S $(SYN68K_CFLAGS) $(dce_fixup) -Wall -static -fno-defer-pop -Wno-unused\
$(LOCAL_INCLUDES) $$outgoing syn68k.c -o ./syn68k.s
if [ x"$(CLEANUP)" != x ] ; then \
$(PERL) $(srcdir)/$(CLEANUP) < syn68k.s > syn68k.s.new && \