From 355b4abcee015c3fae9ac5653c25259e104a886c Mon Sep 17 00:00:00 2001 From: xleroy Date: Sat, 4 Aug 2007 07:27:50 +0000 Subject: Fusion des modifications faites sur les branches "tailcalls" et "smallstep". En particulier: - Semantiques small-step depuis RTL jusqu'a PPC - Cminor independant du processeur - Ajout passes Selection et Reload - Ajout des langages intermediaires CminorSel et LTLin correspondants - Ajout des tailcalls depuis Cminor jusqu'a PPC git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@384 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- test/c/Makefile | 9 ++++----- test/c/knucleotide.c | 4 ---- test/c/mandelbrot.c | 4 ---- test/cminor/Makefile | 6 ++++++ test/cminor/sha1.cmp | 2 +- test/cminor/switchtbl.cm | 16 ++++++++++++++++ test/harness/mainlists.c | 5 ----- test/harness/mainswitchtbl.c | 11 +++++++++++ 8 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 test/cminor/switchtbl.cm create mode 100644 test/harness/mainswitchtbl.c (limited to 'test') diff --git a/test/c/Makefile b/test/c/Makefile index 88969342..3f4ea40a 100644 --- a/test/c/Makefile +++ b/test/c/Makefile @@ -1,8 +1,7 @@ CCOMP=../../ccomp -CCOMPFLAGS=-dump-c -I../lib +CCOMPFLAGS=-stdlib ../../runtime -dclight -dasm CC=gcc -arch ppc - CFLAGS=-O1 -Wall LIBS= @@ -20,11 +19,11 @@ all: $(PROGS:%=%.compcert) all_gcc: $(PROGS:%=%.gcc) -%.compcert: %.s - $(CC) $(CFLAGS) -o $*.compcert $*.s ../lib/libcompcert.a $(LIBS) +%.compcert: %.c $(CCOMP) + $(CCOMP) $(CCOMPFLAGS) -o $*.compcert $*.c $(LIBS) %.s: %.c ../../ccomp - $(CCOMP) $(CCOMPFLAGS) $*.c + $(CCOMP) $(CCOMPFLAGS) -S $*.c %.gcc: %.c $(CC) $(CFLAGS) -o $*.gcc $*.c $(LIBS) diff --git a/test/c/knucleotide.c b/test/c/knucleotide.c index 955af7f9..f7438926 100644 --- a/test/c/knucleotide.c +++ b/test/c/knucleotide.c @@ -8,11 +8,7 @@ http://cvs.alioth.debian.org/cgi-bin/cvsweb.cgi/shootout/bench/Include/?cvsroot=shootout */ -#ifdef __COMPCERT__ -#include -#else #include -#endif #include #include #include diff --git a/test/c/mandelbrot.c b/test/c/mandelbrot.c index f4c0db1b..93aa8acb 100644 --- a/test/c/mandelbrot.c +++ b/test/c/mandelbrot.c @@ -10,11 +10,7 @@ compile flags: -O3 -ffast-math -march=pentium4 -funroll-loops */ -#ifdef __COMPCERT__ -#include -#else #include -#endif #include int main (int argc, char **argv) diff --git a/test/cminor/Makefile b/test/cminor/Makefile index 29ebf699..9d2dfdb9 100644 --- a/test/cminor/Makefile +++ b/test/cminor/Makefile @@ -1,4 +1,5 @@ CCOMP=../../ccomp +FLAGS=-S CPP=cpp -P CC=gcc CFLAGS=-arch ppc -g @@ -69,6 +70,11 @@ marksweep: marksweep.o maingc.o marksweepcheck.o clean:: rm -f stopcopy +switchtbl: switchtbl.o mainswitchtbl.o + $(CC) $(CFLAGS) -o switchtbl switchtbl.o mainswitchtbl.o +clean:: + rm -f switchtbl + .SUFFIXES: .SUFFIXES: .cmp .cm .s .o .c .S diff --git a/test/cminor/sha1.cmp b/test/cminor/sha1.cmp index ca245443..31c4b178 100644 --- a/test/cminor/sha1.cmp +++ b/test/cminor/sha1.cmp @@ -54,7 +54,7 @@ extern "memset" : int -> int -> int -> void "SHA1_transform"(ctx) : int -> void { - stack 320 + stack 320; var i, p, a, b, c, d, e, t; /* Convert buffer data to 16 big-endian integers */ diff --git a/test/cminor/switchtbl.cm b/test/cminor/switchtbl.cm new file mode 100644 index 00000000..07bda7ed --- /dev/null +++ b/test/cminor/switchtbl.cm @@ -0,0 +1,16 @@ +"f"(x): int -> int +{ + match (x) { + case 0: return 00; + case 1: return 11; + case 2: return 22; + case 3: return 33; + case 4: return 44; + case 5: return 55; + case 6: return 66; + case 7: return 77; + case 8: return 88; + case 9: return 99; +} +} + diff --git a/test/harness/mainlists.c b/test/harness/mainlists.c index ef11f6ef..281b919f 100644 --- a/test/harness/mainlists.c +++ b/test/harness/mainlists.c @@ -2,11 +2,6 @@ #include #include -void * compcert_alloc(int sz) -{ - return malloc(sz); -} - struct cons { int hd; struct cons * tl; }; typedef struct cons * list; diff --git a/test/harness/mainswitchtbl.c b/test/harness/mainswitchtbl.c new file mode 100644 index 00000000..24ba17e7 --- /dev/null +++ b/test/harness/mainswitchtbl.c @@ -0,0 +1,11 @@ +#include +#include + +extern int f(int); + +int main(int argc, char ** argv) +{ + int i; + for (i = 0; i < 10; i++) printf("%2d -> %2d\n", i, f(i)); + return 0; +} -- cgit