[m-rev.] diff: test constant propagation
Ralph Becket
rafe at cs.mu.OZ.AU
Wed Feb 11 07:45:05 AEDT 2004
Fergus Henderson, Wednesday, 11 February 2004:
> Estimated hours taken: 1
> Branches: main
>
> Improve the testing of constant propagation.
>
> tests/hard_coded/Mmakefile:
> tests/hard_coded/constant_prop_1.m:
> tests/hard_coded/constant_prop_1.exp:
> tests/hard_coded/constant_prop_2.m:
> tests/hard_coded/constant_prop_2.exp:
> tests/hard_coded/Mercury.options
> Add two new tests of constant propagation.
> For the first test, we test by grepping the generated target code
> for the expected constants.
> For the second test, we test by including a reference to an
> undefined external procedure "link_error" which will get
> optimized away iff the compiler does constant propagation.
>
> Workspace: /home/jupiter/fjh/ws-jupiter/mercury
> Index: tests/hard_coded/Mmakefile
> ===================================================================
> RCS file: /home/mercury1/repository/tests/hard_coded/Mmakefile,v
> retrieving revision 1.222
> diff -u -d -r1.222 Mmakefile
> --- tests/hard_coded/Mmakefile 10 Feb 2004 09:33:06 -0000 1.222
> +++ tests/hard_coded/Mmakefile 10 Feb 2004 13:09:56 -0000
> @@ -23,6 +23,8 @@
> compare_spec \
> comparison \
> contains_char \
> + constant_prop_1 \
> + constant_prop_2 \
> constraint \
> constraint_order \
> construct_test \
> @@ -239,7 +241,7 @@
> endif
>
> # Tests of the Java foreign language interface only
> -# work in IL grades
> +# work in Java grades
> ifeq "$(filter java%,$(GRADE))" ""
> JAVA_PROGS =
> else
> @@ -456,6 +458,31 @@
> < $@.tmp > $@; \
> rm -f $@.tmp; \
> fi
> +
> +# For the constant_prop_1 test case, we test that constant propagation
> +# has been achieved by grepping the generated target code for particular
> +# patterns that will only arise if the Mercury compiler did the intended
> +# constant propagation.
> +constant_prop_1.c: constant_prop_1.c_date
> + grep foobar $@
> + grep 1234 $@
> + grep 5678.0 $@
> [...]
You might want to consider s/5678.0/'5678\.0'/
Apart from that, everything looks fine.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list