From 3bd2f49ac40a4772679919c3c38a9f29d6a8899f Mon Sep 17 00:00:00 2001 From: William Chen Date: Wed, 10 Mar 2021 16:42:25 -0800 Subject: [PATCH] Add OPTIMIZE for C test control. --- Makefile | 2 +- test/Makefile.in | 2 ++ test/c_demo/Makefile | 2 +- test/c_demo/README.md | 2 +- test/c_test/sanity/Makefile | 2 +- test/maple_aarch64_with_whirl2mpl.sh | 15 +++++++++++---- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 39dbbb15b7..3be57cb4fd 100644 --- a/Makefile +++ b/Makefile @@ -120,7 +120,7 @@ setup: .PHONY: demo demo: - test/maple_aarch64_with_whirl2mpl.sh test/c_demo printHuawei 1 + test/maple_aarch64_with_whirl2mpl.sh test/c_demo printHuawei 1 1 .PHONY: test1 test1: libcore diff --git a/test/Makefile.in b/test/Makefile.in index 1f22c94ae6..62aec71ce2 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -15,4 +15,6 @@ CCMD := $(MAPLE_ROOT)/test/maple_aarch64_with_whirl2mpl.sh +OPTIMIZE := 0 + VERBOSE := 0 diff --git a/test/c_demo/Makefile b/test/c_demo/Makefile index 87b571e70b..2d89b333af 100644 --- a/test/c_demo/Makefile +++ b/test/c_demo/Makefile @@ -15,4 +15,4 @@ .PHONY: default default: - ../maple_aarch64_with_whirl2mpl.sh . printHuawei 1 + ../maple_aarch64_with_whirl2mpl.sh . printHuawei 1 1 diff --git a/test/c_demo/README.md b/test/c_demo/README.md index 365db62ed1..4158f26cc2 100644 --- a/test/c_demo/README.md +++ b/test/c_demo/README.md @@ -27,4 +27,4 @@ Besides maple compiler, included are processes using C front end tools: #### 使用说明 run the following scripts for details - ../maple_aarch64_with_whirl2mpl.sh . printHuawei 1 + ../maple_aarch64_with_whirl2mpl.sh . printHuawei 1 1 diff --git a/test/c_test/sanity/Makefile b/test/c_test/sanity/Makefile index 9ee951c36d..eaa099be82 100644 --- a/test/c_test/sanity/Makefile +++ b/test/c_test/sanity/Makefile @@ -21,5 +21,5 @@ CASES=$(basename $(wildcard *.c)) all: $(CASES) % : %.c - $(CCMD) . $@ $(VERBOSE) + $(CCMD) . $@ $(OPTIMIZE) $(VERBOSE) diff --git a/test/maple_aarch64_with_whirl2mpl.sh b/test/maple_aarch64_with_whirl2mpl.sh index b0ab37fb1d..826a8611d2 100755 --- a/test/maple_aarch64_with_whirl2mpl.sh +++ b/test/maple_aarch64_with_whirl2mpl.sh @@ -22,10 +22,11 @@ rel=`realpath --relative-to=$MAPLE_ROOT $CURRDIR` dir=$1 src=$2 -if [ $# -le 2 ]; then +opt=$3 +if [ $# -le 3 ]; then verbose=0 else - verbose=$3 + verbose=$4 fi WORKDIR=$MAPLE_BUILD_OUTPUT/$rel/$dir/aarch64_with_whirl2mpl @@ -47,8 +48,14 @@ $MAPLE_ROOT/tools/open64_prebuilt/x86/aarch64/bin/clangfe $FLAGS $src.c > doit.l echo $MAPLE_ROOT/tools/open64_prebuilt/x86/aarch64/bin/whirl2mpl -a $src.B >> cmd.log $MAPLE_ROOT/tools/open64_prebuilt/x86/aarch64/bin/whirl2mpl -a $src.B >> doit.log 2>&1 -echo $MAPLE_EXECUTE_BIN/maple --run=mplcg --option=\"-O2 -quiet\" $src.mpl >> cmd.log -$MAPLE_EXECUTE_BIN/maple --run=mplcg --option="-O2 -quiet" $src.mpl >> doit.log 2>&1 + +if [ $opt -eq 0 ]; then + echo $MAPLE_EXECUTE_BIN/maple --run=mplcg --option=\"-quiet\" $src.mpl >> cmd.log + $MAPLE_EXECUTE_BIN/maple --run=mplcg --option="-quiet" $src.mpl >> doit.log 2>&1 +else + echo $MAPLE_EXECUTE_BIN/maple --run=mplcg --option=\"-O2 -quiet\" $src.mpl >> cmd.log + $MAPLE_EXECUTE_BIN/maple --run=mplcg --option="-O2 -quiet" $src.mpl >> doit.log 2>&1 +fi echo /usr/bin/aarch64-linux-gnu-gcc-$V -o $src.out $src.s >> cmd.log /usr/bin/aarch64-linux-gnu-gcc-$V -o $src.out $src.s -- Gitee